Commit 6d4d10ba by “liusq”

循环重试获取远程配置

parent ec4d59c6
...@@ -35,16 +35,20 @@ MainWindow::MainWindow() ...@@ -35,16 +35,20 @@ MainWindow::MainWindow()
QString serialNumber; QString serialNumber;
findLocalSerialNumber(serialNumber); findLocalSerialNumber(serialNumber);
qInfo()<<"serialNumber==:"<<serialNumber; qInfo()<<"serialNumber==:"<<serialNumber;
HttpService httpService(httpurl); bool configFetched = false;
while (!configFetched) {
vides_data::response *res= httpService.httpDeviceConfig(serialNumber,config); HttpService httpService(httpurl);
if(res->code!=0){ vides_data::response *res = httpService.httpDeviceConfig(serialNumber, config);
qInfo()<<"请求远程商户配置失败"; if (res->code != 0) {
instace.deleteObj(res); qInfo() << "请求远程商户配置失败,重试中...";
return ; instace.deleteObj(res);
QThread::sleep(5); // 等待5秒后重试
} else {
instace.deleteObj(res);
configFetched = true;
}
} }
instace.deleteObj(res);
initCommon(); initCommon();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment