CHttpBll.cpp 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767
  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. case RequestType::rtGetWXUploadedFile:
  1077. {
  1078. CGetWXUploadedFile res;
  1079. res.nCode = nCode;
  1080. if (sErrorMsg != "" || nCode != 200)
  1081. {
  1082. res.sMessage = sErrorMsg;
  1083. }
  1084. else
  1085. {
  1086. genGetWXUploadedFile(&res, sResponse);
  1087. }
  1088. emit sgnGetWXUploadedFile(res);
  1089. }
  1090. break;
  1091. default:
  1092. break;
  1093. }
  1094. }
  1095. void CHttpBll::genUpgrade(CUpgrade *pUpgrade, const std::string &sResponse)
  1096. {
  1097. try
  1098. {
  1099. Json::Reader reader;
  1100. Json::Value jsonRoot = Json::Value::null;
  1101. if(!reader.parse(sResponse, jsonRoot))
  1102. {
  1103. pUpgrade->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1104. myDebug() << pUpgrade->sMessage << sResponse.c_str();
  1105. }
  1106. pUpgrade->sVersion = jsonRoot["version"].asString().c_str();
  1107. pUpgrade->nBuild = jsonRoot["build"].asInt();
  1108. pUpgrade->sContent = jsonRoot["content"].asString().c_str();
  1109. pUpgrade->bForce = jsonRoot["force"].asBool();
  1110. pUpgrade->sUpgradeUrl = jsonRoot["downUrl"].asString().c_str();
  1111. }
  1112. catch (const std::exception &e)
  1113. {
  1114. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1115. }
  1116. }
  1117. void CHttpBll::genAgreement(CAgreement *pAgreement, const std::string &sResponse)
  1118. {
  1119. try
  1120. {
  1121. std::string sRes = sResponse;
  1122. if (sResponse.length() > 3 && sResponse[0] == -17 &&
  1123. sResponse[1] == -69 &&
  1124. sResponse[2] == -65)
  1125. {
  1126. sRes = sResponse.substr(3, sResponse.length() -3);
  1127. }
  1128. Json::Reader reader;
  1129. Json::Value jsonRoot = Json::Value::null;
  1130. if(!reader.parse(sRes, jsonRoot))
  1131. {
  1132. pAgreement->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1133. myDebug() << pAgreement->sMessage << sResponse.c_str();
  1134. }
  1135. pAgreement->sTitle = jsonRoot["title"].asString().c_str();
  1136. pAgreement->nStaySeconds = jsonRoot["staySeconds"].asInt();
  1137. pAgreement->sContent = jsonRoot["content"].toStyledString().c_str();
  1138. }
  1139. catch (const std::exception &e)
  1140. {
  1141. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1142. }
  1143. }
  1144. void CHttpBll::genStudentClientConfig(CStudentClientConfig *pStudentClientConfig, const std::string &sResponse)
  1145. {
  1146. try
  1147. {
  1148. Json::Reader reader;
  1149. Json::Value jsonRoot = Json::Value::null;
  1150. if (!reader.parse(sResponse, jsonRoot))
  1151. {
  1152. pStudentClientConfig->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1153. myDebug() << pStudentClientConfig->sMessage << sResponse.c_str();
  1154. }
  1155. pStudentClientConfig->sCusMenuLogoFileUrl = jsonRoot["CUS_MENU_LOGO_FILE_URL"].asString().c_str();
  1156. pStudentClientConfig->sIdentityNumberLoginAlias = jsonRoot["IDENTITY_NUMBER_LOGIN_ALIAS"].asString().c_str();
  1157. pStudentClientConfig->bIsCustomMenuLogo = QVariant(jsonRoot["IS_CUSTOM_MENU_LOGO"].asString().c_str()).toBool();
  1158. QString loginType = jsonRoot["LOGIN_TYPE"].asString().c_str();
  1159. QStringList ltList = loginType.split(",");
  1160. for (QString sType : ltList)
  1161. {
  1162. if (sType == "STUDENT_CODE")
  1163. {
  1164. pStudentClientConfig->bStudentCodeLogin = true;
  1165. }
  1166. else if (sType == "IDENTITY_NUMBER")
  1167. {
  1168. pStudentClientConfig->bIdentifyNumberLogin = true;
  1169. }
  1170. }
  1171. pStudentClientConfig->sLogoFileUrl = jsonRoot["LOGO_FILE_URL"].asString().c_str();
  1172. pStudentClientConfig->sStudentClientBgPictureUrl = jsonRoot["STUDENT_CLIENT_BG_PICTURE_URL"].asString().c_str();
  1173. pStudentClientConfig->sOeStudentSysName = jsonRoot["OE_STUDENT_SYS_NAME"].asString().c_str();
  1174. QString preventCheating = jsonRoot["PREVENT_CHEATING_CONFIG"].asString().c_str();
  1175. QStringList pcList = preventCheating.split(",");
  1176. for (QString sType : pcList)
  1177. {
  1178. if (sType == "DISABLE_REMOTE_ASSISTANCE")
  1179. {
  1180. pStudentClientConfig->bDisableRemoteAssistance = true;
  1181. }
  1182. else if (sType == "FULL_SCREEN_TOP")
  1183. {
  1184. pStudentClientConfig->bFullScreenTop = true;
  1185. }
  1186. else if (sType == "DISABLE_MULTISCREEN")
  1187. {
  1188. pStudentClientConfig->bDisableMutiScreen = true;
  1189. }
  1190. else if (sType == "DISABLE_VIRTUAL_CAMERA")
  1191. {
  1192. pStudentClientConfig->bDisableVirtualCamera = true;
  1193. }
  1194. else if (sType == "DISABLE_VIRTUAL_MACHINE")
  1195. {
  1196. pStudentClientConfig->bDisableVirtualMachine = true;
  1197. }
  1198. else if(sType == "EXAMING_BLACK_LIST_CHECK")
  1199. {
  1200. pStudentClientConfig->bExamingBlackListCheck = true;
  1201. }
  1202. }
  1203. pStudentClientConfig->sRootOrgId = jsonRoot["ROOT_ORG_ID"].asString().c_str();// " : "0",
  1204. pStudentClientConfig->bShowQmthLogo = QVariant(jsonRoot["SHOW_QMTH_LOGO"].asString().c_str()).toBool();// " : "false",
  1205. pStudentClientConfig->bShowStudentClientAppQrcode = QVariant(jsonRoot["SHOW_STUDENT_CLIENT_APP_QRCODE"].asString().c_str()).toBool();// " : "true",
  1206. pStudentClientConfig->sStudentCodeLoginAlias = jsonRoot["STUDENT_CODE_LOGIN_ALIAS"].asString().c_str(); // " : "学号登录34s"
  1207. if (jsonRoot.isMember("SHOW_INFO"))
  1208. {
  1209. QString sShowInfo = jsonRoot["SHOW_INFO"].asString().c_str();
  1210. pStudentClientConfig->bShowStudentName = sShowInfo.indexOf("STU_NAME") >= 0;
  1211. pStudentClientConfig->bShowStudentCode = sShowInfo.indexOf("STU_CODE") >= 0;
  1212. pStudentClientConfig->bShowStudentIdentity = sShowInfo.indexOf("IDENTITY_NUMBER") >= 0;
  1213. }
  1214. }
  1215. catch (const std::exception &e)
  1216. {
  1217. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1218. }
  1219. }
  1220. void CHttpBll::genSysNotice(CSysNotice *pSysNotice, const std::string &sResponse)
  1221. {
  1222. try
  1223. {
  1224. Json::Reader reader;
  1225. Json::Value jsonRoot = Json::Value::null;
  1226. if (!reader.parse(sResponse, jsonRoot))
  1227. {
  1228. pSysNotice->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1229. myDebug() << pSysNotice->sMessage << sResponse.c_str();
  1230. }
  1231. pSysNotice->nId = jsonRoot["id"].asInt64();
  1232. pSysNotice->nRootOrgId = jsonRoot["rootOrgId"].asInt64();
  1233. pSysNotice->sContent = jsonRoot["content"].asString().c_str();
  1234. pSysNotice->sStartTime = jsonRoot["startTime"].asString().c_str();
  1235. pSysNotice->sEndTime = jsonRoot["endTime"].asString().c_str();
  1236. pSysNotice->sTitle = jsonRoot["title"].asString().c_str();
  1237. pSysNotice->bEnable = jsonRoot["enable"].asBool();
  1238. }
  1239. catch (const std::exception &e)
  1240. {
  1241. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1242. }
  1243. }
  1244. void CHttpBll::genSoftwareConfig(CGetSoftwareConfig *pSoftwareConfig, const std::string &sResponse)
  1245. {
  1246. if(!sResponse.empty())
  1247. {
  1248. pSoftwareConfig->sSoftwareConfig = std::string(sResponse.rbegin()+32, sResponse.rend()).c_str();
  1249. }
  1250. }
  1251. void CHttpBll::genLoginLimit(CLoginLimit *pLoginLimit, const std::string &sResponse)
  1252. {
  1253. try
  1254. {
  1255. Json::Reader reader;
  1256. Json::Value jsonRoot = Json::Value::null;
  1257. if (!reader.parse(sResponse, jsonRoot))
  1258. {
  1259. pLoginLimit->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1260. myDebug() << pLoginLimit->sMessage << sResponse.c_str();
  1261. }
  1262. pLoginLimit->nCount = jsonRoot["count"].asInt64();
  1263. pLoginLimit->bPass = jsonRoot["pass"].asBool();
  1264. }
  1265. catch (const std::exception &e)
  1266. {
  1267. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1268. }
  1269. }
  1270. void CHttpBll::genLoginInfo(CLoginInfo *pLoginInfo, const std::string &sResponse)
  1271. {
  1272. try
  1273. {
  1274. Json::Reader reader;
  1275. Json::Value jsonRoot = Json::Value::null;
  1276. if (!reader.parse(sResponse, jsonRoot))
  1277. {
  1278. pLoginInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1279. myDebug() << pLoginInfo->sMessage << sResponse.c_str();
  1280. }
  1281. // pLoginInfo->nCode = jsonRoot["code"].asInt();
  1282. if (jsonRoot["code"].asString() != "200")
  1283. {
  1284. pLoginInfo->nCode = 0;
  1285. }
  1286. pLoginInfo->sMessage = jsonRoot["desc"].asString().c_str();
  1287. sKey = jsonRoot["content"]["key"].asString().c_str();
  1288. sToken = jsonRoot["content"]["token"].asString().c_str();
  1289. pLoginInfo->sUserType = jsonRoot["content"]["userType"].asString().c_str();
  1290. pLoginInfo->nUserId = jsonRoot["content"]["userId"].asInt64();
  1291. pLoginInfo->sDisplayName = jsonRoot["content"]["displayName"].asString().c_str();
  1292. pLoginInfo->nRootOrgId = jsonRoot["content"]["rootOrgId"].asInt64();
  1293. pLoginInfo->sRootOrgName = jsonRoot["content"]["rootOrgName"].asString().c_str();
  1294. pLoginInfo->sCreationTime = jsonRoot["content"]["creationTime"].asString().c_str();
  1295. pLoginInfo->sClientIp = jsonRoot["content"]["clientIp"].asString().c_str();
  1296. pLoginInfo->nSessionTimeout = jsonRoot["content"]["sessionTimeout"].asInt64();
  1297. pLoginInfo->bPasswordWeak = jsonRoot["content"]["passwordWeak"].asBool();
  1298. }
  1299. catch (const std::exception &e)
  1300. {
  1301. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1302. }
  1303. }
  1304. void CHttpBll::genLogout(CLogout *pLogout, const std::string &sResponse)
  1305. {
  1306. }
  1307. void CHttpBll::genEditPassword(CEditPassword *pEditPassword, const std::string &sResponse)
  1308. {
  1309. }
  1310. void CHttpBll::genGetStudentClientMenu(CGetStudentClientMenu *pGetStudentClientMenu, const std::string &sResponse)
  1311. {
  1312. try
  1313. {
  1314. Json::Reader reader;
  1315. Json::Value jsonRoot = Json::Value::null;
  1316. if (!reader.parse(sResponse, jsonRoot))
  1317. {
  1318. pGetStudentClientMenu->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1319. myDebug() << pGetStudentClientMenu->sMessage << sResponse.c_str();
  1320. }
  1321. int nSize = jsonRoot.size();
  1322. for (int i = 0; i < nSize; ++i)
  1323. {
  1324. Json::Value jMenuItem = jsonRoot[i];
  1325. CStudentClientMenu scm;
  1326. scm.nId = jMenuItem["id"].asInt64();
  1327. scm.sCode = jMenuItem["code"].asString().c_str();
  1328. scm.sName = jMenuItem["name"].asString().c_str();
  1329. pGetStudentClientMenu->vMenus.push_back(scm);
  1330. }
  1331. }
  1332. catch (const std::exception &e)
  1333. {
  1334. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1335. }
  1336. }
  1337. void CHttpBll::genGetStudentInfoBySession(CGetStudentInfoBySession *pGetStudentInfoBySession, const std::string &sResponse)
  1338. {
  1339. try
  1340. {
  1341. Json::Reader reader;
  1342. Json::Value jsonRoot = Json::Value::null;
  1343. if (!reader.parse(sResponse, jsonRoot))
  1344. {
  1345. pGetStudentInfoBySession->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1346. myDebug() << pGetStudentInfoBySession->sMessage << sResponse.c_str();
  1347. }
  1348. pGetStudentInfoBySession->nId = jsonRoot["id"].asInt64();
  1349. pGetStudentInfoBySession->sName = jsonRoot["name"].asString().c_str();
  1350. pGetStudentInfoBySession->nOrgId = jsonRoot["orgId"].asInt64();
  1351. pGetStudentInfoBySession->sOrgCode = jsonRoot["orgCode"].asString().c_str();
  1352. pGetStudentInfoBySession->sOrgName = jsonRoot["orgName"].asString().c_str();
  1353. QString sStudentCode = "";
  1354. int nSize = jsonRoot["studentCodeList"].size();
  1355. for (int i = 0; i < nSize; ++i)
  1356. {
  1357. if (sStudentCode.isEmpty())
  1358. {
  1359. sStudentCode = jsonRoot["studentCodeList"][i].asString().c_str();
  1360. }
  1361. else
  1362. {
  1363. sStudentCode = sStudentCode + "," + jsonRoot["studentCodeList"][i].asString().c_str();
  1364. }
  1365. }
  1366. pGetStudentInfoBySession->sStudentCode = sStudentCode;
  1367. pGetStudentInfoBySession->sIdentityNumber = jsonRoot["identityNumber"].asString().c_str();
  1368. pGetStudentInfoBySession->sPhotoPath = jsonRoot["photoPath"].asString().c_str();
  1369. pGetStudentInfoBySession->bEnable = jsonRoot["enable"].asBool();
  1370. }
  1371. catch (const std::exception &e)
  1372. {
  1373. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1374. }
  1375. }
  1376. void CHttpBll::genSpecialtyNameList(CSpecialtyNameList *pSpecialtyNameList, const std::string &sResponse)
  1377. {
  1378. try
  1379. {
  1380. Json::Reader reader;
  1381. Json::Value jsonRoot = Json::Value::null;
  1382. if (!reader.parse(sResponse, jsonRoot))
  1383. {
  1384. pSpecialtyNameList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1385. myDebug() << pSpecialtyNameList->sMessage << sResponse.c_str();
  1386. }
  1387. QString sSpecialtyName = "";
  1388. int nSize = jsonRoot.size();
  1389. for (int i = 0; i < nSize; ++i)
  1390. {
  1391. if (sSpecialtyName.isEmpty())
  1392. {
  1393. sSpecialtyName = jsonRoot[i].asString().c_str();
  1394. }
  1395. else
  1396. {
  1397. sSpecialtyName = sSpecialtyName + "," + jsonRoot[i].asString().c_str();
  1398. }
  1399. }
  1400. pSpecialtyNameList->sSpecialtyName = sSpecialtyName;
  1401. }
  1402. catch (const std::exception &e)
  1403. {
  1404. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1405. }
  1406. }
  1407. void CHttpBll::genGetUserNoticeList(CGetUserNoticeList *pGetUserNoticeList, const std::string &sResponse)
  1408. {
  1409. try
  1410. {
  1411. Json::Reader reader;
  1412. Json::Value jsonRoot = Json::Value::null;
  1413. if (!reader.parse(sResponse, jsonRoot))
  1414. {
  1415. pGetUserNoticeList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1416. myDebug() << pGetUserNoticeList->sMessage << sResponse.c_str();
  1417. }
  1418. int nSize = jsonRoot.size();
  1419. for (int i = 0; i < nSize; ++i)
  1420. {
  1421. Json::Value jNoticeItem = jsonRoot[i];
  1422. CNoticeInfo ni;
  1423. ni.nId = jNoticeItem["id"].asInt64();
  1424. ni.sTitle = jNoticeItem["title"].asString().c_str();
  1425. ni.sContent = jNoticeItem["content"].asString().c_str();
  1426. ni.sPublisher = jNoticeItem["publisher"].asString().c_str();
  1427. ni.sPublishTime = jNoticeItem["publishTime"].asString().c_str();
  1428. ni.bHasRead = jNoticeItem["hasRead"].asBool();
  1429. ni.bHasRecalled = jNoticeItem["hasRecalled"].isNull() ? false : jNoticeItem["hasRecalled"].asBool();
  1430. pGetUserNoticeList->vNoticeList.push_back(ni);
  1431. }
  1432. }
  1433. catch (const std::exception &e)
  1434. {
  1435. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1436. }
  1437. }
  1438. void CHttpBll::genAppDownLoadUrl(CAppDownLoadUrl *pAppDownLoadUrl, const std::string &sResponse)
  1439. {
  1440. pAppDownLoadUrl->sUrl = sResponse.c_str();
  1441. }
  1442. void CHttpBll::genAppEnabled(CAppEnabled *pAppEnabled, const std::string &sResponse)
  1443. {
  1444. try
  1445. {
  1446. pAppEnabled->bEnable = QVariant(sResponse.c_str()).toBool();
  1447. }
  1448. catch (const std::exception &e)
  1449. {
  1450. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1451. }
  1452. }
  1453. void CHttpBll::genQueryBatchList(CQueryBatchList *pQueryBatchList, const std::string &sResponse)
  1454. {
  1455. try
  1456. {
  1457. Json::Reader reader;
  1458. Json::Value jsonRoot = Json::Value::null;
  1459. if (!reader.parse(sResponse, jsonRoot))
  1460. {
  1461. pQueryBatchList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1462. myDebug() << pQueryBatchList->sMessage << sResponse.c_str();
  1463. }
  1464. int nSize = jsonRoot.size();
  1465. for (int i = 0; i < nSize; ++i)
  1466. {
  1467. Json::Value jBatchItem = jsonRoot[i];
  1468. CBatchInfo bi;
  1469. bi.nId = jBatchItem["id"].asInt64();
  1470. bi.sName = jBatchItem["name"].asString().c_str();
  1471. bi.sExamType = jBatchItem["examType"].asString().c_str();
  1472. pQueryBatchList->vBatchList.push_back(bi);
  1473. }
  1474. }
  1475. catch (const std::exception &e)
  1476. {
  1477. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1478. }
  1479. }
  1480. void CHttpBll::genGetExamProperty(CGetExamProperty *pGetExamProperty, const std::string &sResponse)
  1481. {
  1482. try
  1483. {
  1484. Json::Reader reader;
  1485. Json::Value jsonRoot = Json::Value::null;
  1486. if (!reader.parse(sResponse, jsonRoot))
  1487. {
  1488. pGetExamProperty->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1489. myDebug() << pGetExamProperty->sMessage << sResponse.c_str();
  1490. }
  1491. if (jsonRoot.isMember("BEFORE_EXAM_REMARK") && jsonRoot["BEFORE_EXAM_REMARK"] != Json::Value::null)
  1492. {
  1493. pGetExamProperty->sBeforeExamRemark = jsonRoot["BEFORE_EXAM_REMARK"].asString().c_str();
  1494. }
  1495. if (jsonRoot.isMember("CHECK_ENVIRONMENT") && jsonRoot["CHECK_ENVIRONMENT"] != Json::Value::null)
  1496. {
  1497. pGetExamProperty->bCheckEnvironment = QVariant(jsonRoot["CHECK_ENVIRONMENT"].asString().c_str()).toBool();
  1498. }
  1499. // if (jsonRoot.isMember("PC_CLIENT_FACE_THRESHOLD"))
  1500. // {
  1501. // pGetExamProperty->nFaceThreshold = QVariant(jsonRoot["PC_CLIENT_FACE_THRESHOLD"].asString().c_str()).toInt();
  1502. // }
  1503. if (jsonRoot.isMember("IS_FACE_CHECK") && jsonRoot["IS_FACE_CHECK"] != Json::Value::null)
  1504. {
  1505. pGetExamProperty->bIsFaceCheck = QVariant(jsonRoot["IS_FACE_CHECK"].asString().c_str()).toBool();
  1506. }
  1507. if (jsonRoot.isMember("SNAPSHOT_INTERVAL") && jsonRoot["SNAPSHOT_INTERVAL"] != Json::Value::null)
  1508. {
  1509. pGetExamProperty->nSnapshotInterval = QVariant(jsonRoot["SNAPSHOT_INTERVAL"].asString().c_str()).toInt();
  1510. }
  1511. if (jsonRoot.isMember("FACE_VERIFY_START_MINUTE") && jsonRoot["FACE_VERIFY_START_MINUTE"] != Json::Value::null)
  1512. {
  1513. pGetExamProperty->nFaceVerifyStartMinute = QVariant(jsonRoot["FACE_VERIFY_START_MINUTE"].asString().c_str()).toInt();
  1514. }
  1515. if (jsonRoot.isMember("FACE_VERIFY_END_MINUTE") && jsonRoot["FACE_VERIFY_END_MINUTE"] != Json::Value::null)
  1516. {
  1517. pGetExamProperty->nFaceVerifyEndMinute = QVariant(jsonRoot["FACE_VERIFY_END_MINUTE"].asString().c_str()).toInt();
  1518. }
  1519. if (jsonRoot.isMember("IS_STRANGER_ENABLE") && jsonRoot["IS_STRANGER_ENABLE"] != Json::Value::null)
  1520. {
  1521. pGetExamProperty->bIsStrangerEnable = QVariant(jsonRoot["IS_STRANGER_ENABLE"].asString().c_str()).toBool();
  1522. }
  1523. if (jsonRoot.isMember("PRACTICE_TYPE") && jsonRoot["PRACTICE_TYPE"] != Json::Value::null)
  1524. {
  1525. pGetExamProperty->sPracticeType = jsonRoot["PRACTICE_TYPE"].asString().c_str();
  1526. }
  1527. if (jsonRoot.isMember("FREEZE_TIME") && jsonRoot["FREEZE_TIME"] != Json::Value::null)
  1528. {
  1529. pGetExamProperty->nFreezeTime = QVariant(jsonRoot["FREEZE_TIME"].asString().c_str()).toInt();
  1530. }
  1531. if (jsonRoot.isMember("AFTER_EXAM_REMARK") && jsonRoot["AFTER_EXAM_REMARK"] != Json::Value::null)
  1532. {
  1533. pGetExamProperty->sAfterExamRemark = jsonRoot["AFTER_EXAM_REMARK"].asString().c_str();
  1534. }
  1535. if (jsonRoot.isMember("IS_OBJ_SCORE_VIEW") && jsonRoot["IS_OBJ_SCORE_VIEW"] != Json::Value::null)
  1536. {
  1537. pGetExamProperty->bIsObjScoreView = QVariant(jsonRoot["IS_OBJ_SCORE_VIEW"].asString().c_str()).toBool();
  1538. }
  1539. if (jsonRoot.isMember("SHOW_CHEATING_REMARK") && jsonRoot["SHOW_CHEATING_REMARK"] != Json::Value::null)
  1540. {
  1541. pGetExamProperty->bShowCheatingRemark = QVariant(jsonRoot["SHOW_CHEATING_REMARK"].asString().c_str()).toBool();
  1542. }
  1543. if (jsonRoot.isMember("CHEATING_REMARK") && jsonRoot["CHEATING_REMARK"] != Json::Value::null)
  1544. {
  1545. pGetExamProperty->sCheatingRemark = jsonRoot["CHEATING_REMARK"].asString().c_str();
  1546. }
  1547. if (jsonRoot.isMember("IS_FACE_VERIFY_BEFORE") && jsonRoot["IS_FACE_VERIFY_BEFORE"] != Json::Value::null)
  1548. {
  1549. pGetExamProperty->bIsLivenessBefore = QVariant(jsonRoot["IS_FACE_VERIFY_BEFORE"].asString().c_str()).toBool();
  1550. }
  1551. if (jsonRoot.isMember("OFFLINE_UPLOAD_FILE_TYPE"))
  1552. {
  1553. QString sFileType = jsonRoot["OFFLINE_UPLOAD_FILE_TYPE"].asString().c_str();
  1554. Json::Reader reader;
  1555. Json::Value jFileType = Json::Value::null;
  1556. if (!reader.parse(sFileType.toStdString(), jFileType))
  1557. {
  1558. pGetExamProperty->sMessage = QString::fromLocal8Bit("解析文件类型异常!");
  1559. pGetExamProperty->nCode = 0;
  1560. }
  1561. int nSize = jFileType.size();
  1562. for (int i = 0; i < nSize; ++i)
  1563. {
  1564. pGetExamProperty->vOfflineUploadFileType.push_back(jFileType[i].asString().c_str());
  1565. }
  1566. }
  1567. if(jsonRoot.isMember("FACE_VERIFY_FORCE_EXIT") && jsonRoot["FACE_VERIFY_FORCE_EXIT"] != Json::Value::null)
  1568. {
  1569. pGetExamProperty->bFaceVerifyForceExit = QVariant(jsonRoot["FACE_VERIFY_FORCE_EXIT"].asString().c_str()).toBool();
  1570. }
  1571. if(jsonRoot.isMember("SHOW_MULTIPLE_CHOICE_WARNING") && jsonRoot["SHOW_MULTIPLE_CHOICE_WARNING"] != Json::Value::null)
  1572. {
  1573. pGetExamProperty->bMutipleAnserCountTips = QVariant(jsonRoot["SHOW_MULTIPLE_CHOICE_WARNING"].asString().c_str()).toBool();
  1574. }
  1575. }
  1576. catch (const std::exception &e)
  1577. {
  1578. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1579. }
  1580. }
  1581. void CHttpBll::genStartExamLimit(CStartExamLimit *pStartExamLimit, const std::string &sResponse)
  1582. {
  1583. try
  1584. {
  1585. Json::Reader reader;
  1586. Json::Value jsonRoot = Json::Value::null;
  1587. if (!reader.parse(sResponse, jsonRoot))
  1588. {
  1589. pStartExamLimit->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1590. myDebug() << pStartExamLimit->sMessage << sResponse.c_str();
  1591. }
  1592. pStartExamLimit->nCount = jsonRoot["count"].asInt();
  1593. pStartExamLimit->bPass = jsonRoot["pass"].asBool();
  1594. }
  1595. catch (const std::exception &e)
  1596. {
  1597. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1598. }
  1599. }
  1600. void CHttpBll::genIpLimit(CIpLimit *pIpLimit, const std::string &sResponse)
  1601. {
  1602. try
  1603. {
  1604. Json::Reader reader;
  1605. Json::Value jsonRoot = Json::Value::null;
  1606. if (!reader.parse(sResponse, jsonRoot))
  1607. {
  1608. pIpLimit->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1609. myDebug() << pIpLimit->sMessage << sResponse.c_str();
  1610. }
  1611. pIpLimit->bLimited = jsonRoot["limited"].asBool();
  1612. }
  1613. catch (const std::exception &e)
  1614. {
  1615. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1616. }
  1617. }
  1618. void CHttpBll::genStartExam(CStartExam *pStartExam, const std::string &sResponse)
  1619. {
  1620. try
  1621. {
  1622. Json::Reader reader;
  1623. Json::Value jsonRoot = Json::Value::null;
  1624. if (!reader.parse(sResponse, jsonRoot))
  1625. {
  1626. pStartExam->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1627. myDebug() << pStartExam->sMessage << sResponse.c_str();
  1628. }
  1629. pStartExam->sCourseCode = jsonRoot["courseCode"].asString().c_str();
  1630. pStartExam->sCourseName = jsonRoot["courseName"].asString().c_str();
  1631. pStartExam->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64();
  1632. pStartExam->nFaceVerifyMinute = jsonRoot["faceVerifyMinute"].asInt();
  1633. pStartExam->sStudentCode = jsonRoot["studentCode"].asString().c_str();
  1634. pStartExam->sStudentName = jsonRoot["studentName"].asString().c_str();
  1635. }
  1636. catch (const std::exception &e)
  1637. {
  1638. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1639. }
  1640. }
  1641. void CHttpBll::genFaceCheckEnabled(CFaceCheckEnabled *pFaceCheckEnabled, const std::string &sResponse)
  1642. {
  1643. try
  1644. {
  1645. pFaceCheckEnabled->bEnabled = QVariant(sResponse.c_str()).toBool();
  1646. }
  1647. catch (const std::exception &e)
  1648. {
  1649. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1650. }
  1651. }
  1652. void CHttpBll::genLivenessEnabled(CLivenessEnabled *pLivenessEnabled, const std::string &sResponse)
  1653. {
  1654. try
  1655. {
  1656. pLivenessEnabled->bEnabled = QVariant(sResponse.c_str()).toBool();
  1657. }
  1658. catch (const std::exception &e)
  1659. {
  1660. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1661. }
  1662. }
  1663. void CHttpBll::genWeiXinAnswerEnabled(CWeiXinAnswerEnabled *pWeiXinAnswerEnabled, const std::string &sResponse)
  1664. {
  1665. try
  1666. {
  1667. pWeiXinAnswerEnabled->bEnabled = QVariant(sResponse.c_str()).toBool();
  1668. }
  1669. catch (const std::exception &e)
  1670. {
  1671. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1672. }
  1673. }
  1674. void CHttpBll::genGetExamById(CGetExamById *pGetExamById, const std::string &sResponse)
  1675. {
  1676. try
  1677. {
  1678. Json::Reader reader;
  1679. Json::Value jsonRoot = Json::Value::null;
  1680. if (!reader.parse(sResponse, jsonRoot))
  1681. {
  1682. pGetExamById->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1683. myDebug() << pGetExamById->sMessage << sResponse.c_str();
  1684. }
  1685. pGetExamById->nId = jsonRoot["id"].asInt64();
  1686. pGetExamById->sCode = jsonRoot["code"].asString().c_str();
  1687. pGetExamById->nRootOrgId = jsonRoot["rootOrgId"].asInt64();
  1688. pGetExamById->sBeginTime = jsonRoot["beginTime"].asString().c_str();
  1689. pGetExamById->sEndTime = jsonRoot["endTime"].asString().c_str();
  1690. pGetExamById->sName = jsonRoot["name"].asString().c_str();
  1691. pGetExamById->sExamType = jsonRoot["examType"].asString().c_str();
  1692. pGetExamById->nDuration = jsonRoot["duration"].asInt64();
  1693. pGetExamById->bEnable = jsonRoot["enable"].asBool();
  1694. pGetExamById->bStarted = jsonRoot["started"].asBool();
  1695. pGetExamById->bIpLimitSettingsEnabled = jsonRoot["ipLimitSettingsEnabled"].asBool();
  1696. }
  1697. catch (const std::exception &e)
  1698. {
  1699. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1700. }
  1701. }
  1702. void CHttpBll::genStartAnswer(CStartAnswer *pStartAnswer, const std::string &sResponse)
  1703. {
  1704. try
  1705. {
  1706. Json::Reader reader;
  1707. Json::Value jsonRoot = Json::Value::null;
  1708. if (!reader.parse(sResponse, jsonRoot))
  1709. {
  1710. pStartAnswer->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1711. myDebug() << pStartAnswer->sMessage << sResponse.c_str();
  1712. }
  1713. pStartAnswer->nDuration = jsonRoot["duration"].asInt64();
  1714. pStartAnswer->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64();
  1715. pStartAnswer->nUsedExamSeconds = jsonRoot["usedExamSeconds"].asInt64();
  1716. }
  1717. catch (const std::exception &e)
  1718. {
  1719. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1720. }
  1721. }
  1722. void CHttpBll::genGetQuestion(CGetQuestion *pGetQuestion, const std::string &sResponse)
  1723. {
  1724. try
  1725. {
  1726. Json::Reader reader;
  1727. Json::Value jsonRoot = Json::Value::null;
  1728. if (!reader.parse(sResponse, jsonRoot))
  1729. {
  1730. pGetQuestion->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1731. myDebug() << pGetQuestion->sMessage << sResponse.c_str();
  1732. }
  1733. pGetQuestion->sId = jsonRoot["id"].asString().c_str();
  1734. pGetQuestion->sBody = jsonRoot["masterVersion"]["body"].isNull() ? "" : jsonRoot["masterVersion"]["body"].asString().c_str();
  1735. pGetQuestion->sVersion = jsonRoot["masterVersion"]["version"].asString().c_str();
  1736. pGetQuestion->bhasAudios = jsonRoot["masterVersion"]["hasAudios"].asBool();
  1737. int nSize = jsonRoot["masterVersion"]["questionUnitList"].size();
  1738. for (int i = 0; i < nSize; ++i)
  1739. {
  1740. Json::Value jQuestionItem = jsonRoot["masterVersion"]["questionUnitList"][i];
  1741. CSubQuestion sq;
  1742. sq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  1743. sq.sBody = jQuestionItem["body"].asString().c_str();
  1744. //sq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  1745. int nOptionSize = jQuestionItem["questionOptionList"].size();
  1746. for (int j = 0; j < nOptionSize; ++j)
  1747. {
  1748. Json::Value jOption = jQuestionItem["questionOptionList"][j];
  1749. COption o;
  1750. o.sBody = jOption["body"].asString().c_str();
  1751. sq.vOptions.push_back(o);
  1752. }
  1753. int nAnswerSize = jQuestionItem["rightAnswer"].size();
  1754. for (int k = 0; k < nAnswerSize; ++k)
  1755. {
  1756. Json::Value jAnswer = jQuestionItem["rightAnswer"][k];
  1757. sq.vRightAnswer.push_back(jAnswer.asString().c_str());
  1758. }
  1759. pGetQuestion->vSubQuestion.push_back(sq);
  1760. }
  1761. }
  1762. catch (const std::exception &e)
  1763. {
  1764. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1765. }
  1766. }
  1767. void CHttpBll::genGetQuestionContent(CGetQuestionContent *pGetQuestionContent, const std::string &sResponse)
  1768. {
  1769. try
  1770. {
  1771. Json::Reader reader;
  1772. Json::Value jsonRoot = Json::Value::null;
  1773. if (!reader.parse(sResponse, jsonRoot))
  1774. {
  1775. pGetQuestionContent->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1776. myDebug() << pGetQuestionContent->sMessage << sResponse.c_str();
  1777. }
  1778. pGetQuestionContent->sBody = jsonRoot["body"].isNull() ? "" : jsonRoot["body"].asString().c_str();
  1779. pGetQuestionContent->sVersion = jsonRoot["version"].asString().c_str();
  1780. pGetQuestionContent->bhasAudios = jsonRoot["hasAudios"].asBool();
  1781. int nSize = jsonRoot["questionUnitList"].size();
  1782. for (int i = 0; i < nSize; ++i)
  1783. {
  1784. Json::Value jQuestionItem = jsonRoot["questionUnitList"][i];
  1785. CSubQuestion sq;
  1786. sq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  1787. sq.sBody = jQuestionItem["body"].asString().c_str();
  1788. sq.sAnswerType = jQuestionItem["answerType"].asString().c_str();
  1789. int nOptionSize = jQuestionItem["questionOptionList"].size();
  1790. for (int j = 0; j < nOptionSize; ++j)
  1791. {
  1792. Json::Value jOption = jQuestionItem["questionOptionList"][j];
  1793. COption o;
  1794. o.sBody = jOption["body"].asString().c_str();
  1795. sq.vOptions.push_back(o);
  1796. }
  1797. for (int jq = 0; jq < jQuestionItem["optionPermutation"].size(); ++jq)
  1798. {
  1799. Json::Value Item = jQuestionItem["optionPermutation"][jq];
  1800. sq.voptionPermutation.push_back(Item.asInt());
  1801. }
  1802. int nAnswerSize = jQuestionItem["rightAnswer"].size();
  1803. for (int k = 0; k < nAnswerSize; ++k)
  1804. {
  1805. Json::Value jAnswer = jQuestionItem["rightAnswer"][k];
  1806. sq.vRightAnswer.push_back(jAnswer.asString().c_str());
  1807. }
  1808. pGetQuestionContent->vSubQuestion.push_back(sq);
  1809. }
  1810. }
  1811. catch (const std::exception &e)
  1812. {
  1813. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1814. }
  1815. }
  1816. void CHttpBll::genExamCourseInfo(const Json::Value &jExamItem, CExamCourseInfo &eci)
  1817. {
  1818. try
  1819. {
  1820. eci.nAllowExamCount = jExamItem["allowExamCount"].asInt();
  1821. eci.bAppExamEnabled = jExamItem["appExamEnabled"].asBool();
  1822. eci.sCourseCode = jExamItem["courseCode"].asString().c_str();
  1823. eci.nCourseId = jExamItem["courseId"].asInt64();
  1824. eci.sCourseLevel = jExamItem["courseLevel"].asString().c_str();
  1825. eci.sCourseName = jExamItem["courseName"].asString().c_str();
  1826. eci.sEndTime = jExamItem["endTime"].asString().c_str();
  1827. eci.bExamCycleEnabled = jExamItem["examCycleEnabled"].asBool();
  1828. int nWeekSize = jExamItem["examCycleWeek"].size();
  1829. for(int i =0; i < nWeekSize; ++i)
  1830. {
  1831. eci.vExamCycleWeek.push_back(jExamItem["examCycleWeek"][i].asInt());
  1832. }
  1833. int nCycleTimeRangeSize = jExamItem["examCycleTimeRange"].size();
  1834. for(int i = 0; i < nCycleTimeRangeSize; ++i)
  1835. {
  1836. Json::Value jTimeRange = jExamItem["examCycleTimeRange"][i]["timeRange"];
  1837. int nTimeRangeSize = jTimeRange.size();
  1838. QStringList sTimeRangeList;
  1839. for(int j = 0; j < nTimeRangeSize; ++j)
  1840. {
  1841. sTimeRangeList<<jTimeRange[j].asString().c_str();
  1842. }
  1843. eci.sExamCycleTimeRange<<sTimeRangeList.join("~");
  1844. }
  1845. //eci.sCourseCode = jExamItem["examCycleTimeRange"].asString().c_str();
  1846. //eci.sCourseCode = jExamItem["examCycleWeek"].asString().c_str();
  1847. eci.nExamId = jExamItem["examId"].asInt64();
  1848. eci.sExamName = jExamItem["examName"].asString().c_str();
  1849. eci.sExamStatus = jExamItem["examStatus"].asString().c_str();
  1850. eci.nExamStudentId = jExamItem["examStudentId"].asInt64();
  1851. eci.bFaceCheck = jExamItem["faceCheck"].asBool();
  1852. eci.bFaceEnable = jExamItem["faceEnable"].asBool();
  1853. eci.sIdentityNumber = jExamItem["identityNumber"].asString().c_str();
  1854. eci.bIsFinished = jExamItem["isFinished"].asBool();
  1855. eci.bIsObjScoreView = jExamItem["isObjScoreView"].asBool();
  1856. eci.bIsPhotoUpload = jExamItem["isPhotoUpload"].asBool();
  1857. eci.nOrgId = jExamItem["orgId"].asInt64();
  1858. eci.sOrgName = jExamItem["orgName"].asString().c_str();
  1859. eci.nPaperMins = jExamItem["paperMins"].asInt();
  1860. eci.nRootOrgId = jExamItem["rootOrgId"].asInt64();
  1861. eci.sSpecialtyLevel = jExamItem["specialtyLevel"].asString().c_str();
  1862. eci.sSpecialtyName = jExamItem["specialtyName"].asString().c_str();
  1863. eci.sStartTime = jExamItem["startTime"].asString().c_str();
  1864. eci.sStudentCode = jExamItem["studentCode"].asString().c_str();
  1865. eci.sStudentName = jExamItem["studentName"].asString().c_str();
  1866. }
  1867. catch (const std::exception &e)
  1868. {
  1869. myServerLog()<<",exception error"<<e.what();
  1870. }
  1871. }
  1872. void CHttpBll::genQueryExamList(CQueryExamList *pQueryExamList, const std::string &sResponse)
  1873. {
  1874. try
  1875. {
  1876. Json::Reader reader;
  1877. Json::Value jsonRoot = Json::Value::null;
  1878. if (!reader.parse(sResponse, jsonRoot))
  1879. {
  1880. pQueryExamList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1881. myDebug() << pQueryExamList->sMessage << sResponse.c_str();
  1882. }
  1883. int nExamSize = jsonRoot.size();
  1884. for (int i = 0; i < nExamSize; ++i)
  1885. {
  1886. Json::Value jExamItem = jsonRoot[i];
  1887. CExamCourseInfo eci;
  1888. genExamCourseInfo(jExamItem, eci);
  1889. pQueryExamList->vOnlieExamList.push_back(eci);
  1890. }
  1891. }
  1892. catch (const std::exception &e)
  1893. {
  1894. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1895. }
  1896. }
  1897. void CHttpBll::genQueryExamEndList(CQueryExamEndList *pQueryExamEndList, const std::string &sResponse)
  1898. {
  1899. try
  1900. {
  1901. Json::Reader reader;
  1902. Json::Value jsonRoot = Json::Value::null;
  1903. if (!reader.parse(sResponse, jsonRoot))
  1904. {
  1905. pQueryExamEndList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1906. myDebug() << pQueryExamEndList->sMessage << sResponse.c_str();
  1907. }
  1908. int nExamSize = jsonRoot.size();
  1909. for (int i = 0; i < nExamSize; ++i)
  1910. {
  1911. Json::Value jExamItem = jsonRoot[i];
  1912. CExamCourseInfo eci;
  1913. genExamCourseInfo(jExamItem, eci);
  1914. pQueryExamEndList->vOnlieEndExamList.push_back(eci);
  1915. }
  1916. }
  1917. catch (const std::exception &e)
  1918. {
  1919. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1920. }
  1921. }
  1922. void CHttpBll::genQueryObjectiveScoreList(CQueryObjectiveScoreList *pQueryObjectiveScoreList, const std::string &sResponse)
  1923. {
  1924. try
  1925. {
  1926. Json::Reader reader;
  1927. Json::Value jsonRoot = Json::Value::null;
  1928. if (!reader.parse(sResponse, jsonRoot))
  1929. {
  1930. pQueryObjectiveScoreList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1931. myDebug() << pQueryObjectiveScoreList->sMessage << sResponse.c_str();
  1932. }
  1933. int nScoreSize = jsonRoot.size();
  1934. for (int i = 0; i < nScoreSize; ++i)
  1935. {
  1936. Json::Value jScore = jsonRoot[i];
  1937. CObjectiveScore os;
  1938. os.sEndTime = jScore["endTime"].asString().c_str();
  1939. os.nExamOrder = jScore["examOrder"].asInt();
  1940. os.nExamRecordDataId = jScore["examRecordDataId"].asInt64();
  1941. os.bIsAuditing = jScore["isAuditing"].asBool();
  1942. os.bIsExamEnded = jScore["isExamEnded"].asBool();
  1943. os.bIsIllegality = jScore["isIllegality"].asBool();
  1944. os.fObjectiveScore = jScore["objectiveScore"].asDouble();
  1945. os.sStartTime = jScore["startTime"].asString().c_str();
  1946. pQueryObjectiveScoreList->vObjectiveScore.push_back(os);
  1947. }
  1948. }
  1949. catch (const std::exception &e)
  1950. {
  1951. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1952. }
  1953. }
  1954. void CHttpBll::genQueryHomeworkList(CQueryHomeworkList *pQueryHomeworkList, const std::string &sResponse)
  1955. {
  1956. try
  1957. {
  1958. Json::Reader reader;
  1959. Json::Value jsonRoot = Json::Value::null;
  1960. if (!reader.parse(sResponse, jsonRoot))
  1961. {
  1962. pQueryHomeworkList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1963. myDebug() << pQueryHomeworkList->sMessage << sResponse.c_str();
  1964. }
  1965. int nExamSize = jsonRoot.size();
  1966. for (int i = 0; i < nExamSize; ++i)
  1967. {
  1968. Json::Value jExamItem = jsonRoot[i];
  1969. CExamCourseInfo eci;
  1970. genExamCourseInfo(jExamItem, eci);
  1971. pQueryHomeworkList->vHomeworkExamList.push_back(eci);
  1972. }
  1973. }
  1974. catch (const std::exception &e)
  1975. {
  1976. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  1977. }
  1978. }
  1979. void CHttpBll::genQueryPracticeCourseList(CQueryPracticeCourseList *pQueryPracticeCourseList, const std::string &sResponse)
  1980. {
  1981. try
  1982. {
  1983. Json::Reader reader;
  1984. Json::Value jsonRoot = Json::Value::null;
  1985. if (!reader.parse(sResponse, jsonRoot))
  1986. {
  1987. pQueryPracticeCourseList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  1988. myDebug() << pQueryPracticeCourseList->sMessage << sResponse.c_str();
  1989. }
  1990. int nExamSize = jsonRoot.size();
  1991. for (int i = 0; i < nExamSize; ++i)
  1992. {
  1993. Json::Value jExamItem = jsonRoot[i];
  1994. CPracticeCourseInfo pci;
  1995. pci.fAveObjectiveAccuracy = jExamItem["aveObjectiveAccuracy"].asDouble();
  1996. pci.sCourseCode = jExamItem["courseCode"].asString().c_str();
  1997. pci.sCourseName = jExamItem["courseName"].asString().c_str();
  1998. pci.sEndTime = jExamItem["endTime"].asString().c_str();
  1999. pci.bExamCycleEnabled = jExamItem["examCycleEnabled"].asBool();
  2000. //pci.sExamCycleTimeRange = jExamItem["examCycleTimeRange"].asDouble();
  2001. //pci.sExamCycleWeek = jExamItem["examCycleWeek"].asDouble();
  2002. int nWeekSize = jExamItem["examCycleWeek"].size();
  2003. for(int i = 0; i < nWeekSize; ++i)
  2004. {
  2005. pci.vExamCycleWeek.push_back(jExamItem["examCycleWeek"][i].asInt());
  2006. }
  2007. int nCycleTimeRangeSize = jExamItem["examCycleTimeRange"].size();
  2008. for(int i = 0; i < nCycleTimeRangeSize; ++i)
  2009. {
  2010. Json::Value jTimeRange = jExamItem["examCycleTimeRange"][i]["timeRange"];
  2011. int nTimeRangeSize = jTimeRange.size();
  2012. QStringList sTimeRangeList;
  2013. for(int j = 0; j < nTimeRangeSize; ++j)
  2014. {
  2015. sTimeRangeList<<jTimeRange[j].asString().c_str();
  2016. }
  2017. pci.sExamCycleTimeRange<<sTimeRangeList.join("~");
  2018. }
  2019. pci.nExamId = jExamItem["examId"].asInt64();
  2020. pci.sExamName = jExamItem["examName"].asString().c_str();
  2021. pci.nExamStudentId = jExamItem["examStudentId"].asInt64();
  2022. pci.sExamType = jExamItem["examType"].asString().c_str();
  2023. pci.fMaxObjectiveAccuracy = jExamItem["maxObjectiveAccuracy"].asDouble();
  2024. pci.nPracticeCount = jExamItem["practiceCount"].asInt();
  2025. pci.fRecentObjectiveAccuracy = jExamItem["recentObjectiveAccuracy"].asDouble();
  2026. pci.sStartTime = jExamItem["startTime"].asString().c_str();
  2027. pci.sStudentCode = jExamItem["studentCode"].asString().c_str();
  2028. pci.sStudentName = jExamItem["studentName"].asString().c_str();
  2029. pQueryPracticeCourseList->vPracticeCourseInfo.push_back(pci);
  2030. }
  2031. }
  2032. catch (const std::exception &e)
  2033. {
  2034. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2035. }
  2036. }
  2037. void CHttpBll::genQueryPracticeRecordList(CQueryPracticeRecordList *pQueryPracticeRecordList, const std::string &sResponse)
  2038. {
  2039. try
  2040. {
  2041. Json::Reader reader;
  2042. Json::Value jsonRoot = Json::Value::null;
  2043. if (!reader.parse(sResponse, jsonRoot))
  2044. {
  2045. pQueryPracticeRecordList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2046. myDebug() << pQueryPracticeRecordList->sMessage << sResponse.c_str();
  2047. }
  2048. int nSize = jsonRoot.size();
  2049. for (int i = 0; i < nSize; ++i)
  2050. {
  2051. Json::Value jPracticeItem = jsonRoot[i];
  2052. CPracticeRecord pr;
  2053. pr.sCourseCode = jPracticeItem["courseCode"].asString().c_str();
  2054. pr.sCourseName = jPracticeItem["courseName"].asString().c_str();
  2055. pr.sEndTime = jPracticeItem["endTime"].asString().c_str();
  2056. pr.sExamName = jPracticeItem["examName"].asString().c_str();
  2057. pr.nFailQuestionNum = jPracticeItem["failQuestionNum"].asInt();
  2058. pr.nId = jPracticeItem["id"].asInt64();
  2059. pr.nNotAnsweredCount = jPracticeItem["notAnsweredCount"].asInt();
  2060. pr.fObjectiveAccuracy = jPracticeItem["objectiveAccuracy"].asDouble();
  2061. pr.nObjectiveNum = jPracticeItem["objectiveNum"].asInt();
  2062. pr.sStartTime = jPracticeItem["startTime"].asString().c_str();
  2063. pr.nSuccQuestionNum = jPracticeItem["succQuestionNum"].asInt();
  2064. pr.nTotalQuestionCount = jPracticeItem["totalQuestionCount"].asInt();
  2065. pr.nUsedExamTime = jPracticeItem["usedExamTime"].asInt64();
  2066. pQueryPracticeRecordList->vPracticeRecordList.push_back(pr);
  2067. }
  2068. }
  2069. catch (const std::exception &e)
  2070. {
  2071. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2072. }
  2073. }
  2074. void CHttpBll::genGetPracticeDetailInfo(CGetPracticeDetailInfo *pGetPracticeDetailInfo, const std::string &sResponse)
  2075. {
  2076. try
  2077. {
  2078. Json::Reader reader;
  2079. Json::Value jsonRoot = Json::Value::null;
  2080. if (!reader.parse(sResponse, jsonRoot))
  2081. {
  2082. pGetPracticeDetailInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2083. myDebug() << pGetPracticeDetailInfo->sMessage << sResponse.c_str();
  2084. }
  2085. pGetPracticeDetailInfo->sCourseCode = jsonRoot["courseCode"].asString().c_str();
  2086. pGetPracticeDetailInfo->sCourseName = jsonRoot["courseName"].asString().c_str();
  2087. pGetPracticeDetailInfo->nId = jsonRoot["id"].asInt64();
  2088. pGetPracticeDetailInfo->fObjectiveAccuracy = jsonRoot["objectiveAccuracy"].asDouble();
  2089. int nSize = jsonRoot["paperStructInfos"].size();
  2090. for (int i = 0; i < nSize; ++i)
  2091. {
  2092. Json::Value jPaperStructInfo = jsonRoot["paperStructInfos"][i];
  2093. CPracticePaperStructInfo ppsi;
  2094. ppsi.nCount = jPaperStructInfo["count"].asInt();
  2095. ppsi.nFailQuestionNum = jPaperStructInfo["failQuestionNum"].asInt();
  2096. ppsi.nIndex = jPaperStructInfo["index"].asInt();
  2097. ppsi.nNotAnsweredCount = jPaperStructInfo["notAnsweredCount"].asInt();
  2098. ppsi.nQuestionCount = jPaperStructInfo["questionCount"].asInt();
  2099. ppsi.sQuestionType = jPaperStructInfo["questionType"].asString().c_str();
  2100. ppsi.sScore = jPaperStructInfo["score"].asString().c_str();
  2101. ppsi.nSuccQuestionNum = jPaperStructInfo["succQuestionNum"].asInt();
  2102. ppsi.sTitle = jPaperStructInfo["title"].asString().c_str();
  2103. ppsi.fTotalScore = jPaperStructInfo["totalScore"].asDouble();
  2104. pGetPracticeDetailInfo->vPracticePaperStructList.push_back(ppsi);
  2105. }
  2106. }
  2107. catch (const std::exception &e)
  2108. {
  2109. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2110. }
  2111. }
  2112. void CHttpBll::genFindExamRecordDataEntity(CFindExamRecordDataEntity *pFindExamRecordDataEntity, const std::string &sResponse)
  2113. {
  2114. try
  2115. {
  2116. Json::Reader reader;
  2117. Json::Value jsonRoot = Json::Value::null;
  2118. if (!reader.parse(sResponse, jsonRoot))
  2119. {
  2120. pFindExamRecordDataEntity->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2121. myDebug() << pFindExamRecordDataEntity->sMessage << sResponse.c_str();
  2122. }
  2123. pFindExamRecordDataEntity->nExamId = jsonRoot["examRecord"]["examId"].asInt64();
  2124. pFindExamRecordDataEntity->sPaperType = jsonRoot["examRecord"]["paperType"].asString().c_str();
  2125. }
  2126. catch (const std::exception &e)
  2127. {
  2128. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2129. }
  2130. }
  2131. void CHttpBll::genGetExamRecordQuestions(CGetExamRecordQuestions *pGetExamRecordQuestions, const std::string &sResponse)
  2132. {
  2133. try
  2134. {
  2135. Json::Reader reader;
  2136. Json::Value jsonRoot = Json::Value::null;
  2137. if (!reader.parse(sResponse, jsonRoot))
  2138. {
  2139. pGetExamRecordQuestions->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2140. myDebug() << pGetExamRecordQuestions->sMessage << sResponse.c_str();
  2141. }
  2142. int nSize = jsonRoot["examQuestionEntities"].size();
  2143. for (int i = 0; i < nSize; ++i)
  2144. {
  2145. Json::Value jQuestionItem = jsonRoot["examQuestionEntities"][i];
  2146. CAnsweredQuestion aq;
  2147. aq.sAnswerType = jQuestionItem["answerType"].asString().c_str();
  2148. aq.sAudioPlayTimes = jQuestionItem["audioPlayTimes"].isNull() ? "" : jQuestionItem["audioPlayTimes"].asString().c_str();
  2149. aq.sCorrectAnswer = jQuestionItem["correctAnswer"].isNull() ? "" : jQuestionItem["correctAnswer"].asString().c_str();
  2150. //aq.sExamQuestionTempId = jQuestionItem["examQuestionTempId"].asString().c_str();
  2151. aq.nExamRecordDataId = jQuestionItem["examRecordDataId"].asInt64();
  2152. aq.bIsAnswer = jQuestionItem["isAnswer"].asBool();
  2153. //aq.bIsInMongo = jQuestionItem["isInMongo"].asBool();
  2154. aq.bIsSign = jQuestionItem["isSign"].asBool();
  2155. aq.nMainNumber = jQuestionItem["mainNumber"].asInt();
  2156. int nOptionSize = jQuestionItem["optionPermutation"].size();
  2157. for (int j = 0; j < nOptionSize; ++j)
  2158. {
  2159. aq.vOptionPermutation.push_back(jQuestionItem["optionPermutation"][i].asInt());
  2160. }
  2161. aq.nOrder = jQuestionItem["order"].asInt();
  2162. aq.sQuestionId = jQuestionItem["questionId"].asString().c_str();
  2163. aq.fQuestionScore = jQuestionItem["questionScore"].asDouble();
  2164. aq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  2165. aq.sStudentAnswer = jQuestionItem["studentAnswer"].asString().c_str();
  2166. aq.fStudentScore = jQuestionItem["studentScore"].asDouble();
  2167. pGetExamRecordQuestions->vExamRecordQuestions.push_back(aq);
  2168. }
  2169. }
  2170. catch (const std::exception &e)
  2171. {
  2172. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2173. }
  2174. }
  2175. void CHttpBll::genGetOfflineCourse(CGetOfflineCourse *pGetOfflineCourse, const std::string &sResponse)
  2176. {
  2177. try
  2178. {
  2179. Json::Reader reader;
  2180. Json::Value jsonRoot = Json::Value::null;
  2181. if (!reader.parse(sResponse, jsonRoot))
  2182. {
  2183. pGetOfflineCourse->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2184. myDebug() << pGetOfflineCourse->sMessage << sResponse.c_str();
  2185. }
  2186. int nSize = jsonRoot.size();
  2187. for (int i = 0; i < nSize; ++i)
  2188. {
  2189. Json::Value jCourseInfo = jsonRoot[i];
  2190. COfflineCourseInfo oci;
  2191. oci.sCourseCode = jCourseInfo["courseCode"].asString().c_str();
  2192. oci.sCourseLevel = jCourseInfo["courseLevel"].asString().c_str();
  2193. oci.sCourseName = jCourseInfo["courseName"].asString().c_str();
  2194. oci.sEndTime = jCourseInfo["endTime"].asString().c_str();
  2195. oci.nExamId = jCourseInfo["examId"].asInt64();
  2196. oci.sExamName = jCourseInfo["examName"].asString().c_str();
  2197. oci.nExamRecordDataId = jCourseInfo["examRecordDataId"].asInt64();
  2198. oci.nExamStudentId = jCourseInfo["examStudentId"].asInt64();
  2199. oci.bIsvalid = jCourseInfo["isvalid"].asBool();
  2200. oci.sOrgName = jCourseInfo["orgName"].asString().c_str();
  2201. oci.sPaperId = jCourseInfo["paperId"].asString().c_str();
  2202. oci.sSpecialtyName = jCourseInfo["specialtyName"].asString().c_str();
  2203. oci.sStartTime = jCourseInfo["startTime"].asString().c_str();
  2204. oci.sStatus = jCourseInfo["status"].asString().c_str();
  2205. oci.sStudentCode = jCourseInfo["studentCode"].asString().c_str();
  2206. oci.sStudentName = jCourseInfo["studentName"].asString().c_str();
  2207. int nFileSize = jCourseInfo["offlineFiles"].size();
  2208. for (int j = 0; j < nFileSize; ++j)
  2209. {
  2210. Json::Value jFileItem = jCourseInfo["offlineFiles"][j];
  2211. COfflineFileInfo ofi;
  2212. ofi.nExamRecordDataId = jFileItem["examRecordDataId"].asInt64();
  2213. ofi.sFileType = jFileItem["fileType"].asString().c_str();
  2214. ofi.nId = jFileItem["id"].asInt64();
  2215. ofi.sOfflineFileName = jFileItem["offlineFileName"].asString().c_str();
  2216. ofi.sOfflineFileUrl = jFileItem["offlineFileUrl"].asString().c_str();
  2217. ofi.sOriginalFileName = jFileItem["originalFileName"].asString().c_str();
  2218. ofi.sProperties = jFileItem["properties"].asString().c_str();
  2219. ofi.sSuffix = jFileItem["suffix"].asString().c_str();
  2220. oci.vOfflineFileInfo.push_back(ofi);
  2221. }
  2222. pGetOfflineCourse->vOfflineCourseInfo.push_back(oci);
  2223. }
  2224. }
  2225. catch (const std::exception &e)
  2226. {
  2227. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2228. }
  2229. }
  2230. void CHttpBll::genGetOffLineExamAnswerSheet(CGetOffLineExamAnswerSheet *pGetOffLineExamAnswerSheet, const std::string &sResponse)
  2231. {
  2232. pGetOffLineExamAnswerSheet->sAnswerSheetUrl = sResponse.c_str();
  2233. }
  2234. void CHttpBll::genGetOffLineExamPaper(CGetOffLineExamPaper *pGetOffLineExamPaper, const std::string &sResponse)
  2235. {
  2236. }
  2237. void CHttpBll::genPreviewOffLineExamPaper(CPreviewOffLineExamPaper *pPreviewOffLineExamPaper, const std::string &sResponse)
  2238. {
  2239. pPreviewOffLineExamPaper->sUrl = sResponse.c_str();
  2240. }
  2241. void CHttpBll::genCheckExamInProgress(CCheckExamInProgress *pCheckExamInProgress, const std::string &sResponse)
  2242. {
  2243. try
  2244. {
  2245. Json::Reader reader;
  2246. Json::Value jsonRoot = Json::Value::null;
  2247. if (!reader.parse(sResponse, jsonRoot))
  2248. {
  2249. pCheckExamInProgress->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2250. myDebug() << pCheckExamInProgress->sMessage << sResponse.c_str();
  2251. }
  2252. if (jsonRoot["data"].isNull())
  2253. {
  2254. pCheckExamInProgress->bHasExamInProgress = false;
  2255. }
  2256. else
  2257. {
  2258. pCheckExamInProgress->bHasExamInProgress = true;
  2259. pCheckExamInProgress->nInterruptNum = jsonRoot["data"]["interruptNum"].asInt();
  2260. pCheckExamInProgress->nMaxInterruptNum = jsonRoot["data"]["maxInterruptNum"].asInt();
  2261. pCheckExamInProgress->bIsExceed = jsonRoot["data"]["isExceed"].asBool();
  2262. pCheckExamInProgress->nExamRecordDataId = jsonRoot["data"]["examRecordDataId"].asInt64();
  2263. pCheckExamInProgress->nExamId = jsonRoot["data"]["examId"].asInt64();
  2264. pCheckExamInProgress->nUsedTime = jsonRoot["data"]["usedTime"].asInt64();
  2265. pCheckExamInProgress->nFaceVerifyMinute = jsonRoot["data"]["faceVerifyMinute"].asInt();
  2266. pCheckExamInProgress->sExamType = jsonRoot["data"]["examType"].asString().c_str();
  2267. }
  2268. }
  2269. catch (const std::exception &e)
  2270. {
  2271. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2272. }
  2273. }
  2274. void CHttpBll::genGetCourseInfo(CGetCourseInfo *pGetCourseInfo, const std::string &sResponse)
  2275. {
  2276. try
  2277. {
  2278. Json::Reader reader;
  2279. Json::Value jsonRoot = Json::Value::null;
  2280. if (!reader.parse(sResponse, jsonRoot))
  2281. {
  2282. pGetCourseInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2283. myDebug() << pGetCourseInfo->sMessage << sResponse.c_str();
  2284. }
  2285. pGetCourseInfo->sCourseName = jsonRoot["courseName"].asString().c_str();
  2286. pGetCourseInfo->sCourseCode = jsonRoot["courseCode"].asString().c_str();
  2287. }
  2288. catch (const std::exception &e)
  2289. {
  2290. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2291. }
  2292. }
  2293. void CHttpBll::genExamHeartbeat(CExamHeartbeat *pExamHeartbeat, const std::string &sResponse)
  2294. {
  2295. pExamHeartbeat->nLeftTime = QString(sResponse.c_str()).toLongLong();
  2296. }
  2297. void CHttpBll::genFindExamQuestionList(CFindExamQuestionList *pFindExamQuestionList, const std::string &sResponse)
  2298. {
  2299. try
  2300. {
  2301. Json::Reader reader;
  2302. Json::Value jsonRoot = Json::Value::null;
  2303. if (!reader.parse(sResponse, jsonRoot))
  2304. {
  2305. pFindExamQuestionList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2306. myDebug() << pFindExamQuestionList->sMessage << sResponse.c_str();
  2307. }
  2308. int nSize = jsonRoot.size();
  2309. for (int i = 0; i < nSize; ++i)
  2310. {
  2311. Json::Value jQuestionItem = jsonRoot[i];
  2312. CAnsweredQuestion aq;
  2313. aq.sAnswerType = jQuestionItem["answerType"].asString().c_str();
  2314. aq.sAudioPlayTimes = jQuestionItem["audioPlayTimes"].isNull() ? "" :jQuestionItem["audioPlayTimes"].asString().c_str();
  2315. aq.sCorrectAnswer = jQuestionItem["correctAnswer"].isNull() ? "" : jQuestionItem["correctAnswer"].asString().c_str();
  2316. aq.sExamQuestionTempId = jQuestionItem["examQuestionTempId"].asString().c_str();
  2317. aq.nExamRecordDataId = jQuestionItem["examRecordDataId"].asInt64();
  2318. aq.bIsAnswer = jQuestionItem["isAnswer"].asBool();
  2319. aq.bIsInMongo = jQuestionItem["isInMongo"].asBool();
  2320. aq.bIsSign = jQuestionItem["isSign"].asBool();
  2321. aq.nMainNumber = jQuestionItem["mainNumber"].asInt();
  2322. int nOptionSize = jQuestionItem["optionPermutation"].size();
  2323. for (int j = 0; j < nOptionSize; ++j)
  2324. {
  2325. aq.vOptionPermutation.push_back(jQuestionItem["optionPermutation"][i].asInt());
  2326. }
  2327. aq.nOrder = jQuestionItem["order"].asInt();
  2328. aq.sQuestionId = jQuestionItem["questionId"].asString().c_str();
  2329. aq.fQuestionScore = jQuestionItem["questionScore"].asDouble();
  2330. aq.sQuestionType = jQuestionItem["questionType"].asString().c_str();
  2331. aq.sStudentAnswer = jQuestionItem["studentAnswer"].asString().c_str();
  2332. aq.fStudentScore = jQuestionItem["studentScore"].asDouble();
  2333. pFindExamQuestionList->vAnsweredQuestion.push_back(aq);
  2334. }
  2335. }
  2336. catch (const std::exception &e)
  2337. {
  2338. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2339. }
  2340. }
  2341. void CHttpBll::genGetExamRecordPaperStruct(CGetExamRecordPaperStruct *pGetExamRecordPaperStruct, const std::string &sResponse)
  2342. {
  2343. try
  2344. {
  2345. Json::Reader reader;
  2346. Json::Value jsonRoot = Json::Value::null;
  2347. if (!reader.parse(sResponse, jsonRoot))
  2348. {
  2349. pGetExamRecordPaperStruct->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2350. myDebug() << pGetExamRecordPaperStruct->sMessage << sResponse.c_str();
  2351. }
  2352. pGetExamRecordPaperStruct->sPaperId = jsonRoot["id"].asString().c_str();
  2353. pGetExamRecordPaperStruct->sPaperName = jsonRoot["defaultPaper"]["name"].asString().c_str();
  2354. pGetExamRecordPaperStruct->bFullyObjective = jsonRoot["defaultPaper"]["fullyObjective"].asBool();
  2355. int nGroupSize = jsonRoot["defaultPaper"]["questionGroupList"].size();
  2356. int nOrder = 1;
  2357. for (int i = 0; i < nGroupSize; ++i)
  2358. {
  2359. Json::Value jGroupItem = jsonRoot["defaultPaper"]["questionGroupList"][i];
  2360. CPaperGroupStruct pgs;
  2361. pgs.sGroupName = jGroupItem["groupName"].asString().c_str();
  2362. pgs.fGroupScore = jGroupItem["groupScore"].asDouble();
  2363. pgs.nNumber = i + 1;
  2364. int nQuestionSize = jGroupItem["questionWrapperList"].size();
  2365. int nShowIndex = 1;
  2366. int nTotalSubquestion = 0;
  2367. for (int j = 0; j < nQuestionSize; ++j)
  2368. {
  2369. Json::Value jQuestionItem = jGroupItem["questionWrapperList"][j];
  2370. CQuestionStruct qs;
  2371. qs.sQuestionId = jQuestionItem["questionId"].asString().c_str();
  2372. qs.sVersion = jQuestionItem["version"].asString().c_str();
  2373. qs.fQuestionScore = jQuestionItem["questionScore"].asDouble();
  2374. qs.nLimitedPlayTimes = jQuestionItem["limitedPlayTimes"].asInt();
  2375. qs.nPlayedTimes = jQuestionItem["playedTimes"].asInt();
  2376. qs.nTimeLimit = jQuestionItem["timeLimit"].asInt();
  2377. int mSubQuestionSize = jQuestionItem["questionUnitWrapperList"].size();
  2378. nTotalSubquestion += mSubQuestionSize;
  2379. for (int k = 0; k < mSubQuestionSize; ++k)
  2380. {
  2381. Json::Value jSubQuestionItem = jQuestionItem["questionUnitWrapperList"][k];
  2382. CSubQuestionStruct sqs;
  2383. sqs.sQuestionType = jSubQuestionItem["questionType"].asString().c_str();
  2384. sqs.sAnswerType = jSubQuestionItem["answerType"].asString().c_str();
  2385. sqs.fQuestionScore = jSubQuestionItem["questionScore"].asDouble();
  2386. sqs.nLimitedPlayTimes = qs.nLimitedPlayTimes;
  2387. for (int jq = 0; jq < jSubQuestionItem["optionPermutation"].size(); ++jq)
  2388. {
  2389. Json::Value Item = jSubQuestionItem["optionPermutation"][jq];
  2390. sqs.voptionPermutation.push_back(Item.asInt());
  2391. }
  2392. sqs.nShowNumber = nShowIndex;
  2393. sqs.nOrder = nOrder;
  2394. nShowIndex++;
  2395. nOrder++;
  2396. qs.vSubQuestionStruct.push_back(sqs);
  2397. }
  2398. pgs.vQuestionStruct.push_back(qs);
  2399. }
  2400. pgs.nTotalSubquestion = nTotalSubquestion;
  2401. pGetExamRecordPaperStruct->vPaperGroupStruct.push_back(pgs);
  2402. }
  2403. }
  2404. catch (const std::exception &e)
  2405. {
  2406. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2407. }
  2408. }
  2409. void CHttpBll::genGetEndExamInfo(CGetEndExamInfo *pGetEndExamInfo, const std::string &sResponse)
  2410. {
  2411. try
  2412. {
  2413. if (sResponse == "")
  2414. {
  2415. pGetEndExamInfo->bIsCalculate = true;
  2416. return;
  2417. }
  2418. Json::Reader reader;
  2419. Json::Value jsonRoot = Json::Value::null;
  2420. if (!reader.parse(sResponse, jsonRoot))
  2421. {
  2422. pGetEndExamInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2423. myDebug() << pGetEndExamInfo->sMessage << sResponse.c_str();
  2424. }
  2425. pGetEndExamInfo->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64();
  2426. pGetEndExamInfo->bIsWarn = jsonRoot["isWarn"].asBool();
  2427. pGetEndExamInfo->fObjectiveAccuracy = jsonRoot["objectiveAccuracy"].asDouble();
  2428. pGetEndExamInfo->fObjectiveScore = jsonRoot["objectiveScore"].asInt64();
  2429. }
  2430. catch (const std::exception &e)
  2431. {
  2432. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2433. }
  2434. }
  2435. void CHttpBll::genGetWXQrCode(CGetWXQrCode *pGetWXQrCode, const std::string &sResponse)
  2436. {
  2437. pGetWXQrCode->sUrl = sResponse.c_str();
  2438. }
  2439. //void CHttpBll::genProcessUpload(CProcessUpload *pProcessUpload, const std::string &sResponse)
  2440. //{
  2441. // try
  2442. // {
  2443. // Json::Reader reader;
  2444. // Json::Value jsonRoot = Json::Value::null;
  2445. // if (!reader.parse(sResponse, jsonRoot))
  2446. // {
  2447. // pProcessUpload->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2448. // myDebug() << pProcessUpload->sMessage << sResponse.c_str();
  2449. // }
  2450. // pProcessUpload->sFileUrl = jsonRoot["fileUrl"].asString().c_str();
  2451. // }
  2452. // catch (const std::exception &e)
  2453. // {
  2454. // myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2455. // }
  2456. //}
  2457. void CHttpBll::genGetOrgPropertiesByGroupWithoutCache(CGetOrgPropertiesByGroupWithoutCache *pOrgProperties, const std::string &sResponse)
  2458. {
  2459. try
  2460. {
  2461. Json::Reader reader;
  2462. Json::Value jsonRoot = Json::Value::null;
  2463. if (!reader.parse(sResponse, jsonRoot))
  2464. {
  2465. pOrgProperties->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2466. myDebug() << pOrgProperties->sMessage << sResponse.c_str();
  2467. }
  2468. pOrgProperties->nActionNum = QVariant(jsonRoot["ACTION_NUM"].asString().c_str()).toInt();
  2469. pOrgProperties->sActionOptions = jsonRoot["ACTION_OPTIONS"].asString().c_str();
  2470. pOrgProperties->sActionOrder = jsonRoot["ACTION_ORDER"].asString().c_str();
  2471. pOrgProperties->nActionDuration = QVariant(jsonRoot["ACTION_DURATION"].asString().c_str()).toInt();
  2472. pOrgProperties->nActionAlert = QVariant(jsonRoot["ACTION_ALERT"].asString().c_str()).toInt();
  2473. pOrgProperties->nAllActionDuration = QVariant(jsonRoot["ALL_ACTION_DURATION"].asString().c_str()).toInt();
  2474. if(jsonRoot.isMember("PC_CLIENT_FACE_THRESHOLD") && jsonRoot["PC_CLIENT_FACE_THRESHOLD"] != Json::Value::null)
  2475. {
  2476. pOrgProperties->nFaceThreshold = QVariant(jsonRoot["PC_CLIENT_FACE_THRESHOLD"].asString().c_str()).toInt();
  2477. }
  2478. }
  2479. catch (const std::exception &e)
  2480. {
  2481. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2482. }
  2483. }
  2484. void CHttpBll::genStartFaceLiveVerify(CStartFaceLiveVerify *pStartFaceLiveVerify, const std::string &sResponse)
  2485. {
  2486. try
  2487. {
  2488. Json::Reader reader;
  2489. Json::Value jsonRoot = Json::Value::null;
  2490. if (!reader.parse(sResponse, jsonRoot))
  2491. {
  2492. pStartFaceLiveVerify->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2493. myDebug() << pStartFaceLiveVerify->sMessage << sResponse.c_str();
  2494. }
  2495. pStartFaceLiveVerify->nFaceLiveVerifyId = jsonRoot["faceLiveVerifyId"].asInt64();
  2496. pStartFaceLiveVerify->nStartMinute = jsonRoot["startMinute"].asInt();
  2497. pStartFaceLiveVerify->nTimes = jsonRoot["times"].asInt();
  2498. }
  2499. catch (const std::exception &e)
  2500. {
  2501. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2502. }
  2503. }
  2504. void CHttpBll::genClientExamProcessUploadSign(CClientExamProcessUploadSign *pClientExamProcessUploadSign, const std::string &sResponse)
  2505. {
  2506. try
  2507. {
  2508. Json::Reader reader;
  2509. Json::Value jsonRoot = Json::Value::null;
  2510. if (!reader.parse(sResponse, jsonRoot))
  2511. {
  2512. pClientExamProcessUploadSign->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2513. myDebug() << pClientExamProcessUploadSign->sMessage << sResponse.c_str();
  2514. }
  2515. pClientExamProcessUploadSign->sType = jsonRoot["fsType"].asString().c_str();
  2516. pClientExamProcessUploadSign->sAccessUrl = jsonRoot["accessUrl"].asString().c_str();
  2517. pClientExamProcessUploadSign->sSignIdentifier = jsonRoot["signIdentifier"].asString().c_str();
  2518. pClientExamProcessUploadSign->sFormUrl = jsonRoot["formUrl"].asString().c_str();
  2519. pClientExamProcessUploadSign->sOssAcessKeyId = jsonRoot["formParams"]["OSSAccessKeyId"].asString().c_str();
  2520. pClientExamProcessUploadSign->sSignature = jsonRoot["formParams"]["Signature"].asString().c_str();
  2521. pClientExamProcessUploadSign->sKey = jsonRoot["formParams"]["key"].asString().c_str();
  2522. pClientExamProcessUploadSign->sPolicy = jsonRoot["formParams"]["policy"].asString().c_str();
  2523. }
  2524. catch (const std::exception &e)
  2525. {
  2526. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2527. }
  2528. }
  2529. void CHttpBll::genSkipFaceCheckParam(CSkipFaceCheckParam *pSkipFaceCheckParam, const std::string &sResponse)
  2530. {
  2531. try
  2532. {
  2533. pSkipFaceCheckParam->bSkipFaceCheck = QVariant(sResponse.c_str()).toBool();
  2534. }
  2535. catch (const std::exception &e)
  2536. {
  2537. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2538. }
  2539. }
  2540. void CHttpBll::genGetWXUploadedFile(CGetWXUploadedFile *pGetWXUploadedFile, const std::string &sResponse)
  2541. {
  2542. try
  2543. {
  2544. Json::Reader reader;
  2545. Json::Value jsonRoot = Json::Value::null;
  2546. if (!reader.parse(sResponse, jsonRoot))
  2547. {
  2548. pGetWXUploadedFile->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!");
  2549. myDebug() << pGetWXUploadedFile->sMessage << sResponse.c_str();
  2550. }
  2551. pGetWXUploadedFile->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64();
  2552. pGetWXUploadedFile->nQuestionOrder = jsonRoot["questionOrder"].asInt();
  2553. pGetWXUploadedFile->sFilePath = jsonRoot["filePath"].asString().c_str();
  2554. pGetWXUploadedFile->sStatus = jsonRoot["status"].asString().c_str();
  2555. pGetWXUploadedFile->sTransferFileType = jsonRoot["transferFileType"].asString().c_str();
  2556. }
  2557. catch (const std::exception &e)
  2558. {
  2559. myServerLog()<<sResponse.c_str()<<",exception error"<<e.what();
  2560. }
  2561. }