CHttpBll.cpp 89 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727
  1. #include "CHttpBll.h"
  2. #include <QCryptographicHash>
  3. #include <QTextCodec>
  4. #include "logproc.h"
  5. std::shared_ptr<CHttpBll> g_httpBllPtr = nullptr;
  6. CHttpBll::CHttpBll()
  7. {
  8. sKey = "";
  9. sToken = "";
  10. }
  11. QString CHttpBll::getAuthorization(QString sUri, QString sTimeStamp)
  12. {
  13. if(sToken != "")
  14. {
  15. QString sAuthorization = "post&" +
  16. sUri + "&" + sTimeStamp + "&" + sToken;
  17. QByteArray sha1 = QCryptographicHash::hash(sAuthorization.toLatin1(), QCryptographicHash::Sha1);
  18. QByteArray shaResult = sha1;
  19. sAuthorization = "Token " + sKey + ":" + shaResult.toBase64().data();
  20. return sAuthorization;
  21. // return sAccessToken;
  22. }
  23. return "";
  24. }
  25. QString CHttpBll::getToken()
  26. {
  27. return sToken;
  28. }
  29. QString CHttpBll::getKey()
  30. {
  31. return sKey;
  32. }
  33. void CHttpBll::requestProc(CHttpRequestPackage requestPkg)
  34. {
  35. // QString sTimeStamp = QString::number(g_AppInfo->timestamp());
  36. // requestPkg.sHeadList.push_back(QString::fromLocal8Bit("platform,%1").arg("WEB"));
  37. // requestPkg.sHeadList.push_back(QString::fromLocal8Bit("deviceId,%1").arg(g_AppInfo->sMachineId));
  38. // requestPkg.sHeadList.push_back(QString::fromLocal8Bit("time,%1").arg(sTimeStamp));
  39. requestPkg.sHeadList.push_back(QString::fromLocal8Bit("Referer,%1").arg(requestPkg.sUri));
  40. requestPkg.sHeadList.push_back(QString::fromLocal8Bit("User-Agent,%1").arg("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) electron-exam-shell/1.9.1 Chrome/58.0.3029.110 Electron/1.7.16 Safari/537.36"));
  41. if(sToken != "")
  42. {
  43. requestPkg.sHeadList.push_back(QString::fromLocal8Bit("key,%1").arg(sKey));
  44. requestPkg.sHeadList.push_back(QString::fromLocal8Bit("token,%1").arg(sToken));
  45. // requestPkg.sHeadList.push_back(QString::fromLocal8Bit("Authorization,%1").arg(getAuthorization(requestPkg.sUri, sTimeStamp)));
  46. }
  47. __int64 nStartTime = g_appInfoPtr->serverMTime();
  48. initHeads(requestPkg);
  49. QString sErrorMsg = "";
  50. std::string sResponse = "";
  51. int nCode = 0;
  52. if (requestPkg.nHttpType == HttpType::htDownload)
  53. {
  54. requestPkg.sUri = requestPkg.sUri.replace("\\", "/");
  55. if (!downLoadFile(requestPkg.sUri.toLocal8Bit().data(), requestPkg.sCommonStr.toLocal8Bit().data(), nCode))
  56. {
  57. --requestPkg.nRetryCount;
  58. if(requestPkg.nRetryCount > 0)
  59. {
  60. downLoad(requestPkg);
  61. return;
  62. }
  63. sErrorMsg = QString::fromLocal8Bit("%1下载失败!").arg(requestPkg.sUri);
  64. }
  65. }
  66. if(requestPkg.nHttpType == HttpType::htPost)
  67. {
  68. if(!doPost(requestPkg, sResponse, nCode))
  69. {
  70. --requestPkg.nRetryCount;
  71. if(requestPkg.nRetryCount > 0)
  72. {
  73. post(requestPkg);
  74. return;
  75. }
  76. sErrorMsg = QString::fromLocal8Bit("接口%1调用失败!").arg(requestPkg.sUri);
  77. }
  78. }
  79. else if(requestPkg.nHttpType == HttpType::htGet || requestPkg.nHttpType == HttpType::htGetUrl)
  80. {
  81. if(!doGet(requestPkg, sResponse, nCode))
  82. {
  83. --requestPkg.nRetryCount;
  84. if(requestPkg.nRetryCount > 0)
  85. {
  86. get(requestPkg);
  87. return;
  88. }
  89. sErrorMsg = QString::fromLocal8Bit("接口%1调用失败!").arg(requestPkg.sUri);
  90. }
  91. }
  92. else if (requestPkg.nHttpType == HttpType::htPut)
  93. {
  94. if (!doPut(requestPkg, sResponse, nCode))
  95. {
  96. --requestPkg.nRetryCount;
  97. if(requestPkg.nRetryCount > 0)
  98. {
  99. put(requestPkg);
  100. return;
  101. }
  102. sErrorMsg = QString::fromLocal8Bit("接口%1调用失败!").arg(requestPkg.sUri);
  103. }
  104. }
  105. __int64 nEndTime = g_appInfoPtr->serverMTime();
  106. myServerLog()<< requestPkg.sUri << ":resCode," << nCode<<"response:"<<sResponse.c_str() << "requestTime(ms):" << nEndTime - nStartTime;
  107. myDebug() << requestPkg.sUri << ":resCode," << nCode<<"response:"<< sResponse.c_str();
  108. if (nCode != 200)
  109. {
  110. try
  111. {
  112. Json::Reader reader;
  113. Json::Value jsonRoot = Json::Value::null;
  114. if (reader.parse(sResponse, jsonRoot))
  115. {
  116. if (jsonRoot.isMember("desc"))
  117. {
  118. sErrorMsg = jsonRoot["desc"].asString().c_str();
  119. }
  120. }
  121. }
  122. catch (const std::exception &e)
  123. {
  124. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  125. }
  126. }
  127. if (nCode == 403)
  128. {
  129. emit sgnTokenExpired();
  130. return;
  131. }
  132. switch(requestPkg.nRequestType)
  133. {
  134. case RequestType::rtUpgrade://客户端版本升级接口
  135. {
  136. CUpgrade upgrade;
  137. upgrade.nCode = nCode;
  138. if(sErrorMsg != "" || nCode !=200)
  139. {
  140. upgrade.sMessage = sErrorMsg;
  141. }
  142. else
  143. {
  144. genUpgrade(&upgrade, sResponse);
  145. }
  146. emit sgnUpgrade(upgrade);
  147. }
  148. break;
  149. case RequestType::rtSysNotice://客户端版本升级接口
  150. {
  151. CSysNotice sn;
  152. sn.nCode = nCode;
  153. if(sErrorMsg != "" || nCode !=200)
  154. {
  155. sn.sMessage = sErrorMsg;
  156. }
  157. else
  158. {
  159. genSysNotice(&sn, sResponse);
  160. }
  161. emit sgnSysNotice(sn);
  162. }
  163. break;
  164. case RequestType::rtGetSoftwareConfig:
  165. {
  166. CGetSoftwareConfig gsc;
  167. gsc.nCode = nCode;
  168. if(sErrorMsg != "" || nCode !=200)
  169. {
  170. gsc.sMessage = sErrorMsg;
  171. }
  172. else
  173. {
  174. genSoftwareConfig(&gsc, sResponse);
  175. }
  176. emit sgnGetSoftwareConfig(gsc);
  177. }
  178. break;
  179. case RequestType::rtDownLoadFile:
  180. {
  181. CDownLoadFileInfo dfi;
  182. dfi.sFileName = requestPkg.sCommonStr;
  183. dfi.sModuleName = requestPkg.sCommonStr1;
  184. dfi.sAdditionStr = requestPkg.sAdditionStr;
  185. dfi.nCode = nCode;
  186. if (sErrorMsg != "" || nCode != 200)
  187. {
  188. dfi.sMessage = sErrorMsg;
  189. }
  190. emit sgnDownLoadFile(dfi);
  191. }
  192. break;
  193. case RequestType::rtStudentClientConfig:
  194. {
  195. CStudentClientConfig scc;
  196. scc.nCode = nCode;
  197. if (sErrorMsg != "" || nCode != 200)
  198. {
  199. scc.sMessage = sErrorMsg;
  200. }
  201. else
  202. {
  203. genStudentClientConfig(&scc, sResponse);
  204. }
  205. emit sgnStudentClientConfig(scc);
  206. }
  207. break;
  208. case RequestType::rtLoginLimit:
  209. {
  210. CLoginLimit ll;
  211. ll.nCode = nCode;
  212. if (sErrorMsg != "" || nCode != 200)
  213. {
  214. ll.sMessage = sErrorMsg;
  215. }
  216. else
  217. {
  218. genLoginLimit(&ll, sResponse);
  219. }
  220. emit sgnLoginLimit(ll);
  221. }
  222. break;
  223. case RequestType::rtLogin://登录
  224. {
  225. CLoginInfo li;
  226. li.nCode = nCode;
  227. if(sErrorMsg != "" || nCode != 200)
  228. {
  229. li.sMessage = sErrorMsg;
  230. }
  231. else
  232. {
  233. genLoginInfo(&li, sResponse);
  234. }
  235. emit sgnLoginInfo(li);
  236. }
  237. break;
  238. case RequestType::rtLogout:
  239. {
  240. CLogout logout;
  241. logout.nCode = nCode;
  242. if (sErrorMsg != "" || nCode != 200)
  243. {
  244. logout.sMessage = sErrorMsg;
  245. }
  246. else
  247. {
  248. genLogout(&logout, sResponse);
  249. }
  250. emit sgnLogout(logout);
  251. }
  252. break;
  253. case RequestType::rtAgreement:
  254. {
  255. CAgreement agm;
  256. agm.nCode = nCode;
  257. if (sErrorMsg != "" || nCode != 200)
  258. {
  259. agm.sMessage = sErrorMsg;
  260. }
  261. else
  262. {
  263. genAgreement(&agm, sResponse);
  264. }
  265. emit sgnAgreement(agm);
  266. }
  267. break;
  268. case RequestType::rtGetStudentInfoBySession:
  269. {
  270. CGetStudentInfoBySession gsibs;
  271. gsibs.nCode = nCode;
  272. if (sErrorMsg != "" || nCode != 200)
  273. {
  274. gsibs.sMessage = sErrorMsg;
  275. }
  276. else
  277. {
  278. genGetStudentInfoBySession(&gsibs, sResponse);
  279. }
  280. emit sgnGetStudentInfoBySession(gsibs);
  281. }
  282. break;
  283. case RequestType::rtSpecialtyNameList:
  284. {
  285. CSpecialtyNameList snl;
  286. snl.nCode = nCode;
  287. if (sErrorMsg != "" || nCode != 200)
  288. {
  289. snl.sMessage = sErrorMsg;
  290. }
  291. else
  292. {
  293. genSpecialtyNameList(&snl, sResponse);
  294. }
  295. emit sgnSpecialtyNameList(snl);
  296. }
  297. break;
  298. case RequestType::rtCheckExamInProgress:
  299. {
  300. CCheckExamInProgress ceip;
  301. ceip.nCode = nCode;
  302. ceip.sEnterType = requestPkg.sCommonStr;
  303. if (sErrorMsg != "" || nCode != 200)
  304. {
  305. ceip.sMessage = sErrorMsg;
  306. }
  307. else
  308. {
  309. genCheckExamInProgress(&ceip, sResponse);
  310. }
  311. emit sgnCheckExamInProgress(ceip);
  312. }
  313. break;
  314. case RequestType::rtGetStudentClientMenu:
  315. {
  316. CGetStudentClientMenu gcm;
  317. gcm.nCode = nCode;
  318. if (sErrorMsg != "" || nCode != 200)
  319. {
  320. gcm.sMessage = sErrorMsg;
  321. }
  322. else
  323. {
  324. genGetStudentClientMenu(&gcm, sResponse);
  325. }
  326. emit sgnGetStudentClientMenu(gcm);
  327. }
  328. break;
  329. case RequestType::rtAppDownLoadUrl:
  330. {
  331. CAppDownLoadUrl adlu;
  332. adlu.nCode = nCode;
  333. if (sErrorMsg != "" || nCode != 200)
  334. {
  335. adlu.sMessage = sErrorMsg;
  336. }
  337. else
  338. {
  339. genAppDownLoadUrl(&adlu, sResponse);
  340. }
  341. emit sgnAppDownLoadUrl(adlu);
  342. }
  343. break;
  344. case RequestType::rtGetUserNoticeList:
  345. {
  346. CGetUserNoticeList gunl;
  347. gunl.nCode = nCode;
  348. if (sErrorMsg != "" || nCode != 200)
  349. {
  350. gunl.sMessage = sErrorMsg;
  351. }
  352. else
  353. {
  354. genGetUserNoticeList(&gunl, sResponse);
  355. }
  356. emit sgnGetUserNoticeList(gunl);
  357. }
  358. break;
  359. case RequestType::rtUpdateNoticeReadStatus:
  360. {
  361. CUpdateNoticeReadStatus unrs;
  362. unrs.nCode = nCode;
  363. unrs.sIds = requestPkg.sCommonStr;
  364. if (sErrorMsg != "" || nCode != 200)
  365. {
  366. unrs.sMessage = sErrorMsg;
  367. }
  368. emit sgnUpdateNoticeReadStatus(unrs);
  369. }
  370. break;
  371. case RequestType::rtQueryExamList:
  372. {
  373. CQueryExamList qel;
  374. qel.nCode = nCode;
  375. if (sErrorMsg != "" || nCode != 200)
  376. {
  377. qel.sMessage = sErrorMsg;
  378. }
  379. else
  380. {
  381. genQueryExamList(&qel, sResponse);
  382. }
  383. emit sgnQueryExamList(qel);
  384. }
  385. break;
  386. case RequestType::rtQueryExamEndList:
  387. {
  388. CQueryExamEndList qeel;
  389. qeel.nCode = nCode;
  390. if (sErrorMsg != "" || nCode != 200)
  391. {
  392. qeel.sMessage = sErrorMsg;
  393. }
  394. else
  395. {
  396. genQueryExamEndList(&qeel, sResponse);
  397. }
  398. emit sgnQueryExamEndList(qeel);
  399. }
  400. break;
  401. case RequestType::rtQueryHomeworkList:
  402. {
  403. CQueryHomeworkList qhl;
  404. qhl.nCode = nCode;
  405. if (sErrorMsg != "" || nCode != 200)
  406. {
  407. qhl.sMessage = sErrorMsg;
  408. }
  409. else
  410. {
  411. genQueryHomeworkList(&qhl, sResponse);
  412. }
  413. emit sgnQueryHomeworkList(qhl);
  414. }
  415. break;
  416. case RequestType::rtQueryBatchList:
  417. {
  418. CQueryBatchList qbl;
  419. qbl.nCode = nCode;
  420. if (sErrorMsg != "" || nCode != 200)
  421. {
  422. qbl.sMessage = sErrorMsg;
  423. }
  424. else
  425. {
  426. genQueryBatchList(&qbl, sResponse);
  427. }
  428. emit sgnQueryBatchList(qbl);
  429. }
  430. break;
  431. case RequestType::rtQueryPracticeCourseList:
  432. {
  433. CQueryPracticeCourseList qpcl;
  434. qpcl.nCode = nCode;
  435. if (sErrorMsg != "" || nCode != 200)
  436. {
  437. qpcl.sMessage = sErrorMsg;
  438. }
  439. else
  440. {
  441. genQueryPracticeCourseList(&qpcl, sResponse);
  442. }
  443. emit sgnQueryPracticeCourseList(qpcl);
  444. }
  445. break;
  446. case RequestType::rtQueryPracticeRecordList:
  447. {
  448. CQueryPracticeRecordList qprl;
  449. qprl.nCode = nCode;
  450. if (sErrorMsg != "" || nCode != 200)
  451. {
  452. qprl.sMessage = sErrorMsg;
  453. }
  454. else
  455. {
  456. genQueryPracticeRecordList(&qprl, sResponse);
  457. }
  458. emit sgnQueryPracticeRecordList(qprl);
  459. }
  460. break;
  461. case RequestType::rtGetPracticeDetailInfo:
  462. {
  463. CGetPracticeDetailInfo gpdi;
  464. gpdi.nCode = nCode;
  465. if (sErrorMsg != "" || nCode != 200)
  466. {
  467. gpdi.sMessage = sErrorMsg;
  468. }
  469. else
  470. {
  471. genGetPracticeDetailInfo(&gpdi, sResponse);
  472. }
  473. emit sgnGetPracticeDetailInfo(gpdi);
  474. }
  475. break;
  476. case RequestType::rtFindExamRecordDataEntity:
  477. {
  478. CFindExamRecordDataEntity ferde;
  479. ferde.nCode = nCode;
  480. if (sErrorMsg != "" || nCode != 200)
  481. {
  482. ferde.sMessage = sErrorMsg;
  483. }
  484. else
  485. {
  486. genFindExamRecordDataEntity(&ferde, sResponse);
  487. }
  488. emit sgnFindExamRecordDataEntity(ferde);
  489. }
  490. break;
  491. case RequestType::rtGetCourseInfo:
  492. {
  493. CGetCourseInfo gci;
  494. gci.nCode = nCode;
  495. if (sErrorMsg != "" || nCode != 200)
  496. {
  497. gci.sMessage = sErrorMsg;
  498. }
  499. else
  500. {
  501. genGetCourseInfo(&gci, sResponse);
  502. }
  503. emit sgnGetCourseInfo(gci);
  504. }
  505. break;
  506. case RequestType::rtGetExamRecordQuestions:
  507. {
  508. CGetExamRecordQuestions gerq;
  509. gerq.nCode = nCode;
  510. if (sErrorMsg != "" || nCode != 200)
  511. {
  512. gerq.sMessage = sErrorMsg;
  513. }
  514. else
  515. {
  516. genGetExamRecordQuestions(&gerq, sResponse);
  517. }
  518. emit sgnGetExamRecordQuestions(gerq);
  519. }
  520. break;
  521. case RequestType::rtGetQuestion:
  522. {
  523. CGetQuestion gq;
  524. gq.nCode = nCode;
  525. if (sErrorMsg != "" || nCode != 200)
  526. {
  527. gq.sMessage = sErrorMsg;
  528. }
  529. else
  530. {
  531. genGetQuestion(&gq, sResponse);
  532. }
  533. emit sgnGetQuestion(gq);
  534. }
  535. break;
  536. case RequestType::rtGetOfflineCourse:
  537. {
  538. CGetOfflineCourse goc;
  539. goc.nCode = nCode;
  540. if (sErrorMsg != "" || nCode != 200)
  541. {
  542. goc.sMessage = sErrorMsg;
  543. }
  544. else
  545. {
  546. genGetOfflineCourse(&goc, sResponse);
  547. }
  548. emit sgnGetOfflineCourse(goc);
  549. }
  550. break;
  551. case RequestType::rtGetOffLineExamAnswerSheet:
  552. {
  553. CGetOffLineExamAnswerSheet goeas;
  554. goeas.nCode = nCode;
  555. if (sErrorMsg != "" || nCode != 200)
  556. {
  557. goeas.sMessage = sErrorMsg;
  558. }
  559. else
  560. {
  561. genGetOffLineExamAnswerSheet(&goeas, sResponse);
  562. }
  563. emit sgnGetOffLineExamAnswerSheet(goeas);
  564. }
  565. break;
  566. case RequestType::rtStartOfflineExam:
  567. {
  568. CStartOfflineExam soe;
  569. soe.nCode = nCode;
  570. soe.nRow = requestPkg.sCommonStr.toInt();
  571. if (sErrorMsg != "" || nCode != 200)
  572. {
  573. soe.sMessage = sErrorMsg;
  574. }
  575. emit sgnStartOfflineExam(soe);
  576. }
  577. break;
  578. case RequestType::rtGetOffLineExamPaper:
  579. {
  580. CGetOffLineExamPaper goep;
  581. goep.nCode = nCode;
  582. if (sErrorMsg != "" || nCode != 200)
  583. {
  584. goep.sMessage = sErrorMsg;
  585. }
  586. else
  587. {
  588. QFile file(requestPkg.sCommonStr);
  589. if (file.open(QIODevice::WriteOnly))
  590. {
  591. qint64 nLen = file.write(sResponse.c_str(), sResponse.length());
  592. file.close();
  593. if (nLen != sResponse.length())
  594. {
  595. goep.nCode = 0;
  596. goep.sMessage = QString::fromLocal8Bit("保存试卷失败");
  597. }
  598. }
  599. else
  600. {
  601. goep.nCode = 0;
  602. goep.sMessage = QString::fromLocal8Bit("创建试卷失败");
  603. }
  604. genGetOffLineExamPaper(&goep, sResponse);
  605. }
  606. emit sgnGetOffLineExamPaper(goep);
  607. }
  608. break;
  609. case RequestType::rtPreviewOffLineExamPaper:
  610. {
  611. CPreviewOffLineExamPaper poep;
  612. poep.nCode = nCode;
  613. poep.nRow = requestPkg.sCommonStr.toInt();
  614. if (sErrorMsg != "" || nCode != 200)
  615. {
  616. poep.sMessage = sErrorMsg;
  617. }
  618. else
  619. {
  620. genPreviewOffLineExamPaper(&poep, sResponse);
  621. }
  622. emit sgnPreviewOffLineExamPaper(poep);
  623. }
  624. break;
  625. case RequestType::rtSubmitOfflinePaper:
  626. {
  627. CSubmitOfflinePaper sop;
  628. sop.nCode = nCode;
  629. if (sErrorMsg != "" || nCode != 200)
  630. {
  631. sop.sMessage = sErrorMsg;
  632. }
  633. emit sgnSubmitOfflinePaper(sop);
  634. }
  635. break;
  636. case RequestType::rtQueryObjectiveScoreList:
  637. {
  638. CQueryObjectiveScoreList qosl;
  639. qosl.nCode = nCode;
  640. qosl.sExamStudentId = requestPkg.sCommonStr;
  641. if (sErrorMsg != "" || nCode != 200)
  642. {
  643. qosl.sMessage = sErrorMsg;
  644. }
  645. else
  646. {
  647. genQueryObjectiveScoreList(&qosl, sResponse);
  648. }
  649. emit sgnQueryObjectiveScoreList(qosl);
  650. }
  651. break;
  652. case RequestType::rtEditPassword:
  653. {
  654. CEditPassword ep;
  655. ep.nCode = nCode;
  656. if (sErrorMsg != "" || nCode != 200)
  657. {
  658. ep.sMessage = sErrorMsg;
  659. }
  660. else
  661. {
  662. genEditPassword(&ep, sResponse);
  663. }
  664. emit sgnEditPassword(ep);
  665. }
  666. break;
  667. case RequestType::rtStartExamLimit:
  668. {
  669. CStartExamLimit sel;
  670. sel.nCode = nCode;
  671. if (sErrorMsg != "" || nCode != 200)
  672. {
  673. sel.sMessage = sErrorMsg;
  674. }
  675. else
  676. {
  677. genStartExamLimit(&sel, sResponse);
  678. }
  679. emit sgnStartExamLimit(sel);
  680. }
  681. break;
  682. case RequestType::rtIpLimit:
  683. {
  684. CIpLimit il;
  685. il.nCode = nCode;
  686. if (sErrorMsg != "" || nCode != 200)
  687. {
  688. il.sMessage = sErrorMsg;
  689. }
  690. else
  691. {
  692. genIpLimit(&il, sResponse);
  693. }
  694. emit sgnIpLimit(il);
  695. }
  696. break;
  697. case RequestType::rtGetExamProperty:
  698. {
  699. CGetExamProperty ep;
  700. ep.nCode = nCode;
  701. ep.sType = requestPkg.sCommonStr;
  702. if (sErrorMsg != "" || nCode != 200)
  703. {
  704. ep.sMessage = sErrorMsg;
  705. }
  706. else
  707. {
  708. genGetExamProperty(&ep, sResponse);
  709. }
  710. emit sgnGetExamProperty(ep);
  711. }
  712. break;
  713. case RequestType::rtFaceCheckEnabled:
  714. {
  715. CFaceCheckEnabled fce;
  716. fce.nCode = nCode;
  717. if (sErrorMsg != "" || nCode != 200)
  718. {
  719. fce.sMessage = sErrorMsg;
  720. }
  721. else
  722. {
  723. genFaceCheckEnabled(&fce, sResponse);
  724. }
  725. emit sgnFaceCheckEnabled(fce);
  726. }
  727. break;
  728. case RequestType::rtLivenessEnabled:
  729. {
  730. CLivenessEnabled le;
  731. le.nCode = nCode;
  732. if (sErrorMsg != "" || nCode != 200)
  733. {
  734. le.sMessage = sErrorMsg;
  735. }
  736. else
  737. {
  738. genLivenessEnabled(&le, sResponse);
  739. }
  740. emit sgnLivenessEnabled(le);
  741. }
  742. break;
  743. case RequestType::rtStartExam:
  744. {
  745. CStartExam se;
  746. se.nCode = nCode;
  747. if (sErrorMsg != "" || nCode != 200)
  748. {
  749. se.sMessage = sErrorMsg;
  750. }
  751. else
  752. {
  753. genStartExam(&se, sResponse);
  754. }
  755. emit sgnStartExam(se);
  756. }
  757. break;
  758. case RequestType::rtGetExamRecordPaperStruct:
  759. {
  760. CGetExamRecordPaperStruct eps;
  761. eps.nCode = nCode;
  762. if (sErrorMsg != "" || nCode != 200)
  763. {
  764. eps.sMessage = sErrorMsg;
  765. }
  766. else
  767. {
  768. genGetExamRecordPaperStruct(&eps, sResponse);
  769. }
  770. emit sgnGetExamRecordPaperStruct(eps);
  771. }
  772. break;
  773. case RequestType::rtGetExamById:
  774. {
  775. CGetExamById examInfo;
  776. examInfo.nCode = nCode;
  777. if (sErrorMsg != "" || nCode != 200)
  778. {
  779. examInfo.sMessage = sErrorMsg;
  780. }
  781. else
  782. {
  783. genGetExamById(&examInfo, sResponse);
  784. }
  785. emit sgnGetExamById(examInfo);
  786. }
  787. break;
  788. case RequestType::rtWeiXinAnswerEnabled:
  789. {
  790. CWeiXinAnswerEnabled wxae;
  791. wxae.nCode = nCode;
  792. if (sErrorMsg != "" || nCode != 200)
  793. {
  794. wxae.sMessage = sErrorMsg;
  795. }
  796. else
  797. {
  798. genWeiXinAnswerEnabled(&wxae, sResponse);
  799. }
  800. emit sgnWeiXinAnswerEnabled(wxae);
  801. }
  802. break;
  803. case RequestType::rtGetWXQrCode:
  804. {
  805. CGetWXQrCode wxc;
  806. wxc.nCode = nCode;
  807. if (sErrorMsg != "" || nCode != 200)
  808. {
  809. wxc.sMessage = sErrorMsg;
  810. }
  811. else
  812. {
  813. genGetWXQrCode(&wxc, sResponse);
  814. }
  815. emit sgnGetWXQrCode(wxc);
  816. }
  817. break;
  818. case RequestType::rtSaveUploadedFileAcknowledgeStatus:
  819. {
  820. CSaveUploadedFileAcknowledgeStatus sufs;
  821. sufs.nCode = nCode;
  822. sufs.sFileUrl = requestPkg.sCommonStr;
  823. if (sErrorMsg != "" || nCode != 200)
  824. {
  825. sufs.sMessage = sErrorMsg;
  826. }
  827. emit sgnSaveUploadedFileAcknowledgeStatus(sufs);
  828. }
  829. break;
  830. case RequestType::rtFindExamQuestionList:
  831. {
  832. CFindExamQuestionList feql;
  833. feql.nCode = nCode;
  834. if (sErrorMsg != "" || nCode != 200)
  835. {
  836. feql.sMessage = sErrorMsg;
  837. }
  838. else
  839. {
  840. genFindExamQuestionList(&feql, sResponse);
  841. }
  842. emit sgnFindExamQuestionList(feql);
  843. }
  844. break;
  845. case RequestType::rtGetQuestionContent:
  846. {
  847. CGetQuestionContent gqc;
  848. QStringList sl = requestPkg.sCommonStr.split(",");
  849. if (sl.count() == 2)
  850. {
  851. gqc.sQuestionId = sl[0];
  852. gqc.sOrder = sl[1];
  853. }
  854. gqc.nCode = nCode;
  855. if (sErrorMsg != "" || nCode != 200)
  856. {
  857. gqc.sMessage = sErrorMsg;
  858. }
  859. else
  860. {
  861. genGetQuestionContent(&gqc, sResponse);
  862. }
  863. emit sgnGetQuestionContent(gqc);
  864. }
  865. break;
  866. case RequestType::rtStartAnswer:
  867. {
  868. CStartAnswer sa;
  869. sa.nCode = nCode;
  870. if (sErrorMsg != "" || nCode != 200)
  871. {
  872. sa.sMessage = sErrorMsg;
  873. }
  874. else
  875. {
  876. genStartAnswer(&sa, sResponse);
  877. }
  878. emit sgnStartAnswer(sa);
  879. }
  880. break;
  881. case RequestType::rtExamHeartbeat:
  882. {
  883. CExamHeartbeat ehb;
  884. ehb.nCode = nCode;
  885. if (sErrorMsg != "" || nCode != 200)
  886. {
  887. ehb.sMessage = sErrorMsg;
  888. }
  889. else
  890. {
  891. genExamHeartbeat(&ehb, sResponse);
  892. }
  893. emit sgnExamHeartbeat(ehb);
  894. }
  895. break;
  896. case RequestType::rtSubmitQuestionAnswer:
  897. {
  898. CSubmitQuestionAnswer sqa;
  899. sqa.nCode = nCode;
  900. QStringList list = requestPkg.sCommonStr.split(",");
  901. if(list.count() == 2)
  902. {
  903. sqa.nOrder = list[0].toInt();
  904. sqa.nVersion = list[1].toInt();
  905. }
  906. if (sErrorMsg != "" || nCode != 200)
  907. {
  908. sqa.sMessage = sErrorMsg;
  909. }
  910. emit sgnSubmitQuestionAnswer(sqa);
  911. }
  912. break;
  913. case RequestType::rtEndExam:
  914. {
  915. CEndExam ee;
  916. ee.nCode = nCode;
  917. ee.sModuleName = requestPkg.sCommonStr;
  918. ee.bForce = requestPkg.sAdditionStr == "1";
  919. if (sErrorMsg != "" || nCode != 200)
  920. {
  921. ee.sMessage = sErrorMsg;
  922. }
  923. emit sgnEndExam(ee);
  924. }
  925. break;
  926. // case RequestType::rtProcessUpload:
  927. // {
  928. // CProcessUpload pu;
  929. // pu.sCommonStr = requestPkg.sCommonStr;
  930. // pu.nCode = nCode;
  931. // if (sErrorMsg != "" || nCode != 200)
  932. // {
  933. // pu.sMessage = sErrorMsg;
  934. // }
  935. // else
  936. // {
  937. // genProcessUpload(&pu, sResponse);
  938. // }
  939. // emit sgnProcessUpload(pu);
  940. // }
  941. // break;
  942. case RequestType::rtSaveFaceCompareResult:
  943. {
  944. CBaseResponsePackage res;
  945. res.nCode = nCode;
  946. if (sErrorMsg != "" || nCode != 200)
  947. {
  948. res.sMessage = sErrorMsg;
  949. }
  950. emit sgnSaveFaceCompareResult(res);
  951. }
  952. break;
  953. case RequestType::rtSaveFaceCaptureResult:
  954. {
  955. CBaseResponsePackage res;
  956. res.nCode = nCode;
  957. if (sErrorMsg != "" || nCode != 200)
  958. {
  959. res.sMessage = sErrorMsg;
  960. }
  961. emit sgnSaveFaceCaptureResult(res);
  962. }
  963. break;
  964. case RequestType::rtSaveFaceLiveVerifyResult:
  965. {
  966. CBaseResponsePackage res;
  967. res.nCode = nCode;
  968. if (sErrorMsg != "" || nCode != 200)
  969. {
  970. res.sMessage = sErrorMsg;
  971. }
  972. emit sgnSaveFaceLiveVerifyResult(res);
  973. }
  974. break;
  975. case RequestType::rtStartFaceLiveVerify:
  976. {
  977. CStartFaceLiveVerify sflv;
  978. sflv.nCode = nCode;
  979. if (sErrorMsg != "" || nCode != 200)
  980. {
  981. sflv.sMessage = sErrorMsg;
  982. }
  983. else
  984. {
  985. genStartFaceLiveVerify(&sflv, sResponse);
  986. }
  987. emit sgnStartFaceLiveVerify(sflv);
  988. }
  989. break;
  990. case RequestType::rtGetOrgPropertiesByGroupWithoutCache:
  991. {
  992. CGetOrgPropertiesByGroupWithoutCache gop;
  993. gop.nCode = nCode;
  994. if (sErrorMsg != "" || nCode != 200)
  995. {
  996. gop.sMessage = sErrorMsg;
  997. }
  998. else
  999. {
  1000. genGetOrgPropertiesByGroupWithoutCache(&gop, sResponse);
  1001. }
  1002. emit sgnGetOrgPropertiesByGroupWithoutCache(gop);
  1003. }
  1004. break;
  1005. case RequestType::rtGetEndExamInfo:
  1006. {
  1007. CGetEndExamInfo geei;
  1008. geei.nCode = nCode;
  1009. if (sErrorMsg != "" || nCode != 200)
  1010. {
  1011. geei.sMessage = sErrorMsg;
  1012. }
  1013. else
  1014. {
  1015. genGetEndExamInfo(&geei, sResponse);
  1016. }
  1017. emit sgnGetEndExamInfo(geei);
  1018. }
  1019. break;
  1020. case RequestType::rtClientExamProcessUploadSign:
  1021. {
  1022. CClientExamProcessUploadSign cepus;
  1023. cepus.sCommonStr = requestPkg.sCommonStr;
  1024. cepus.sFilePath = requestPkg.sCommonStr1;
  1025. cepus.nCode = nCode;
  1026. if (sErrorMsg != "" || nCode != 200)
  1027. {
  1028. cepus.sMessage = sErrorMsg;
  1029. }
  1030. else
  1031. {
  1032. genClientExamProcessUploadSign(&cepus, sResponse);
  1033. }
  1034. emit sgnClientExamProcessUploadSign(cepus);
  1035. }
  1036. break;
  1037. case RequestType::rtUploadFileToAliyun:
  1038. {
  1039. CUploadFileToAliyun ufta;
  1040. ufta.sCommonStr = requestPkg.sCommonStr;
  1041. ufta.sFileUrl = requestPkg.sCommonStr1;
  1042. ufta.nCode = nCode;
  1043. if (sErrorMsg != "" || nCode != 200)
  1044. {
  1045. ufta.sMessage = sErrorMsg;
  1046. }
  1047. emit sgnUploadFileToAliyun(ufta);
  1048. }
  1049. break;
  1050. case RequestType::rtExamControlCheckTime:
  1051. {
  1052. CBaseResponsePackage res;
  1053. res.nCode = nCode;
  1054. if (sErrorMsg != "" || nCode != 200)
  1055. {
  1056. res.sMessage = sErrorMsg;
  1057. }
  1058. emit sgnExamControlCheckTime(res);
  1059. }
  1060. break;
  1061. case RequestType::rtSkipFaceCheckParam:
  1062. {
  1063. CSkipFaceCheckParam res;
  1064. res.nCode = nCode;
  1065. if (sErrorMsg != "" || nCode != 200)
  1066. {
  1067. res.sMessage = sErrorMsg;
  1068. }
  1069. else
  1070. {
  1071. genSkipFaceCheckParam(&res, sResponse);
  1072. }
  1073. emit sgnSkipFaceCheckParam(res);
  1074. }
  1075. break;
  1076. default:
  1077. break;
  1078. }
  1079. }
  1080. void CHttpBll::genUpgrade(CUpgrade *pUpgrade, const std::string &sResponse)
  1081. {
  1082. try
  1083. {
  1084. Json::Reader reader;
  1085. Json::Value jsonRoot = Json::Value::null;
  1086. if(!reader.parse(sResponse, jsonRoot))
  1087. {
  1088. pUpgrade->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1089. myDebug() << pUpgrade->sMessage << sResponse.c_str();
  1090. }
  1091. pUpgrade->sVersion = jsonRoot["version"].asString().c_str();
  1092. pUpgrade->nBuild = jsonRoot["build"].asInt();
  1093. pUpgrade->sContent = jsonRoot["content"].asString().c_str();
  1094. pUpgrade->bForce = jsonRoot["force"].asBool();
  1095. pUpgrade->sUpgradeUrl = jsonRoot["downUrl"].asString().c_str();
  1096. }
  1097. catch (const std::exception &e)
  1098. {
  1099. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1100. }
  1101. }
  1102. void CHttpBll::genAgreement(CAgreement *pAgreement, const std::string &sResponse)
  1103. {
  1104. try
  1105. {
  1106. std::string sRes = sResponse;
  1107. if (sResponse.length() > 3 && sResponse[0] == -17 &&
  1108. sResponse[1] == -69 &&
  1109. sResponse[2] == -65)
  1110. {
  1111. sRes = sResponse.substr(3, sResponse.length() -3);
  1112. }
  1113. Json::Reader reader;
  1114. Json::Value jsonRoot = Json::Value::null;
  1115. if(!reader.parse(sRes, jsonRoot))
  1116. {
  1117. pAgreement->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1118. myDebug() << pAgreement->sMessage << sResponse.c_str();
  1119. }
  1120. pAgreement->sTitle = jsonRoot["title"].asString().c_str();
  1121. pAgreement->nStaySeconds = jsonRoot["staySeconds"].asInt();
  1122. pAgreement->sContent = jsonRoot["content"].toStyledString().c_str();
  1123. }
  1124. catch (const std::exception &e)
  1125. {
  1126. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1127. }
  1128. }
  1129. void CHttpBll::genStudentClientConfig(CStudentClientConfig *pStudentClientConfig, const std::string &sResponse)
  1130. {
  1131. try
  1132. {
  1133. Json::Reader reader;
  1134. Json::Value jsonRoot = Json::Value::null;
  1135. if (!reader.parse(sResponse, jsonRoot))
  1136. {
  1137. pStudentClientConfig->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1138. myDebug() << pStudentClientConfig->sMessage << sResponse.c_str();
  1139. }
  1140. pStudentClientConfig->sCusMenuLogoFileUrl = jsonRoot["CUS_MENU_LOGO_FILE_URL"].asString().c_str();
  1141. pStudentClientConfig->sIdentityNumberLoginAlias = jsonRoot["IDENTITY_NUMBER_LOGIN_ALIAS"].asString().c_str();
  1142. pStudentClientConfig->bIsCustomMenuLogo = QVariant(jsonRoot["IS_CUSTOM_MENU_LOGO"].asString().c_str()).toBool();
  1143. QString loginType = jsonRoot["LOGIN_TYPE"].asString().c_str();
  1144. QStringList ltList = loginType.split(",");
  1145. for (QString sType : ltList)
  1146. {
  1147. if (sType == "STUDENT_CODE")
  1148. {
  1149. pStudentClientConfig->bStudentCodeLogin = true;
  1150. }
  1151. else if (sType == "IDENTITY_NUMBER")
  1152. {
  1153. pStudentClientConfig->bIdentifyNumberLogin = true;
  1154. }
  1155. }
  1156. pStudentClientConfig->sLogoFileUrl = jsonRoot["LOGO_FILE_URL"].asString().c_str();
  1157. pStudentClientConfig->sStudentClientBgPictureUrl = jsonRoot["STUDENT_CLIENT_BG_PICTURE_URL"].asString().c_str();
  1158. pStudentClientConfig->sOeStudentSysName = jsonRoot["OE_STUDENT_SYS_NAME"].asString().c_str();
  1159. QString preventCheating = jsonRoot["PREVENT_CHEATING_CONFIG"].asString().c_str();
  1160. QStringList pcList = preventCheating.split(",");
  1161. for (QString sType : pcList)
  1162. {
  1163. if (sType == "DISABLE_REMOTE_ASSISTANCE")
  1164. {
  1165. pStudentClientConfig->bDisableRemoteAssistance = true;
  1166. }
  1167. else if (sType == "FULL_SCREEN_TOP")
  1168. {
  1169. pStudentClientConfig->bFullScreenTop = true;
  1170. }
  1171. else if (sType == "DISABLE_MULTISCREEN")
  1172. {
  1173. pStudentClientConfig->bDisableMutiScreen = true;
  1174. }
  1175. else if (sType == "DISABLE_VIRTUAL_CAMERA")
  1176. {
  1177. pStudentClientConfig->bDisableVirtualCamera = true;
  1178. }
  1179. else if (sType == "DISABLE_VIRTUAL_MACHINE")
  1180. {
  1181. pStudentClientConfig->bDisableVirtualMachine = true;
  1182. }
  1183. else if(sType == "EXAMING_BLACK_LIST_CHECK")
  1184. {
  1185. pStudentClientConfig->bExamingBlackListCheck = true;
  1186. }
  1187. }
  1188. pStudentClientConfig->sRootOrgId = jsonRoot["ROOT_ORG_ID"].asString().c_str();// " : "0",
  1189. pStudentClientConfig->bShowQmthLogo = QVariant(jsonRoot["SHOW_QMTH_LOGO"].asString().c_str()).toBool();// " : "false",
  1190. pStudentClientConfig->bShowStudentClientAppQrcode = QVariant(jsonRoot["SHOW_STUDENT_CLIENT_APP_QRCODE"].asString().c_str()).toBool();// " : "true",
  1191. pStudentClientConfig->sStudentCodeLoginAlias = jsonRoot["STUDENT_CODE_LOGIN_ALIAS"].asString().c_str(); // " : "学号登录34s"
  1192. if (jsonRoot.isMember("SHOW_INFO"))
  1193. {
  1194. QString sShowInfo = jsonRoot["SHOW_INFO"].asString().c_str();
  1195. pStudentClientConfig->bShowStudentName = sShowInfo.indexOf("STU_NAME") >= 0;
  1196. pStudentClientConfig->bShowStudentCode = sShowInfo.indexOf("STU_CODE") >= 0;
  1197. pStudentClientConfig->bShowStudentIdentity = sShowInfo.indexOf("IDENTITY_NUMBER") >= 0;
  1198. }
  1199. }
  1200. catch (const std::exception &e)
  1201. {
  1202. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1203. }
  1204. }
  1205. void CHttpBll::genSysNotice(CSysNotice *pSysNotice, const std::string &sResponse)
  1206. {
  1207. try
  1208. {
  1209. Json::Reader reader;
  1210. Json::Value jsonRoot = Json::Value::null;
  1211. if (!reader.parse(sResponse, jsonRoot))
  1212. {
  1213. pSysNotice->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1214. myDebug() << pSysNotice->sMessage << sResponse.c_str();
  1215. }
  1216. pSysNotice->nId = jsonRoot["id"].asInt64();
  1217. pSysNotice->nRootOrgId = jsonRoot["rootOrgId"].asInt64();
  1218. pSysNotice->sContent = jsonRoot["content"].asString().c_str();
  1219. pSysNotice->sStartTime = jsonRoot["startTime"].asString().c_str();
  1220. pSysNotice->sEndTime = jsonRoot["endTime"].asString().c_str();
  1221. pSysNotice->sTitle = jsonRoot["title"].asString().c_str();
  1222. pSysNotice->bEnable = jsonRoot["enable"].asBool();
  1223. }
  1224. catch (const std::exception &e)
  1225. {
  1226. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1227. }
  1228. }
  1229. void CHttpBll::genSoftwareConfig(CGetSoftwareConfig *pSoftwareConfig, const std::string &sResponse)
  1230. {
  1231. if(!sResponse.empty())
  1232. {
  1233. pSoftwareConfig->sSoftwareConfig = std::string(sResponse.rbegin()+32, sResponse.rend()).c_str();
  1234. }
  1235. }
  1236. void CHttpBll::genLoginLimit(CLoginLimit *pLoginLimit, const std::string &sResponse)
  1237. {
  1238. try
  1239. {
  1240. Json::Reader reader;
  1241. Json::Value jsonRoot = Json::Value::null;
  1242. if (!reader.parse(sResponse, jsonRoot))
  1243. {
  1244. pLoginLimit->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1245. myDebug() << pLoginLimit->sMessage << sResponse.c_str();
  1246. }
  1247. pLoginLimit->nCount = jsonRoot["count"].asInt64();
  1248. pLoginLimit->bPass = jsonRoot["pass"].asBool();
  1249. }
  1250. catch (const std::exception &e)
  1251. {
  1252. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1253. }
  1254. }
  1255. void CHttpBll::genLoginInfo(CLoginInfo *pLoginInfo, const std::string &sResponse)
  1256. {
  1257. try
  1258. {
  1259. Json::Reader reader;
  1260. Json::Value jsonRoot = Json::Value::null;
  1261. if (!reader.parse(sResponse, jsonRoot))
  1262. {
  1263. pLoginInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1264. myDebug() << pLoginInfo->sMessage << sResponse.c_str();
  1265. }
  1266. // pLoginInfo->nCode = jsonRoot["code"].asInt();
  1267. if (jsonRoot["code"].asString() != "200")
  1268. {
  1269. pLoginInfo->nCode = 0;
  1270. }
  1271. pLoginInfo->sMessage = jsonRoot["desc"].asString().c_str();
  1272. sKey = jsonRoot["content"]["key"].asString().c_str();
  1273. sToken = jsonRoot["content"]["token"].asString().c_str();
  1274. pLoginInfo->sUserType = jsonRoot["content"]["userType"].asString().c_str();
  1275. pLoginInfo->nUserId = jsonRoot["content"]["userId"].asInt64();
  1276. pLoginInfo->sDisplayName = jsonRoot["content"]["displayName"].asString().c_str();
  1277. pLoginInfo->nRootOrgId = jsonRoot["content"]["rootOrgId"].asInt64();
  1278. pLoginInfo->sRootOrgName = jsonRoot["content"]["rootOrgName"].asString().c_str();
  1279. pLoginInfo->sCreationTime = jsonRoot["content"]["creationTime"].asString().c_str();
  1280. pLoginInfo->sClientIp = jsonRoot["content"]["clientIp"].asString().c_str();
  1281. pLoginInfo->nSessionTimeout = jsonRoot["content"]["sessionTimeout"].asInt64();
  1282. pLoginInfo->bPasswordWeak = jsonRoot["content"]["passwordWeak"].asBool();
  1283. }
  1284. catch (const std::exception &e)
  1285. {
  1286. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1287. }
  1288. }
  1289. void CHttpBll::genLogout(CLogout *pLogout, const std::string &sResponse)
  1290. {
  1291. }
  1292. void CHttpBll::genEditPassword(CEditPassword *pEditPassword, const std::string &sResponse)
  1293. {
  1294. }
  1295. void CHttpBll::genGetStudentClientMenu(CGetStudentClientMenu *pGetStudentClientMenu, const std::string &sResponse)
  1296. {
  1297. try
  1298. {
  1299. Json::Reader reader;
  1300. Json::Value jsonRoot = Json::Value::null;
  1301. if (!reader.parse(sResponse, jsonRoot))
  1302. {
  1303. pGetStudentClientMenu->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1304. myDebug() << pGetStudentClientMenu->sMessage << sResponse.c_str();
  1305. }
  1306. int nSize = jsonRoot.size();
  1307. for (int i = 0; i < nSize; ++i)
  1308. {
  1309. Json::Value jMenuItem = jsonRoot[i];
  1310. CStudentClientMenu scm;
  1311. scm.nId = jMenuItem["id"].asInt64();
  1312. scm.sCode = jMenuItem["code"].asString().c_str();
  1313. scm.sName = jMenuItem["name"].asString().c_str();
  1314. pGetStudentClientMenu->vMenus.push_back(scm);
  1315. }
  1316. }
  1317. catch (const std::exception &e)
  1318. {
  1319. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1320. }
  1321. }
  1322. void CHttpBll::genGetStudentInfoBySession(CGetStudentInfoBySession *pGetStudentInfoBySession, const std::string &sResponse)
  1323. {
  1324. try
  1325. {
  1326. Json::Reader reader;
  1327. Json::Value jsonRoot = Json::Value::null;
  1328. if (!reader.parse(sResponse, jsonRoot))
  1329. {
  1330. pGetStudentInfoBySession->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1331. myDebug() << pGetStudentInfoBySession->sMessage << sResponse.c_str();
  1332. }
  1333. pGetStudentInfoBySession->nId = jsonRoot["id"].asInt64();
  1334. pGetStudentInfoBySession->sName = jsonRoot["name"].asString().c_str();
  1335. pGetStudentInfoBySession->nOrgId = jsonRoot["orgId"].asInt64();
  1336. pGetStudentInfoBySession->sOrgCode = jsonRoot["orgCode"].asString().c_str();
  1337. pGetStudentInfoBySession->sOrgName = jsonRoot["orgName"].asString().c_str();
  1338. QString sStudentCode = "";
  1339. int nSize = jsonRoot["studentCodeList"].size();
  1340. for (int i = 0; i < nSize; ++i)
  1341. {
  1342. if (sStudentCode.isEmpty())
  1343. {
  1344. sStudentCode = jsonRoot["studentCodeList"][i].asString().c_str();
  1345. }
  1346. else
  1347. {
  1348. sStudentCode = sStudentCode + "," + jsonRoot["studentCodeList"][i].asString().c_str();
  1349. }
  1350. }
  1351. pGetStudentInfoBySession->sStudentCode = sStudentCode;
  1352. pGetStudentInfoBySession->sIdentityNumber = jsonRoot["identityNumber"].asString().c_str();
  1353. pGetStudentInfoBySession->sPhotoPath = jsonRoot["photoPath"].asString().c_str();
  1354. pGetStudentInfoBySession->bEnable = jsonRoot["enable"].asBool();
  1355. }
  1356. catch (const std::exception &e)
  1357. {
  1358. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1359. }
  1360. }
  1361. void CHttpBll::genSpecialtyNameList(CSpecialtyNameList *pSpecialtyNameList, const std::string &sResponse)
  1362. {
  1363. try
  1364. {
  1365. Json::Reader reader;
  1366. Json::Value jsonRoot = Json::Value::null;
  1367. if (!reader.parse(sResponse, jsonRoot))
  1368. {
  1369. pSpecialtyNameList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1370. myDebug() << pSpecialtyNameList->sMessage << sResponse.c_str();
  1371. }
  1372. QString sSpecialtyName = "";
  1373. int nSize = jsonRoot.size();
  1374. for (int i = 0; i < nSize; ++i)
  1375. {
  1376. if (sSpecialtyName.isEmpty())
  1377. {
  1378. sSpecialtyName = jsonRoot[i].asString().c_str();
  1379. }
  1380. else
  1381. {
  1382. sSpecialtyName = sSpecialtyName + "," + jsonRoot[i].asString().c_str();
  1383. }
  1384. }
  1385. pSpecialtyNameList->sSpecialtyName = sSpecialtyName;
  1386. }
  1387. catch (const std::exception &e)
  1388. {
  1389. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1390. }
  1391. }
  1392. void CHttpBll::genGetUserNoticeList(CGetUserNoticeList *pGetUserNoticeList, const std::string &sResponse)
  1393. {
  1394. try
  1395. {
  1396. Json::Reader reader;
  1397. Json::Value jsonRoot = Json::Value::null;
  1398. if (!reader.parse(sResponse, jsonRoot))
  1399. {
  1400. pGetUserNoticeList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1401. myDebug() << pGetUserNoticeList->sMessage << sResponse.c_str();
  1402. }
  1403. int nSize = jsonRoot.size();
  1404. for (int i = 0; i < nSize; ++i)
  1405. {
  1406. Json::Value jNoticeItem = jsonRoot[i];
  1407. CNoticeInfo ni;
  1408. ni.nId = jNoticeItem["id"].asInt64();
  1409. ni.sTitle = jNoticeItem["title"].asString().c_str();
  1410. ni.sContent = jNoticeItem["content"].asString().c_str();
  1411. ni.sPublisher = jNoticeItem["publisher"].asString().c_str();
  1412. ni.sPublishTime = jNoticeItem["publishTime"].asString().c_str();
  1413. ni.bHasRead = jNoticeItem["hasRead"].asBool();
  1414. ni.bHasRecalled = jNoticeItem["hasRecalled"].isNull() ? false : jNoticeItem["hasRecalled"].asBool();
  1415. pGetUserNoticeList->vNoticeList.push_back(ni);
  1416. }
  1417. }
  1418. catch (const std::exception &e)
  1419. {
  1420. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1421. }
  1422. }
  1423. void CHttpBll::genAppDownLoadUrl(CAppDownLoadUrl *pAppDownLoadUrl, const std::string &sResponse)
  1424. {
  1425. pAppDownLoadUrl->sUrl = sResponse.c_str();
  1426. }
  1427. void CHttpBll::genAppEnabled(CAppEnabled *pAppEnabled, const std::string &sResponse)
  1428. {
  1429. try
  1430. {
  1431. pAppEnabled->bEnable = QVariant(sResponse.c_str()).toBool();
  1432. }
  1433. catch (const std::exception &e)
  1434. {
  1435. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1436. }
  1437. }
  1438. void CHttpBll::genQueryBatchList(CQueryBatchList *pQueryBatchList, const std::string &sResponse)
  1439. {
  1440. try
  1441. {
  1442. Json::Reader reader;
  1443. Json::Value jsonRoot = Json::Value::null;
  1444. if (!reader.parse(sResponse, jsonRoot))
  1445. {
  1446. pQueryBatchList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1447. myDebug() << pQueryBatchList->sMessage << sResponse.c_str();
  1448. }
  1449. int nSize = jsonRoot.size();
  1450. for (int i = 0; i < nSize; ++i)
  1451. {
  1452. Json::Value jBatchItem = jsonRoot[i];
  1453. CBatchInfo bi;
  1454. bi.nId = jBatchItem["id"].asInt64();
  1455. bi.sName = jBatchItem["name"].asString().c_str();
  1456. bi.sExamType = jBatchItem["examType"].asString().c_str();
  1457. pQueryBatchList->vBatchList.push_back(bi);
  1458. }
  1459. }
  1460. catch (const std::exception &e)
  1461. {
  1462. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1463. }
  1464. }
  1465. void CHttpBll::genGetExamProperty(CGetExamProperty *pGetExamProperty, const std::string &sResponse)
  1466. {
  1467. try
  1468. {
  1469. Json::Reader reader;
  1470. Json::Value jsonRoot = Json::Value::null;
  1471. if (!reader.parse(sResponse, jsonRoot))
  1472. {
  1473. pGetExamProperty->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1474. myDebug() << pGetExamProperty->sMessage << sResponse.c_str();
  1475. }
  1476. if (jsonRoot.isMember("BEFORE_EXAM_REMARK") && jsonRoot["BEFORE_EXAM_REMARK"] != Json::Value::null)
  1477. {
  1478. pGetExamProperty->sBeforeExamRemark = jsonRoot["BEFORE_EXAM_REMARK"].asString().c_str();
  1479. }
  1480. if (jsonRoot.isMember("CHECK_ENVIRONMENT") && jsonRoot["CHECK_ENVIRONMENT"] != Json::Value::null)
  1481. {
  1482. pGetExamProperty->bCheckEnvironment = QVariant(jsonRoot["CHECK_ENVIRONMENT"].asString().c_str()).toBool();
  1483. }
  1484. // if (jsonRoot.isMember("PC_CLIENT_FACE_THRESHOLD"))
  1485. // {
  1486. // pGetExamProperty->nFaceThreshold = QVariant(jsonRoot["PC_CLIENT_FACE_THRESHOLD"].asString().c_str()).toInt();
  1487. // }
  1488. if (jsonRoot.isMember("IS_FACE_CHECK") && jsonRoot["IS_FACE_CHECK"] != Json::Value::null)
  1489. {
  1490. pGetExamProperty->bIsFaceCheck = QVariant(jsonRoot["IS_FACE_CHECK"].asString().c_str()).toBool();
  1491. }
  1492. if (jsonRoot.isMember("SNAPSHOT_INTERVAL") && jsonRoot["SNAPSHOT_INTERVAL"] != Json::Value::null)
  1493. {
  1494. pGetExamProperty->nSnapshotInterval = QVariant(jsonRoot["SNAPSHOT_INTERVAL"].asString().c_str()).toInt();
  1495. }
  1496. if (jsonRoot.isMember("FACE_VERIFY_START_MINUTE") && jsonRoot["FACE_VERIFY_START_MINUTE"] != Json::Value::null)
  1497. {
  1498. pGetExamProperty->nFaceVerifyStartMinute = QVariant(jsonRoot["FACE_VERIFY_START_MINUTE"].asString().c_str()).toInt();
  1499. }
  1500. if (jsonRoot.isMember("FACE_VERIFY_END_MINUTE") && jsonRoot["FACE_VERIFY_END_MINUTE"] != Json::Value::null)
  1501. {
  1502. pGetExamProperty->nFaceVerifyEndMinute = QVariant(jsonRoot["FACE_VERIFY_END_MINUTE"].asString().c_str()).toInt();
  1503. }
  1504. if (jsonRoot.isMember("IS_STRANGER_ENABLE") && jsonRoot["IS_STRANGER_ENABLE"] != Json::Value::null)
  1505. {
  1506. pGetExamProperty->bIsStrangerEnable = QVariant(jsonRoot["IS_STRANGER_ENABLE"].asString().c_str()).toBool();
  1507. }
  1508. if (jsonRoot.isMember("PRACTICE_TYPE") && jsonRoot["PRACTICE_TYPE"] != Json::Value::null)
  1509. {
  1510. pGetExamProperty->sPracticeType = jsonRoot["PRACTICE_TYPE"].asString().c_str();
  1511. }
  1512. if (jsonRoot.isMember("FREEZE_TIME") && jsonRoot["FREEZE_TIME"] != Json::Value::null)
  1513. {
  1514. pGetExamProperty->nFreezeTime = QVariant(jsonRoot["FREEZE_TIME"].asString().c_str()).toInt();
  1515. }
  1516. if (jsonRoot.isMember("AFTER_EXAM_REMARK") && jsonRoot["AFTER_EXAM_REMARK"] != Json::Value::null)
  1517. {
  1518. pGetExamProperty->sAfterExamRemark = jsonRoot["AFTER_EXAM_REMARK"].asString().c_str();
  1519. }
  1520. if (jsonRoot.isMember("IS_OBJ_SCORE_VIEW") && jsonRoot["IS_OBJ_SCORE_VIEW"] != Json::Value::null)
  1521. {
  1522. pGetExamProperty->bIsObjScoreView = QVariant(jsonRoot["IS_OBJ_SCORE_VIEW"].asString().c_str()).toBool();
  1523. }
  1524. if (jsonRoot.isMember("SHOW_CHEATING_REMARK") && jsonRoot["SHOW_CHEATING_REMARK"] != Json::Value::null)
  1525. {
  1526. pGetExamProperty->bShowCheatingRemark = QVariant(jsonRoot["SHOW_CHEATING_REMARK"].asString().c_str()).toBool();
  1527. }
  1528. if (jsonRoot.isMember("CHEATING_REMARK") && jsonRoot["CHEATING_REMARK"] != Json::Value::null)
  1529. {
  1530. pGetExamProperty->sCheatingRemark = jsonRoot["CHEATING_REMARK"].asString().c_str();
  1531. }
  1532. if (jsonRoot.isMember("IS_FACE_VERIFY_BEFORE") && jsonRoot["IS_FACE_VERIFY_BEFORE"] != Json::Value::null)
  1533. {
  1534. pGetExamProperty->bIsLivenessBefore = QVariant(jsonRoot["IS_FACE_VERIFY_BEFORE"].asString().c_str()).toBool();
  1535. }
  1536. if (jsonRoot.isMember("OFFLINE_UPLOAD_FILE_TYPE"))
  1537. {
  1538. QString sFileType = jsonRoot["OFFLINE_UPLOAD_FILE_TYPE"].asString().c_str();
  1539. Json::Reader reader;
  1540. Json::Value jFileType = Json::Value::null;
  1541. if (!reader.parse(sFileType.toStdString(), jFileType))
  1542. {
  1543. pGetExamProperty->sMessage = QString::fromLocal8Bit("解析文件类型异常!");
  1544. pGetExamProperty->nCode = 0;
  1545. }
  1546. int nSize = jFileType.size();
  1547. for (int i = 0; i < nSize; ++i)
  1548. {
  1549. pGetExamProperty->vOfflineUploadFileType.push_back(jFileType[i].asString().c_str());
  1550. }
  1551. }
  1552. if(jsonRoot.isMember("FACE_VERIFY_FORCE_EXIT") && jsonRoot["FACE_VERIFY_FORCE_EXIT"] != Json::Value::null)
  1553. {
  1554. pGetExamProperty->bFaceVerifyForceExit = QVariant(jsonRoot["FACE_VERIFY_FORCE_EXIT"].asString().c_str()).toBool();
  1555. }
  1556. if(jsonRoot.isMember("SHOW_MULTIPLE_CHOICE_WARNING") && jsonRoot["SHOW_MULTIPLE_CHOICE_WARNING"] != Json::Value::null)
  1557. {
  1558. pGetExamProperty->bMutipleAnserCountTips = QVariant(jsonRoot["SHOW_MULTIPLE_CHOICE_WARNING"].asString().c_str()).toBool();
  1559. }
  1560. }
  1561. catch (const std::exception &e)
  1562. {
  1563. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1564. }
  1565. }
  1566. void CHttpBll::genStartExamLimit(CStartExamLimit *pStartExamLimit, const std::string &sResponse)
  1567. {
  1568. try
  1569. {
  1570. Json::Reader reader;
  1571. Json::Value jsonRoot = Json::Value::null;
  1572. if (!reader.parse(sResponse, jsonRoot))
  1573. {
  1574. pStartExamLimit->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1575. myDebug() << pStartExamLimit->sMessage << sResponse.c_str();
  1576. }
  1577. pStartExamLimit->nCount = jsonRoot["count"].asInt();
  1578. pStartExamLimit->bPass = jsonRoot["pass"].asBool();
  1579. }
  1580. catch (const std::exception &e)
  1581. {
  1582. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1583. }
  1584. }
  1585. void CHttpBll::genIpLimit(CIpLimit *pIpLimit, const std::string &sResponse)
  1586. {
  1587. try
  1588. {
  1589. Json::Reader reader;
  1590. Json::Value jsonRoot = Json::Value::null;
  1591. if (!reader.parse(sResponse, jsonRoot))
  1592. {
  1593. pIpLimit->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1594. myDebug() << pIpLimit->sMessage << sResponse.c_str();
  1595. }
  1596. pIpLimit->bLimited = jsonRoot["limited"].asBool();
  1597. }
  1598. catch (const std::exception &e)
  1599. {
  1600. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1601. }
  1602. }
  1603. void CHttpBll::genStartExam(CStartExam *pStartExam, const std::string &sResponse)
  1604. {
  1605. try
  1606. {
  1607. Json::Reader reader;
  1608. Json::Value jsonRoot = Json::Value::null;
  1609. if (!reader.parse(sResponse, jsonRoot))
  1610. {
  1611. pStartExam->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1612. myDebug() << pStartExam->sMessage << sResponse.c_str();
  1613. }
  1614. pStartExam->sCourseCode = jsonRoot["courseCode"].asString().c_str();
  1615. pStartExam->sCourseName = jsonRoot["courseName"].asString().c_str();
  1616. pStartExam->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64();
  1617. pStartExam->nFaceVerifyMinute = jsonRoot["faceVerifyMinute"].asInt();
  1618. pStartExam->sStudentCode = jsonRoot["studentCode"].asString().c_str();
  1619. pStartExam->sStudentName = jsonRoot["studentName"].asString().c_str();
  1620. }
  1621. catch (const std::exception &e)
  1622. {
  1623. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1624. }
  1625. }
  1626. void CHttpBll::genFaceCheckEnabled(CFaceCheckEnabled *pFaceCheckEnabled, const std::string &sResponse)
  1627. {
  1628. try
  1629. {
  1630. pFaceCheckEnabled->bEnabled = QVariant(sResponse.c_str()).toBool();
  1631. }
  1632. catch (const std::exception &e)
  1633. {
  1634. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1635. }
  1636. }
  1637. void CHttpBll::genLivenessEnabled(CLivenessEnabled *pLivenessEnabled, const std::string &sResponse)
  1638. {
  1639. try
  1640. {
  1641. pLivenessEnabled->bEnabled = QVariant(sResponse.c_str()).toBool();
  1642. }
  1643. catch (const std::exception &e)
  1644. {
  1645. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1646. }
  1647. }
  1648. void CHttpBll::genWeiXinAnswerEnabled(CWeiXinAnswerEnabled *pWeiXinAnswerEnabled, const std::string &sResponse)
  1649. {
  1650. try
  1651. {
  1652. pWeiXinAnswerEnabled->bEnabled = QVariant(sResponse.c_str()).toBool();
  1653. }
  1654. catch (const std::exception &e)
  1655. {
  1656. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1657. }
  1658. }
  1659. void CHttpBll::genGetExamById(CGetExamById *pGetExamById, const std::string &sResponse)
  1660. {
  1661. try
  1662. {
  1663. Json::Reader reader;
  1664. Json::Value jsonRoot = Json::Value::null;
  1665. if (!reader.parse(sResponse, jsonRoot))
  1666. {
  1667. pGetExamById->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1668. myDebug() << pGetExamById->sMessage << sResponse.c_str();
  1669. }
  1670. pGetExamById->nId = jsonRoot["id"].asInt64();
  1671. pGetExamById->sCode = jsonRoot["code"].asString().c_str();
  1672. pGetExamById->nRootOrgId = jsonRoot["rootOrgId"].asInt64();
  1673. pGetExamById->sBeginTime = jsonRoot["beginTime"].asString().c_str();
  1674. pGetExamById->sEndTime = jsonRoot["endTime"].asString().c_str();
  1675. pGetExamById->sName = jsonRoot["name"].asString().c_str();
  1676. pGetExamById->sExamType = jsonRoot["examType"].asString().c_str();
  1677. pGetExamById->nDuration = jsonRoot["duration"].asInt64();
  1678. pGetExamById->bEnable = jsonRoot["enable"].asBool();
  1679. pGetExamById->bStarted = jsonRoot["started"].asBool();
  1680. pGetExamById->bIpLimitSettingsEnabled = jsonRoot["ipLimitSettingsEnabled"].asBool();
  1681. }
  1682. catch (const std::exception &e)
  1683. {
  1684. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1685. }
  1686. }
  1687. void CHttpBll::genStartAnswer(CStartAnswer *pStartAnswer, const std::string &sResponse)
  1688. {
  1689. try
  1690. {
  1691. Json::Reader reader;
  1692. Json::Value jsonRoot = Json::Value::null;
  1693. if (!reader.parse(sResponse, jsonRoot))
  1694. {
  1695. pStartAnswer->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1696. myDebug() << pStartAnswer->sMessage << sResponse.c_str();
  1697. }
  1698. pStartAnswer->nDuration = jsonRoot["duration"].asInt64();
  1699. pStartAnswer->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64();
  1700. pStartAnswer->nUsedExamSeconds = jsonRoot["usedExamSeconds"].asInt64();
  1701. }
  1702. catch (const std::exception &e)
  1703. {
  1704. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1705. }
  1706. }
  1707. void CHttpBll::genGetQuestion(CGetQuestion *pGetQuestion, const std::string &sResponse)
  1708. {
  1709. try
  1710. {
  1711. Json::Reader reader;
  1712. Json::Value jsonRoot = Json::Value::null;
  1713. if (!reader.parse(sResponse, jsonRoot))
  1714. {
  1715. pGetQuestion->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1716. myDebug() << pGetQuestion->sMessage << sResponse.c_str();
  1717. }
  1718. pGetQuestion->sId = jsonRoot["id"].asString().c_str();
  1719. pGetQuestion->sBody = jsonRoot["masterVersion"]["body"].isNull() ? "" : jsonRoot["masterVersion"]["body"].asString().c_str();
  1720. pGetQuestion->sVersion = jsonRoot["masterVersion"]["version"].asString().c_str();
  1721. pGetQuestion->bhasAudios = jsonRoot["masterVersion"]["hasAudios"].asBool();
  1722. int nSize = jsonRoot["masterVersion"]["questionUnitList"].size();
  1723. for (int i = 0; i < nSize; ++i)
  1724. {
  1725. Json::Value jQuestionItem = jsonRoot["masterVersion"]["questionUnitList"][i];
  1726. CSubQuestion sq;
  1727. sq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  1728. sq.sBody = jQuestionItem["body"].asString().c_str();
  1729. //sq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  1730. int nOptionSize = jQuestionItem["questionOptionList"].size();
  1731. for (int j = 0; j < nOptionSize; ++j)
  1732. {
  1733. Json::Value jOption = jQuestionItem["questionOptionList"][j];
  1734. COption o;
  1735. o.sBody = jOption["body"].asString().c_str();
  1736. sq.vOptions.push_back(o);
  1737. }
  1738. int nAnswerSize = jQuestionItem["rightAnswer"].size();
  1739. for (int k = 0; k < nAnswerSize; ++k)
  1740. {
  1741. Json::Value jAnswer = jQuestionItem["rightAnswer"][k];
  1742. sq.vRightAnswer.push_back(jAnswer.asString().c_str());
  1743. }
  1744. pGetQuestion->vSubQuestion.push_back(sq);
  1745. }
  1746. }
  1747. catch (const std::exception &e)
  1748. {
  1749. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1750. }
  1751. }
  1752. void CHttpBll::genGetQuestionContent(CGetQuestionContent *pGetQuestionContent, const std::string &sResponse)
  1753. {
  1754. try
  1755. {
  1756. Json::Reader reader;
  1757. Json::Value jsonRoot = Json::Value::null;
  1758. if (!reader.parse(sResponse, jsonRoot))
  1759. {
  1760. pGetQuestionContent->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1761. myDebug() << pGetQuestionContent->sMessage << sResponse.c_str();
  1762. }
  1763. pGetQuestionContent->sBody = jsonRoot["body"].isNull() ? "" : jsonRoot["body"].asString().c_str();
  1764. pGetQuestionContent->sVersion = jsonRoot["version"].asString().c_str();
  1765. pGetQuestionContent->bhasAudios = jsonRoot["hasAudios"].asBool();
  1766. int nSize = jsonRoot["questionUnitList"].size();
  1767. for (int i = 0; i < nSize; ++i)
  1768. {
  1769. Json::Value jQuestionItem = jsonRoot["questionUnitList"][i];
  1770. CSubQuestion sq;
  1771. sq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  1772. sq.sBody = jQuestionItem["body"].asString().c_str();
  1773. sq.sAnswerType = jQuestionItem["answerType"].asString().c_str();
  1774. int nOptionSize = jQuestionItem["questionOptionList"].size();
  1775. for (int j = 0; j < nOptionSize; ++j)
  1776. {
  1777. Json::Value jOption = jQuestionItem["questionOptionList"][j];
  1778. COption o;
  1779. o.sBody = jOption["body"].asString().c_str();
  1780. sq.vOptions.push_back(o);
  1781. }
  1782. for (int jq = 0; jq < jQuestionItem["optionPermutation"].size(); ++jq)
  1783. {
  1784. Json::Value Item = jQuestionItem["optionPermutation"][jq];
  1785. sq.voptionPermutation.push_back(Item.asInt());
  1786. }
  1787. int nAnswerSize = jQuestionItem["rightAnswer"].size();
  1788. for (int k = 0; k < nAnswerSize; ++k)
  1789. {
  1790. Json::Value jAnswer = jQuestionItem["rightAnswer"][k];
  1791. sq.vRightAnswer.push_back(jAnswer.asString().c_str());
  1792. }
  1793. pGetQuestionContent->vSubQuestion.push_back(sq);
  1794. }
  1795. }
  1796. catch (const std::exception &e)
  1797. {
  1798. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1799. }
  1800. }
  1801. void CHttpBll::genExamCourseInfo(const Json::Value &jExamItem, CExamCourseInfo &eci)
  1802. {
  1803. try
  1804. {
  1805. eci.nAllowExamCount = jExamItem["allowExamCount"].asInt();
  1806. eci.bAppExamEnabled = jExamItem["appExamEnabled"].asBool();
  1807. eci.sCourseCode = jExamItem["courseCode"].asString().c_str();
  1808. eci.nCourseId = jExamItem["courseId"].asInt64();
  1809. eci.sCourseLevel = jExamItem["courseLevel"].asString().c_str();
  1810. eci.sCourseName = jExamItem["courseName"].asString().c_str();
  1811. eci.sEndTime = jExamItem["endTime"].asString().c_str();
  1812. eci.bExamCycleEnabled = jExamItem["examCycleEnabled"].asBool();
  1813. int nWeekSize = jExamItem["examCycleWeek"].size();
  1814. for(int i =0; i < nWeekSize; ++i)
  1815. {
  1816. eci.vExamCycleWeek.push_back(jExamItem["examCycleWeek"][i].asInt());
  1817. }
  1818. int nCycleTimeRangeSize = jExamItem["examCycleTimeRange"].size();
  1819. for(int i = 0; i < nCycleTimeRangeSize; ++i)
  1820. {
  1821. Json::Value jTimeRange = jExamItem["examCycleTimeRange"][i]["timeRange"];
  1822. int nTimeRangeSize = jTimeRange.size();
  1823. QStringList sTimeRangeList;
  1824. for(int j = 0; j < nTimeRangeSize; ++j)
  1825. {
  1826. sTimeRangeList<<jTimeRange[j].asString().c_str();
  1827. }
  1828. eci.sExamCycleTimeRange<<sTimeRangeList.join("~");
  1829. }
  1830. //eci.sCourseCode = jExamItem["examCycleTimeRange"].asString().c_str();
  1831. //eci.sCourseCode = jExamItem["examCycleWeek"].asString().c_str();
  1832. eci.nExamId = jExamItem["examId"].asInt64();
  1833. eci.sExamName = jExamItem["examName"].asString().c_str();
  1834. eci.sExamStatus = jExamItem["examStatus"].asString().c_str();
  1835. eci.nExamStudentId = jExamItem["examStudentId"].asInt64();
  1836. eci.bFaceCheck = jExamItem["faceCheck"].asBool();
  1837. eci.bFaceEnable = jExamItem["faceEnable"].asBool();
  1838. eci.sIdentityNumber = jExamItem["identityNumber"].asString().c_str();
  1839. eci.bIsFinished = jExamItem["isFinished"].asBool();
  1840. eci.bIsObjScoreView = jExamItem["isObjScoreView"].asBool();
  1841. eci.bIsPhotoUpload = jExamItem["isPhotoUpload"].asBool();
  1842. eci.nOrgId = jExamItem["orgId"].asInt64();
  1843. eci.sOrgName = jExamItem["orgName"].asString().c_str();
  1844. eci.nPaperMins = jExamItem["paperMins"].asInt();
  1845. eci.nRootOrgId = jExamItem["rootOrgId"].asInt64();
  1846. eci.sSpecialtyLevel = jExamItem["specialtyLevel"].asString().c_str();
  1847. eci.sSpecialtyName = jExamItem["specialtyName"].asString().c_str();
  1848. eci.sStartTime = jExamItem["startTime"].asString().c_str();
  1849. eci.sStudentCode = jExamItem["studentCode"].asString().c_str();
  1850. eci.sStudentName = jExamItem["studentName"].asString().c_str();
  1851. }
  1852. catch (const std::exception &e)
  1853. {
  1854. myServerLog()<<",exception error"<<e.what();
  1855. }
  1856. }
  1857. void CHttpBll::genQueryExamList(CQueryExamList *pQueryExamList, const std::string &sResponse)
  1858. {
  1859. try
  1860. {
  1861. Json::Reader reader;
  1862. Json::Value jsonRoot = Json::Value::null;
  1863. if (!reader.parse(sResponse, jsonRoot))
  1864. {
  1865. pQueryExamList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1866. myDebug() << pQueryExamList->sMessage << sResponse.c_str();
  1867. }
  1868. int nExamSize = jsonRoot.size();
  1869. for (int i = 0; i < nExamSize; ++i)
  1870. {
  1871. Json::Value jExamItem = jsonRoot[i];
  1872. CExamCourseInfo eci;
  1873. genExamCourseInfo(jExamItem, eci);
  1874. pQueryExamList->vOnlieExamList.push_back(eci);
  1875. }
  1876. }
  1877. catch (const std::exception &e)
  1878. {
  1879. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1880. }
  1881. }
  1882. void CHttpBll::genQueryExamEndList(CQueryExamEndList *pQueryExamEndList, const std::string &sResponse)
  1883. {
  1884. try
  1885. {
  1886. Json::Reader reader;
  1887. Json::Value jsonRoot = Json::Value::null;
  1888. if (!reader.parse(sResponse, jsonRoot))
  1889. {
  1890. pQueryExamEndList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1891. myDebug() << pQueryExamEndList->sMessage << sResponse.c_str();
  1892. }
  1893. int nExamSize = jsonRoot.size();
  1894. for (int i = 0; i < nExamSize; ++i)
  1895. {
  1896. Json::Value jExamItem = jsonRoot[i];
  1897. CExamCourseInfo eci;
  1898. genExamCourseInfo(jExamItem, eci);
  1899. pQueryExamEndList->vOnlieEndExamList.push_back(eci);
  1900. }
  1901. }
  1902. catch (const std::exception &e)
  1903. {
  1904. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1905. }
  1906. }
  1907. void CHttpBll::genQueryObjectiveScoreList(CQueryObjectiveScoreList *pQueryObjectiveScoreList, const std::string &sResponse)
  1908. {
  1909. try
  1910. {
  1911. Json::Reader reader;
  1912. Json::Value jsonRoot = Json::Value::null;
  1913. if (!reader.parse(sResponse, jsonRoot))
  1914. {
  1915. pQueryObjectiveScoreList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1916. myDebug() << pQueryObjectiveScoreList->sMessage << sResponse.c_str();
  1917. }
  1918. int nScoreSize = jsonRoot.size();
  1919. for (int i = 0; i < nScoreSize; ++i)
  1920. {
  1921. Json::Value jScore = jsonRoot[i];
  1922. CObjectiveScore os;
  1923. os.sEndTime = jScore["endTime"].asString().c_str();
  1924. os.nExamOrder = jScore["examOrder"].asInt();
  1925. os.nExamRecordDataId = jScore["examRecordDataId"].asInt64();
  1926. os.bIsAuditing = jScore["isAuditing"].asBool();
  1927. os.bIsExamEnded = jScore["isExamEnded"].asBool();
  1928. os.bIsIllegality = jScore["isIllegality"].asBool();
  1929. os.fObjectiveScore = jScore["objectiveScore"].asDouble();
  1930. os.sStartTime = jScore["startTime"].asString().c_str();
  1931. pQueryObjectiveScoreList->vObjectiveScore.push_back(os);
  1932. }
  1933. }
  1934. catch (const std::exception &e)
  1935. {
  1936. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1937. }
  1938. }
  1939. void CHttpBll::genQueryHomeworkList(CQueryHomeworkList *pQueryHomeworkList, const std::string &sResponse)
  1940. {
  1941. try
  1942. {
  1943. Json::Reader reader;
  1944. Json::Value jsonRoot = Json::Value::null;
  1945. if (!reader.parse(sResponse, jsonRoot))
  1946. {
  1947. pQueryHomeworkList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1948. myDebug() << pQueryHomeworkList->sMessage << sResponse.c_str();
  1949. }
  1950. int nExamSize = jsonRoot.size();
  1951. for (int i = 0; i < nExamSize; ++i)
  1952. {
  1953. Json::Value jExamItem = jsonRoot[i];
  1954. CExamCourseInfo eci;
  1955. genExamCourseInfo(jExamItem, eci);
  1956. pQueryHomeworkList->vHomeworkExamList.push_back(eci);
  1957. }
  1958. }
  1959. catch (const std::exception &e)
  1960. {
  1961. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1962. }
  1963. }
  1964. void CHttpBll::genQueryPracticeCourseList(CQueryPracticeCourseList *pQueryPracticeCourseList, const std::string &sResponse)
  1965. {
  1966. try
  1967. {
  1968. Json::Reader reader;
  1969. Json::Value jsonRoot = Json::Value::null;
  1970. if (!reader.parse(sResponse, jsonRoot))
  1971. {
  1972. pQueryPracticeCourseList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1973. myDebug() << pQueryPracticeCourseList->sMessage << sResponse.c_str();
  1974. }
  1975. int nExamSize = jsonRoot.size();
  1976. for (int i = 0; i < nExamSize; ++i)
  1977. {
  1978. Json::Value jExamItem = jsonRoot[i];
  1979. CPracticeCourseInfo pci;
  1980. pci.fAveObjectiveAccuracy = jExamItem["aveObjectiveAccuracy"].asDouble();
  1981. pci.sCourseCode = jExamItem["courseCode"].asString().c_str();
  1982. pci.sCourseName = jExamItem["courseName"].asString().c_str();
  1983. pci.sEndTime = jExamItem["endTime"].asString().c_str();
  1984. pci.bExamCycleEnabled = jExamItem["examCycleEnabled"].asBool();
  1985. //pci.sExamCycleTimeRange = jExamItem["examCycleTimeRange"].asDouble();
  1986. //pci.sExamCycleWeek = jExamItem["examCycleWeek"].asDouble();
  1987. int nWeekSize = jExamItem["examCycleWeek"].size();
  1988. for(int i = 0; i < nWeekSize; ++i)
  1989. {
  1990. pci.vExamCycleWeek.push_back(jExamItem["examCycleWeek"][i].asInt());
  1991. }
  1992. int nCycleTimeRangeSize = jExamItem["examCycleTimeRange"].size();
  1993. for(int i = 0; i < nCycleTimeRangeSize; ++i)
  1994. {
  1995. Json::Value jTimeRange = jExamItem["examCycleTimeRange"][i]["timeRange"];
  1996. int nTimeRangeSize = jTimeRange.size();
  1997. QStringList sTimeRangeList;
  1998. for(int j = 0; j < nTimeRangeSize; ++j)
  1999. {
  2000. sTimeRangeList<<jTimeRange[j].asString().c_str();
  2001. }
  2002. pci.sExamCycleTimeRange<<sTimeRangeList.join("~");
  2003. }
  2004. pci.nExamId = jExamItem["examId"].asInt64();
  2005. pci.sExamName = jExamItem["examName"].asString().c_str();
  2006. pci.nExamStudentId = jExamItem["examStudentId"].asInt64();
  2007. pci.sExamType = jExamItem["examType"].asString().c_str();
  2008. pci.fMaxObjectiveAccuracy = jExamItem["maxObjectiveAccuracy"].asDouble();
  2009. pci.nPracticeCount = jExamItem["practiceCount"].asInt();
  2010. pci.fRecentObjectiveAccuracy = jExamItem["recentObjectiveAccuracy"].asDouble();
  2011. pci.sStartTime = jExamItem["startTime"].asString().c_str();
  2012. pci.sStudentCode = jExamItem["studentCode"].asString().c_str();
  2013. pci.sStudentName = jExamItem["studentName"].asString().c_str();
  2014. pQueryPracticeCourseList->vPracticeCourseInfo.push_back(pci);
  2015. }
  2016. }
  2017. catch (const std::exception &e)
  2018. {
  2019. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2020. }
  2021. }
  2022. void CHttpBll::genQueryPracticeRecordList(CQueryPracticeRecordList *pQueryPracticeRecordList, const std::string &sResponse)
  2023. {
  2024. try
  2025. {
  2026. Json::Reader reader;
  2027. Json::Value jsonRoot = Json::Value::null;
  2028. if (!reader.parse(sResponse, jsonRoot))
  2029. {
  2030. pQueryPracticeRecordList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2031. myDebug() << pQueryPracticeRecordList->sMessage << sResponse.c_str();
  2032. }
  2033. int nSize = jsonRoot.size();
  2034. for (int i = 0; i < nSize; ++i)
  2035. {
  2036. Json::Value jPracticeItem = jsonRoot[i];
  2037. CPracticeRecord pr;
  2038. pr.sCourseCode = jPracticeItem["courseCode"].asString().c_str();
  2039. pr.sCourseName = jPracticeItem["courseName"].asString().c_str();
  2040. pr.sEndTime = jPracticeItem["endTime"].asString().c_str();
  2041. pr.sExamName = jPracticeItem["examName"].asString().c_str();
  2042. pr.nFailQuestionNum = jPracticeItem["failQuestionNum"].asInt();
  2043. pr.nId = jPracticeItem["id"].asInt64();
  2044. pr.nNotAnsweredCount = jPracticeItem["notAnsweredCount"].asInt();
  2045. pr.fObjectiveAccuracy = jPracticeItem["objectiveAccuracy"].asDouble();
  2046. pr.nObjectiveNum = jPracticeItem["objectiveNum"].asInt();
  2047. pr.sStartTime = jPracticeItem["startTime"].asString().c_str();
  2048. pr.nSuccQuestionNum = jPracticeItem["succQuestionNum"].asInt();
  2049. pr.nTotalQuestionCount = jPracticeItem["totalQuestionCount"].asInt();
  2050. pr.nUsedExamTime = jPracticeItem["usedExamTime"].asInt64();
  2051. pQueryPracticeRecordList->vPracticeRecordList.push_back(pr);
  2052. }
  2053. }
  2054. catch (const std::exception &e)
  2055. {
  2056. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2057. }
  2058. }
  2059. void CHttpBll::genGetPracticeDetailInfo(CGetPracticeDetailInfo *pGetPracticeDetailInfo, const std::string &sResponse)
  2060. {
  2061. try
  2062. {
  2063. Json::Reader reader;
  2064. Json::Value jsonRoot = Json::Value::null;
  2065. if (!reader.parse(sResponse, jsonRoot))
  2066. {
  2067. pGetPracticeDetailInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2068. myDebug() << pGetPracticeDetailInfo->sMessage << sResponse.c_str();
  2069. }
  2070. pGetPracticeDetailInfo->sCourseCode = jsonRoot["courseCode"].asString().c_str();
  2071. pGetPracticeDetailInfo->sCourseName = jsonRoot["courseName"].asString().c_str();
  2072. pGetPracticeDetailInfo->nId = jsonRoot["id"].asInt64();
  2073. pGetPracticeDetailInfo->fObjectiveAccuracy = jsonRoot["objectiveAccuracy"].asDouble();
  2074. int nSize = jsonRoot["paperStructInfos"].size();
  2075. for (int i = 0; i < nSize; ++i)
  2076. {
  2077. Json::Value jPaperStructInfo = jsonRoot["paperStructInfos"][i];
  2078. CPracticePaperStructInfo ppsi;
  2079. ppsi.nCount = jPaperStructInfo["count"].asInt();
  2080. ppsi.nFailQuestionNum = jPaperStructInfo["failQuestionNum"].asInt();
  2081. ppsi.nIndex = jPaperStructInfo["index"].asInt();
  2082. ppsi.nNotAnsweredCount = jPaperStructInfo["notAnsweredCount"].asInt();
  2083. ppsi.nQuestionCount = jPaperStructInfo["questionCount"].asInt();
  2084. ppsi.sQuestionType = jPaperStructInfo["questionType"].asString().c_str();
  2085. ppsi.sScore = jPaperStructInfo["score"].asString().c_str();
  2086. ppsi.nSuccQuestionNum = jPaperStructInfo["succQuestionNum"].asInt();
  2087. ppsi.sTitle = jPaperStructInfo["title"].asString().c_str();
  2088. ppsi.fTotalScore = jPaperStructInfo["totalScore"].asDouble();
  2089. pGetPracticeDetailInfo->vPracticePaperStructList.push_back(ppsi);
  2090. }
  2091. }
  2092. catch (const std::exception &e)
  2093. {
  2094. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2095. }
  2096. }
  2097. void CHttpBll::genFindExamRecordDataEntity(CFindExamRecordDataEntity *pFindExamRecordDataEntity, const std::string &sResponse)
  2098. {
  2099. try
  2100. {
  2101. Json::Reader reader;
  2102. Json::Value jsonRoot = Json::Value::null;
  2103. if (!reader.parse(sResponse, jsonRoot))
  2104. {
  2105. pFindExamRecordDataEntity->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2106. myDebug() << pFindExamRecordDataEntity->sMessage << sResponse.c_str();
  2107. }
  2108. pFindExamRecordDataEntity->nExamId = jsonRoot["examRecord"]["examId"].asInt64();
  2109. pFindExamRecordDataEntity->sPaperType = jsonRoot["examRecord"]["paperType"].asString().c_str();
  2110. }
  2111. catch (const std::exception &e)
  2112. {
  2113. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2114. }
  2115. }
  2116. void CHttpBll::genGetExamRecordQuestions(CGetExamRecordQuestions *pGetExamRecordQuestions, const std::string &sResponse)
  2117. {
  2118. try
  2119. {
  2120. Json::Reader reader;
  2121. Json::Value jsonRoot = Json::Value::null;
  2122. if (!reader.parse(sResponse, jsonRoot))
  2123. {
  2124. pGetExamRecordQuestions->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2125. myDebug() << pGetExamRecordQuestions->sMessage << sResponse.c_str();
  2126. }
  2127. int nSize = jsonRoot["examQuestionEntities"].size();
  2128. for (int i = 0; i < nSize; ++i)
  2129. {
  2130. Json::Value jQuestionItem = jsonRoot["examQuestionEntities"][i];
  2131. CAnsweredQuestion aq;
  2132. aq.sAnswerType = jQuestionItem["answerType"].asString().c_str();
  2133. aq.sAudioPlayTimes = jQuestionItem["audioPlayTimes"].isNull() ? "" : jQuestionItem["audioPlayTimes"].asString().c_str();
  2134. aq.sCorrectAnswer = jQuestionItem["correctAnswer"].isNull() ? "" : jQuestionItem["correctAnswer"].asString().c_str();
  2135. //aq.sExamQuestionTempId = jQuestionItem["examQuestionTempId"].asString().c_str();
  2136. aq.nExamRecordDataId = jQuestionItem["examRecordDataId"].asInt64();
  2137. aq.bIsAnswer = jQuestionItem["isAnswer"].asBool();
  2138. //aq.bIsInMongo = jQuestionItem["isInMongo"].asBool();
  2139. aq.bIsSign = jQuestionItem["isSign"].asBool();
  2140. aq.nMainNumber = jQuestionItem["mainNumber"].asInt();
  2141. int nOptionSize = jQuestionItem["optionPermutation"].size();
  2142. for (int j = 0; j < nOptionSize; ++j)
  2143. {
  2144. aq.vOptionPermutation.push_back(jQuestionItem["optionPermutation"][i].asInt());
  2145. }
  2146. aq.nOrder = jQuestionItem["order"].asInt();
  2147. aq.sQuestionId = jQuestionItem["questionId"].asString().c_str();
  2148. aq.fQuestionScore = jQuestionItem["questionScore"].asDouble();
  2149. aq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  2150. aq.sStudentAnswer = jQuestionItem["studentAnswer"].asString().c_str();
  2151. aq.fStudentScore = jQuestionItem["studentScore"].asDouble();
  2152. pGetExamRecordQuestions->vExamRecordQuestions.push_back(aq);
  2153. }
  2154. }
  2155. catch (const std::exception &e)
  2156. {
  2157. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2158. }
  2159. }
  2160. void CHttpBll::genGetOfflineCourse(CGetOfflineCourse *pGetOfflineCourse, const std::string &sResponse)
  2161. {
  2162. try
  2163. {
  2164. Json::Reader reader;
  2165. Json::Value jsonRoot = Json::Value::null;
  2166. if (!reader.parse(sResponse, jsonRoot))
  2167. {
  2168. pGetOfflineCourse->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2169. myDebug() << pGetOfflineCourse->sMessage << sResponse.c_str();
  2170. }
  2171. int nSize = jsonRoot.size();
  2172. for (int i = 0; i < nSize; ++i)
  2173. {
  2174. Json::Value jCourseInfo = jsonRoot[i];
  2175. COfflineCourseInfo oci;
  2176. oci.sCourseCode = jCourseInfo["courseCode"].asString().c_str();
  2177. oci.sCourseLevel = jCourseInfo["courseLevel"].asString().c_str();
  2178. oci.sCourseName = jCourseInfo["courseName"].asString().c_str();
  2179. oci.sEndTime = jCourseInfo["endTime"].asString().c_str();
  2180. oci.nExamId = jCourseInfo["examId"].asInt64();
  2181. oci.sExamName = jCourseInfo["examName"].asString().c_str();
  2182. oci.nExamRecordDataId = jCourseInfo["examRecordDataId"].asInt64();
  2183. oci.nExamStudentId = jCourseInfo["examStudentId"].asInt64();
  2184. oci.bIsvalid = jCourseInfo["isvalid"].asBool();
  2185. oci.sOrgName = jCourseInfo["orgName"].asString().c_str();
  2186. oci.sPaperId = jCourseInfo["paperId"].asString().c_str();
  2187. oci.sSpecialtyName = jCourseInfo["specialtyName"].asString().c_str();
  2188. oci.sStartTime = jCourseInfo["startTime"].asString().c_str();
  2189. oci.sStatus = jCourseInfo["status"].asString().c_str();
  2190. oci.sStudentCode = jCourseInfo["studentCode"].asString().c_str();
  2191. oci.sStudentName = jCourseInfo["studentName"].asString().c_str();
  2192. int nFileSize = jCourseInfo["offlineFiles"].size();
  2193. for (int j = 0; j < nFileSize; ++j)
  2194. {
  2195. Json::Value jFileItem = jCourseInfo["offlineFiles"][j];
  2196. COfflineFileInfo ofi;
  2197. ofi.nExamRecordDataId = jFileItem["examRecordDataId"].asInt64();
  2198. ofi.sFileType = jFileItem["fileType"].asString().c_str();
  2199. ofi.nId = jFileItem["id"].asInt64();
  2200. ofi.sOfflineFileName = jFileItem["offlineFileName"].asString().c_str();
  2201. ofi.sOfflineFileUrl = jFileItem["offlineFileUrl"].asString().c_str();
  2202. ofi.sOriginalFileName = jFileItem["originalFileName"].asString().c_str();
  2203. ofi.sProperties = jFileItem["properties"].asString().c_str();
  2204. ofi.sSuffix = jFileItem["suffix"].asString().c_str();
  2205. oci.vOfflineFileInfo.push_back(ofi);
  2206. }
  2207. pGetOfflineCourse->vOfflineCourseInfo.push_back(oci);
  2208. }
  2209. }
  2210. catch (const std::exception &e)
  2211. {
  2212. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2213. }
  2214. }
  2215. void CHttpBll::genGetOffLineExamAnswerSheet(CGetOffLineExamAnswerSheet *pGetOffLineExamAnswerSheet, const std::string &sResponse)
  2216. {
  2217. pGetOffLineExamAnswerSheet->sAnswerSheetUrl = sResponse.c_str();
  2218. }
  2219. void CHttpBll::genGetOffLineExamPaper(CGetOffLineExamPaper *pGetOffLineExamPaper, const std::string &sResponse)
  2220. {
  2221. }
  2222. void CHttpBll::genPreviewOffLineExamPaper(CPreviewOffLineExamPaper *pPreviewOffLineExamPaper, const std::string &sResponse)
  2223. {
  2224. pPreviewOffLineExamPaper->sUrl = sResponse.c_str();
  2225. }
  2226. void CHttpBll::genCheckExamInProgress(CCheckExamInProgress *pCheckExamInProgress, const std::string &sResponse)
  2227. {
  2228. try
  2229. {
  2230. Json::Reader reader;
  2231. Json::Value jsonRoot = Json::Value::null;
  2232. if (!reader.parse(sResponse, jsonRoot))
  2233. {
  2234. pCheckExamInProgress->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2235. myDebug() << pCheckExamInProgress->sMessage << sResponse.c_str();
  2236. }
  2237. if (jsonRoot["data"].isNull())
  2238. {
  2239. pCheckExamInProgress->bHasExamInProgress = false;
  2240. }
  2241. else
  2242. {
  2243. pCheckExamInProgress->bHasExamInProgress = true;
  2244. pCheckExamInProgress->nInterruptNum = jsonRoot["data"]["interruptNum"].asInt();
  2245. pCheckExamInProgress->nMaxInterruptNum = jsonRoot["data"]["maxInterruptNum"].asInt();
  2246. pCheckExamInProgress->bIsExceed = jsonRoot["data"]["isExceed"].asBool();
  2247. pCheckExamInProgress->nExamRecordDataId = jsonRoot["data"]["examRecordDataId"].asInt64();
  2248. pCheckExamInProgress->nExamId = jsonRoot["data"]["examId"].asInt64();
  2249. pCheckExamInProgress->nUsedTime = jsonRoot["data"]["usedTime"].asInt64();
  2250. pCheckExamInProgress->nFaceVerifyMinute = jsonRoot["data"]["faceVerifyMinute"].asInt();
  2251. pCheckExamInProgress->sExamType = jsonRoot["data"]["examType"].asString().c_str();
  2252. }
  2253. }
  2254. catch (const std::exception &e)
  2255. {
  2256. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2257. }
  2258. }
  2259. void CHttpBll::genGetCourseInfo(CGetCourseInfo *pGetCourseInfo, const std::string &sResponse)
  2260. {
  2261. try
  2262. {
  2263. Json::Reader reader;
  2264. Json::Value jsonRoot = Json::Value::null;
  2265. if (!reader.parse(sResponse, jsonRoot))
  2266. {
  2267. pGetCourseInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2268. myDebug() << pGetCourseInfo->sMessage << sResponse.c_str();
  2269. }
  2270. pGetCourseInfo->sCourseName = jsonRoot["courseName"].asString().c_str();
  2271. pGetCourseInfo->sCourseCode = jsonRoot["courseCode"].asString().c_str();
  2272. }
  2273. catch (const std::exception &e)
  2274. {
  2275. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2276. }
  2277. }
  2278. void CHttpBll::genExamHeartbeat(CExamHeartbeat *pExamHeartbeat, const std::string &sResponse)
  2279. {
  2280. pExamHeartbeat->nLeftTime = QString(sResponse.c_str()).toLongLong();
  2281. }
  2282. void CHttpBll::genFindExamQuestionList(CFindExamQuestionList *pFindExamQuestionList, const std::string &sResponse)
  2283. {
  2284. try
  2285. {
  2286. Json::Reader reader;
  2287. Json::Value jsonRoot = Json::Value::null;
  2288. if (!reader.parse(sResponse, jsonRoot))
  2289. {
  2290. pFindExamQuestionList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2291. myDebug() << pFindExamQuestionList->sMessage << sResponse.c_str();
  2292. }
  2293. int nSize = jsonRoot.size();
  2294. for (int i = 0; i < nSize; ++i)
  2295. {
  2296. Json::Value jQuestionItem = jsonRoot[i];
  2297. CAnsweredQuestion aq;
  2298. aq.sAnswerType = jQuestionItem["answerType"].asString().c_str();
  2299. aq.sAudioPlayTimes = jQuestionItem["audioPlayTimes"].isNull() ? "" :jQuestionItem["audioPlayTimes"].asString().c_str();
  2300. aq.sCorrectAnswer = jQuestionItem["correctAnswer"].isNull() ? "" : jQuestionItem["correctAnswer"].asString().c_str();
  2301. aq.sExamQuestionTempId = jQuestionItem["examQuestionTempId"].asString().c_str();
  2302. aq.nExamRecordDataId = jQuestionItem["examRecordDataId"].asInt64();
  2303. aq.bIsAnswer = jQuestionItem["isAnswer"].asBool();
  2304. aq.bIsInMongo = jQuestionItem["isInMongo"].asBool();
  2305. aq.bIsSign = jQuestionItem["isSign"].asBool();
  2306. aq.nMainNumber = jQuestionItem["mainNumber"].asInt();
  2307. int nOptionSize = jQuestionItem["optionPermutation"].size();
  2308. for (int j = 0; j < nOptionSize; ++j)
  2309. {
  2310. aq.vOptionPermutation.push_back(jQuestionItem["optionPermutation"][i].asInt());
  2311. }
  2312. aq.nOrder = jQuestionItem["order"].asInt();
  2313. aq.sQuestionId = jQuestionItem["questionId"].asString().c_str();
  2314. aq.fQuestionScore = jQuestionItem["questionScore"].asDouble();
  2315. aq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  2316. aq.sStudentAnswer = jQuestionItem["studentAnswer"].asString().c_str();
  2317. aq.fStudentScore = jQuestionItem["studentScore"].asDouble();
  2318. pFindExamQuestionList->vAnsweredQuestion.push_back(aq);
  2319. }
  2320. }
  2321. catch (const std::exception &e)
  2322. {
  2323. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2324. }
  2325. }
  2326. void CHttpBll::genGetExamRecordPaperStruct(CGetExamRecordPaperStruct *pGetExamRecordPaperStruct, const std::string &sResponse)
  2327. {
  2328. try
  2329. {
  2330. Json::Reader reader;
  2331. Json::Value jsonRoot = Json::Value::null;
  2332. if (!reader.parse(sResponse, jsonRoot))
  2333. {
  2334. pGetExamRecordPaperStruct->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2335. myDebug() << pGetExamRecordPaperStruct->sMessage << sResponse.c_str();
  2336. }
  2337. pGetExamRecordPaperStruct->sPaperId = jsonRoot["id"].asString().c_str();
  2338. pGetExamRecordPaperStruct->sPaperName = jsonRoot["defaultPaper"]["name"].asString().c_str();
  2339. pGetExamRecordPaperStruct->bFullyObjective = jsonRoot["defaultPaper"]["fullyObjective"].asBool();
  2340. int nGroupSize = jsonRoot["defaultPaper"]["questionGroupList"].size();
  2341. int nOrder = 1;
  2342. for (int i = 0; i < nGroupSize; ++i)
  2343. {
  2344. Json::Value jGroupItem = jsonRoot["defaultPaper"]["questionGroupList"][i];
  2345. CPaperGroupStruct pgs;
  2346. pgs.sGroupName = jGroupItem["groupName"].asString().c_str();
  2347. pgs.fGroupScore = jGroupItem["groupScore"].asDouble();
  2348. pgs.nNumber = i + 1;
  2349. int nQuestionSize = jGroupItem["questionWrapperList"].size();
  2350. int nShowIndex = 1;
  2351. int nTotalSubquestion = 0;
  2352. for (int j = 0; j < nQuestionSize; ++j)
  2353. {
  2354. Json::Value jQuestionItem = jGroupItem["questionWrapperList"][j];
  2355. CQuestionStruct qs;
  2356. qs.sQuestionId = jQuestionItem["questionId"].asString().c_str();
  2357. qs.sVersion = jQuestionItem["version"].asString().c_str();
  2358. qs.fQuestionScore = jQuestionItem["questionScore"].asDouble();
  2359. qs.nLimitedPlayTimes = jQuestionItem["limitedPlayTimes"].asInt();
  2360. qs.nPlayedTimes = jQuestionItem["playedTimes"].asInt();
  2361. qs.nTimeLimit = jQuestionItem["timeLimit"].asInt();
  2362. int mSubQuestionSize = jQuestionItem["questionUnitWrapperList"].size();
  2363. nTotalSubquestion += mSubQuestionSize;
  2364. for (int k = 0; k < mSubQuestionSize; ++k)
  2365. {
  2366. Json::Value jSubQuestionItem = jQuestionItem["questionUnitWrapperList"][k];
  2367. CSubQuestionStruct sqs;
  2368. sqs.sQuestionType = jSubQuestionItem["questionType"].asString().c_str();
  2369. sqs.sAnswerType = jSubQuestionItem["answerType"].asString().c_str();
  2370. sqs.fQuestionScore = jSubQuestionItem["questionScore"].asDouble();
  2371. sqs.nLimitedPlayTimes = qs.nLimitedPlayTimes;
  2372. for (int jq = 0; jq < jSubQuestionItem["optionPermutation"].size(); ++jq)
  2373. {
  2374. Json::Value Item = jSubQuestionItem["optionPermutation"][jq];
  2375. sqs.voptionPermutation.push_back(Item.asInt());
  2376. }
  2377. sqs.nShowNumber = nShowIndex;
  2378. sqs.nOrder = nOrder;
  2379. nShowIndex++;
  2380. nOrder++;
  2381. qs.vSubQuestionStruct.push_back(sqs);
  2382. }
  2383. pgs.vQuestionStruct.push_back(qs);
  2384. }
  2385. pgs.nTotalSubquestion = nTotalSubquestion;
  2386. pGetExamRecordPaperStruct->vPaperGroupStruct.push_back(pgs);
  2387. }
  2388. }
  2389. catch (const std::exception &e)
  2390. {
  2391. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2392. }
  2393. }
  2394. void CHttpBll::genGetEndExamInfo(CGetEndExamInfo *pGetEndExamInfo, const std::string &sResponse)
  2395. {
  2396. try
  2397. {
  2398. if (sResponse == "")
  2399. {
  2400. pGetEndExamInfo->bIsCalculate = true;
  2401. return;
  2402. }
  2403. Json::Reader reader;
  2404. Json::Value jsonRoot = Json::Value::null;
  2405. if (!reader.parse(sResponse, jsonRoot))
  2406. {
  2407. pGetEndExamInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2408. myDebug() << pGetEndExamInfo->sMessage << sResponse.c_str();
  2409. }
  2410. pGetEndExamInfo->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64();
  2411. pGetEndExamInfo->bIsWarn = jsonRoot["isWarn"].asBool();
  2412. pGetEndExamInfo->fObjectiveAccuracy = jsonRoot["objectiveAccuracy"].asDouble();
  2413. pGetEndExamInfo->fObjectiveScore = jsonRoot["objectiveScore"].asInt64();
  2414. }
  2415. catch (const std::exception &e)
  2416. {
  2417. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2418. }
  2419. }
  2420. void CHttpBll::genGetWXQrCode(CGetWXQrCode *pGetWXQrCode, const std::string &sResponse)
  2421. {
  2422. pGetWXQrCode->sUrl = sResponse.c_str();
  2423. }
  2424. //void CHttpBll::genProcessUpload(CProcessUpload *pProcessUpload, const std::string &sResponse)
  2425. //{
  2426. // try
  2427. // {
  2428. // Json::Reader reader;
  2429. // Json::Value jsonRoot = Json::Value::null;
  2430. // if (!reader.parse(sResponse, jsonRoot))
  2431. // {
  2432. // pProcessUpload->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2433. // myDebug() << pProcessUpload->sMessage << sResponse.c_str();
  2434. // }
  2435. // pProcessUpload->sFileUrl = jsonRoot["fileUrl"].asString().c_str();
  2436. // }
  2437. // catch (const std::exception &e)
  2438. // {
  2439. // myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2440. // }
  2441. //}
  2442. void CHttpBll::genGetOrgPropertiesByGroupWithoutCache(CGetOrgPropertiesByGroupWithoutCache *pOrgProperties, const std::string &sResponse)
  2443. {
  2444. try
  2445. {
  2446. Json::Reader reader;
  2447. Json::Value jsonRoot = Json::Value::null;
  2448. if (!reader.parse(sResponse, jsonRoot))
  2449. {
  2450. pOrgProperties->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2451. myDebug() << pOrgProperties->sMessage << sResponse.c_str();
  2452. }
  2453. pOrgProperties->nActionNum = QVariant(jsonRoot["ACTION_NUM"].asString().c_str()).toInt();
  2454. pOrgProperties->sActionOptions = jsonRoot["ACTION_OPTIONS"].asString().c_str();
  2455. pOrgProperties->sActionOrder = jsonRoot["ACTION_ORDER"].asString().c_str();
  2456. pOrgProperties->nActionDuration = QVariant(jsonRoot["ACTION_DURATION"].asString().c_str()).toInt();
  2457. pOrgProperties->nActionAlert = QVariant(jsonRoot["ACTION_ALERT"].asString().c_str()).toInt();
  2458. pOrgProperties->nAllActionDuration = QVariant(jsonRoot["ALL_ACTION_DURATION"].asString().c_str()).toInt();
  2459. if(jsonRoot.isMember("PC_CLIENT_FACE_THRESHOLD") && jsonRoot["PC_CLIENT_FACE_THRESHOLD"] != Json::Value::null)
  2460. {
  2461. pOrgProperties->nFaceThreshold = QVariant(jsonRoot["PC_CLIENT_FACE_THRESHOLD"].asString().c_str()).toInt();
  2462. }
  2463. }
  2464. catch (const std::exception &e)
  2465. {
  2466. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2467. }
  2468. }
  2469. void CHttpBll::genStartFaceLiveVerify(CStartFaceLiveVerify *pStartFaceLiveVerify, const std::string &sResponse)
  2470. {
  2471. try
  2472. {
  2473. Json::Reader reader;
  2474. Json::Value jsonRoot = Json::Value::null;
  2475. if (!reader.parse(sResponse, jsonRoot))
  2476. {
  2477. pStartFaceLiveVerify->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2478. myDebug() << pStartFaceLiveVerify->sMessage << sResponse.c_str();
  2479. }
  2480. pStartFaceLiveVerify->nFaceLiveVerifyId = jsonRoot["faceLiveVerifyId"].asInt64();
  2481. pStartFaceLiveVerify->nStartMinute = jsonRoot["startMinute"].asInt();
  2482. pStartFaceLiveVerify->nTimes = jsonRoot["times"].asInt();
  2483. }
  2484. catch (const std::exception &e)
  2485. {
  2486. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2487. }
  2488. }
  2489. void CHttpBll::genClientExamProcessUploadSign(CClientExamProcessUploadSign *pClientExamProcessUploadSign, const std::string &sResponse)
  2490. {
  2491. try
  2492. {
  2493. Json::Reader reader;
  2494. Json::Value jsonRoot = Json::Value::null;
  2495. if (!reader.parse(sResponse, jsonRoot))
  2496. {
  2497. pClientExamProcessUploadSign->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2498. myDebug() << pClientExamProcessUploadSign->sMessage << sResponse.c_str();
  2499. }
  2500. pClientExamProcessUploadSign->sType = jsonRoot["fsType"].asString().c_str();
  2501. pClientExamProcessUploadSign->sAccessUrl = jsonRoot["accessUrl"].asString().c_str();
  2502. pClientExamProcessUploadSign->sSignIdentifier = jsonRoot["signIdentifier"].asString().c_str();
  2503. pClientExamProcessUploadSign->sFormUrl = jsonRoot["formUrl"].asString().c_str();
  2504. pClientExamProcessUploadSign->sOssAcessKeyId = jsonRoot["formParams"]["OSSAccessKeyId"].asString().c_str();
  2505. pClientExamProcessUploadSign->sSignature = jsonRoot["formParams"]["Signature"].asString().c_str();
  2506. pClientExamProcessUploadSign->sKey = jsonRoot["formParams"]["key"].asString().c_str();
  2507. pClientExamProcessUploadSign->sPolicy = jsonRoot["formParams"]["policy"].asString().c_str();
  2508. }
  2509. catch (const std::exception &e)
  2510. {
  2511. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2512. }
  2513. }
  2514. void CHttpBll::genSkipFaceCheckParam(CSkipFaceCheckParam *pSkipFaceCheckParam, const std::string &sResponse)
  2515. {
  2516. try
  2517. {
  2518. pSkipFaceCheckParam->bSkipFaceCheck = QVariant(sResponse.c_str()).toBool();
  2519. }
  2520. catch (const std::exception &e)
  2521. {
  2522. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2523. }
  2524. }