#include "CHttpBll.h" #include #include #include "logproc.h" std::shared_ptr g_httpBllPtr = nullptr; CHttpBll::CHttpBll() { sKey = ""; sToken = ""; } QString CHttpBll::getAuthorization(QString sUri, QString sTimeStamp) { if(sToken != "") { QString sAuthorization = "post&" + sUri + "&" + sTimeStamp + "&" + sToken; QByteArray sha1 = QCryptographicHash::hash(sAuthorization.toLatin1(), QCryptographicHash::Sha1); QByteArray shaResult = sha1; sAuthorization = "Token " + sKey + ":" + shaResult.toBase64().data(); return sAuthorization; // return sAccessToken; } return ""; } QString CHttpBll::getToken() { return sToken; } QString CHttpBll::getKey() { return sKey; } void CHttpBll::requestProc(CHttpRequestPackage requestPkg) { // QString sTimeStamp = QString::number(g_AppInfo->timestamp()); // requestPkg.sHeadList.push_back(QString::fromLocal8Bit("platform,%1").arg("WEB")); // requestPkg.sHeadList.push_back(QString::fromLocal8Bit("deviceId,%1").arg(g_AppInfo->sMachineId)); // requestPkg.sHeadList.push_back(QString::fromLocal8Bit("time,%1").arg(sTimeStamp)); requestPkg.sHeadList.push_back(QString::fromLocal8Bit("Referer,%1").arg(requestPkg.sUri)); 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")); if(sToken != "") { requestPkg.sHeadList.push_back(QString::fromLocal8Bit("key,%1").arg(sKey)); requestPkg.sHeadList.push_back(QString::fromLocal8Bit("token,%1").arg(sToken)); // requestPkg.sHeadList.push_back(QString::fromLocal8Bit("Authorization,%1").arg(getAuthorization(requestPkg.sUri, sTimeStamp))); } __int64 nStartTime = g_appInfoPtr->serverMTime(); initHeads(requestPkg); QString sErrorMsg = ""; std::string sResponse = ""; int nCode = 0; if (requestPkg.nHttpType == HttpType::htDownload) { requestPkg.sUri = requestPkg.sUri.replace("\\", "/"); if (!downLoadFile(requestPkg.sUri.toLocal8Bit().data(), requestPkg.sCommonStr.toLocal8Bit().data(), nCode)) { --requestPkg.nRetryCount; if(requestPkg.nRetryCount > 0) { downLoad(requestPkg); return; } sErrorMsg = QString::fromLocal8Bit("%1下载失败!").arg(requestPkg.sUri); } } if(requestPkg.nHttpType == HttpType::htPost) { if(!doPost(requestPkg, sResponse, nCode)) { --requestPkg.nRetryCount; if(requestPkg.nRetryCount > 0) { post(requestPkg); return; } sErrorMsg = QString::fromLocal8Bit("接口%1调用失败!").arg(requestPkg.sUri); } } else if(requestPkg.nHttpType == HttpType::htGet || requestPkg.nHttpType == HttpType::htGetUrl) { if(!doGet(requestPkg, sResponse, nCode)) { --requestPkg.nRetryCount; if(requestPkg.nRetryCount > 0) { get(requestPkg); return; } sErrorMsg = QString::fromLocal8Bit("接口%1调用失败!").arg(requestPkg.sUri); } } else if (requestPkg.nHttpType == HttpType::htPut) { if (!doPut(requestPkg, sResponse, nCode)) { --requestPkg.nRetryCount; if(requestPkg.nRetryCount > 0) { put(requestPkg); return; } sErrorMsg = QString::fromLocal8Bit("接口%1调用失败!").arg(requestPkg.sUri); } } __int64 nEndTime = g_appInfoPtr->serverMTime(); myServerLog()<< requestPkg.sUri << ":resCode," << nCode<<"response:"<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pUpgrade->sMessage << sResponse.c_str(); } pUpgrade->sVersion = jsonRoot["version"].asString().c_str(); pUpgrade->nBuild = jsonRoot["build"].asInt(); pUpgrade->sContent = jsonRoot["content"].asString().c_str(); pUpgrade->bForce = jsonRoot["force"].asBool(); pUpgrade->sUpgradeUrl = jsonRoot["downUrl"].asString().c_str(); } catch (const std::exception &e) { myServerLog()< 3 && sResponse[0] == -17 && sResponse[1] == -69 && sResponse[2] == -65) { sRes = sResponse.substr(3, sResponse.length() -3); } Json::Reader reader; Json::Value jsonRoot = Json::Value::null; if(!reader.parse(sRes, jsonRoot)) { pAgreement->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pAgreement->sMessage << sResponse.c_str(); } pAgreement->sTitle = jsonRoot["title"].asString().c_str(); pAgreement->nStaySeconds = jsonRoot["staySeconds"].asInt(); pAgreement->sContent = jsonRoot["content"].toStyledString().c_str(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pStudentClientConfig->sMessage << sResponse.c_str(); } pStudentClientConfig->sCusMenuLogoFileUrl = jsonRoot["CUS_MENU_LOGO_FILE_URL"].asString().c_str(); pStudentClientConfig->sIdentityNumberLoginAlias = jsonRoot["IDENTITY_NUMBER_LOGIN_ALIAS"].asString().c_str(); pStudentClientConfig->bIsCustomMenuLogo = QVariant(jsonRoot["IS_CUSTOM_MENU_LOGO"].asString().c_str()).toBool(); QString loginType = jsonRoot["LOGIN_TYPE"].asString().c_str(); QStringList ltList = loginType.split(","); for (QString sType : ltList) { if (sType == "STUDENT_CODE") { pStudentClientConfig->bStudentCodeLogin = true; } else if (sType == "IDENTITY_NUMBER") { pStudentClientConfig->bIdentifyNumberLogin = true; } } pStudentClientConfig->sLogoFileUrl = jsonRoot["LOGO_FILE_URL"].asString().c_str(); pStudentClientConfig->sStudentClientBgPictureUrl = jsonRoot["STUDENT_CLIENT_BG_PICTURE_URL"].asString().c_str(); pStudentClientConfig->sOeStudentSysName = jsonRoot["OE_STUDENT_SYS_NAME"].asString().c_str(); QString preventCheating = jsonRoot["PREVENT_CHEATING_CONFIG"].asString().c_str(); QStringList pcList = preventCheating.split(","); for (QString sType : pcList) { if (sType == "DISABLE_REMOTE_ASSISTANCE") { pStudentClientConfig->bDisableRemoteAssistance = true; } else if (sType == "FULL_SCREEN_TOP") { pStudentClientConfig->bFullScreenTop = true; } else if (sType == "DISABLE_MULTISCREEN") { pStudentClientConfig->bDisableMutiScreen = true; } else if (sType == "DISABLE_VIRTUAL_CAMERA") { pStudentClientConfig->bDisableVirtualCamera = true; } else if (sType == "DISABLE_VIRTUAL_MACHINE") { pStudentClientConfig->bDisableVirtualMachine = true; } else if(sType == "EXAMING_BLACK_LIST_CHECK") { pStudentClientConfig->bExamingBlackListCheck = true; } } pStudentClientConfig->sRootOrgId = jsonRoot["ROOT_ORG_ID"].asString().c_str();// " : "0", pStudentClientConfig->bShowQmthLogo = QVariant(jsonRoot["SHOW_QMTH_LOGO"].asString().c_str()).toBool();// " : "false", pStudentClientConfig->bShowStudentClientAppQrcode = QVariant(jsonRoot["SHOW_STUDENT_CLIENT_APP_QRCODE"].asString().c_str()).toBool();// " : "true", pStudentClientConfig->sStudentCodeLoginAlias = jsonRoot["STUDENT_CODE_LOGIN_ALIAS"].asString().c_str(); // " : "学号登录34s" if (jsonRoot.isMember("SHOW_INFO")) { QString sShowInfo = jsonRoot["SHOW_INFO"].asString().c_str(); pStudentClientConfig->bShowStudentName = sShowInfo.indexOf("STU_NAME") >= 0; pStudentClientConfig->bShowStudentCode = sShowInfo.indexOf("STU_CODE") >= 0; pStudentClientConfig->bShowStudentIdentity = sShowInfo.indexOf("IDENTITY_NUMBER") >= 0; } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pSysNotice->sMessage << sResponse.c_str(); } pSysNotice->nId = jsonRoot["id"].asInt64(); pSysNotice->nRootOrgId = jsonRoot["rootOrgId"].asInt64(); pSysNotice->sContent = jsonRoot["content"].asString().c_str(); pSysNotice->sStartTime = jsonRoot["startTime"].asString().c_str(); pSysNotice->sEndTime = jsonRoot["endTime"].asString().c_str(); pSysNotice->sTitle = jsonRoot["title"].asString().c_str(); pSysNotice->bEnable = jsonRoot["enable"].asBool(); } catch (const std::exception &e) { myServerLog()<sSoftwareConfig = std::string(sResponse.rbegin()+32, sResponse.rend()).c_str(); } } void CHttpBll::genLoginLimit(CLoginLimit *pLoginLimit, const std::string &sResponse) { try { Json::Reader reader; Json::Value jsonRoot = Json::Value::null; if (!reader.parse(sResponse, jsonRoot)) { pLoginLimit->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pLoginLimit->sMessage << sResponse.c_str(); } pLoginLimit->nCount = jsonRoot["count"].asInt64(); pLoginLimit->bPass = jsonRoot["pass"].asBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pLoginInfo->sMessage << sResponse.c_str(); } // pLoginInfo->nCode = jsonRoot["code"].asInt(); if (jsonRoot["code"].asString() != "200") { pLoginInfo->nCode = 0; } pLoginInfo->sMessage = jsonRoot["desc"].asString().c_str(); sKey = jsonRoot["content"]["key"].asString().c_str(); sToken = jsonRoot["content"]["token"].asString().c_str(); pLoginInfo->sUserType = jsonRoot["content"]["userType"].asString().c_str(); pLoginInfo->nUserId = jsonRoot["content"]["userId"].asInt64(); pLoginInfo->sDisplayName = jsonRoot["content"]["displayName"].asString().c_str(); pLoginInfo->nRootOrgId = jsonRoot["content"]["rootOrgId"].asInt64(); pLoginInfo->sRootOrgName = jsonRoot["content"]["rootOrgName"].asString().c_str(); pLoginInfo->sCreationTime = jsonRoot["content"]["creationTime"].asString().c_str(); pLoginInfo->sClientIp = jsonRoot["content"]["clientIp"].asString().c_str(); pLoginInfo->nSessionTimeout = jsonRoot["content"]["sessionTimeout"].asInt64(); pLoginInfo->bPasswordWeak = jsonRoot["content"]["passwordWeak"].asBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetStudentClientMenu->sMessage << sResponse.c_str(); } int nSize = jsonRoot.size(); for (int i = 0; i < nSize; ++i) { Json::Value jMenuItem = jsonRoot[i]; CStudentClientMenu scm; scm.nId = jMenuItem["id"].asInt64(); scm.sCode = jMenuItem["code"].asString().c_str(); scm.sName = jMenuItem["name"].asString().c_str(); pGetStudentClientMenu->vMenus.push_back(scm); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetStudentInfoBySession->sMessage << sResponse.c_str(); } pGetStudentInfoBySession->nId = jsonRoot["id"].asInt64(); pGetStudentInfoBySession->sName = jsonRoot["name"].asString().c_str(); pGetStudentInfoBySession->nOrgId = jsonRoot["orgId"].asInt64(); pGetStudentInfoBySession->sOrgCode = jsonRoot["orgCode"].asString().c_str(); pGetStudentInfoBySession->sOrgName = jsonRoot["orgName"].asString().c_str(); QString sStudentCode = ""; int nSize = jsonRoot["studentCodeList"].size(); for (int i = 0; i < nSize; ++i) { if (sStudentCode.isEmpty()) { sStudentCode = jsonRoot["studentCodeList"][i].asString().c_str(); } else { sStudentCode = sStudentCode + "," + jsonRoot["studentCodeList"][i].asString().c_str(); } } pGetStudentInfoBySession->sStudentCode = sStudentCode; pGetStudentInfoBySession->sIdentityNumber = jsonRoot["identityNumber"].asString().c_str(); pGetStudentInfoBySession->sPhotoPath = jsonRoot["photoPath"].asString().c_str(); pGetStudentInfoBySession->bEnable = jsonRoot["enable"].asBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pSpecialtyNameList->sMessage << sResponse.c_str(); } QString sSpecialtyName = ""; int nSize = jsonRoot.size(); for (int i = 0; i < nSize; ++i) { if (sSpecialtyName.isEmpty()) { sSpecialtyName = jsonRoot[i].asString().c_str(); } else { sSpecialtyName = sSpecialtyName + "," + jsonRoot[i].asString().c_str(); } } pSpecialtyNameList->sSpecialtyName = sSpecialtyName; } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetUserNoticeList->sMessage << sResponse.c_str(); } int nSize = jsonRoot.size(); for (int i = 0; i < nSize; ++i) { Json::Value jNoticeItem = jsonRoot[i]; CNoticeInfo ni; ni.nId = jNoticeItem["id"].asInt64(); ni.sTitle = jNoticeItem["title"].asString().c_str(); ni.sContent = jNoticeItem["content"].asString().c_str(); ni.sPublisher = jNoticeItem["publisher"].asString().c_str(); ni.sPublishTime = jNoticeItem["publishTime"].asString().c_str(); ni.bHasRead = jNoticeItem["hasRead"].asBool(); ni.bHasRecalled = jNoticeItem["hasRecalled"].isNull() ? false : jNoticeItem["hasRecalled"].asBool(); pGetUserNoticeList->vNoticeList.push_back(ni); } } catch (const std::exception &e) { myServerLog()<sUrl = sResponse.c_str(); } void CHttpBll::genAppEnabled(CAppEnabled *pAppEnabled, const std::string &sResponse) { try { pAppEnabled->bEnable = QVariant(sResponse.c_str()).toBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pQueryBatchList->sMessage << sResponse.c_str(); } int nSize = jsonRoot.size(); for (int i = 0; i < nSize; ++i) { Json::Value jBatchItem = jsonRoot[i]; CBatchInfo bi; bi.nId = jBatchItem["id"].asInt64(); bi.sName = jBatchItem["name"].asString().c_str(); bi.sExamType = jBatchItem["examType"].asString().c_str(); pQueryBatchList->vBatchList.push_back(bi); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetExamProperty->sMessage << sResponse.c_str(); } if (jsonRoot.isMember("BEFORE_EXAM_REMARK") && jsonRoot["BEFORE_EXAM_REMARK"] != Json::Value::null) { pGetExamProperty->sBeforeExamRemark = jsonRoot["BEFORE_EXAM_REMARK"].asString().c_str(); } if (jsonRoot.isMember("CHECK_ENVIRONMENT") && jsonRoot["CHECK_ENVIRONMENT"] != Json::Value::null) { pGetExamProperty->bCheckEnvironment = QVariant(jsonRoot["CHECK_ENVIRONMENT"].asString().c_str()).toBool(); } // if (jsonRoot.isMember("PC_CLIENT_FACE_THRESHOLD")) // { // pGetExamProperty->nFaceThreshold = QVariant(jsonRoot["PC_CLIENT_FACE_THRESHOLD"].asString().c_str()).toInt(); // } if (jsonRoot.isMember("IS_FACE_CHECK") && jsonRoot["IS_FACE_CHECK"] != Json::Value::null) { pGetExamProperty->bIsFaceCheck = QVariant(jsonRoot["IS_FACE_CHECK"].asString().c_str()).toBool(); } if (jsonRoot.isMember("SNAPSHOT_INTERVAL") && jsonRoot["SNAPSHOT_INTERVAL"] != Json::Value::null) { pGetExamProperty->nSnapshotInterval = QVariant(jsonRoot["SNAPSHOT_INTERVAL"].asString().c_str()).toInt(); } if (jsonRoot.isMember("FACE_VERIFY_START_MINUTE") && jsonRoot["FACE_VERIFY_START_MINUTE"] != Json::Value::null) { pGetExamProperty->nFaceVerifyStartMinute = QVariant(jsonRoot["FACE_VERIFY_START_MINUTE"].asString().c_str()).toInt(); } if (jsonRoot.isMember("FACE_VERIFY_END_MINUTE") && jsonRoot["FACE_VERIFY_END_MINUTE"] != Json::Value::null) { pGetExamProperty->nFaceVerifyEndMinute = QVariant(jsonRoot["FACE_VERIFY_END_MINUTE"].asString().c_str()).toInt(); } if (jsonRoot.isMember("IS_STRANGER_ENABLE") && jsonRoot["IS_STRANGER_ENABLE"] != Json::Value::null) { pGetExamProperty->bIsStrangerEnable = QVariant(jsonRoot["IS_STRANGER_ENABLE"].asString().c_str()).toBool(); } if (jsonRoot.isMember("PRACTICE_TYPE") && jsonRoot["PRACTICE_TYPE"] != Json::Value::null) { pGetExamProperty->sPracticeType = jsonRoot["PRACTICE_TYPE"].asString().c_str(); } if (jsonRoot.isMember("FREEZE_TIME") && jsonRoot["FREEZE_TIME"] != Json::Value::null) { pGetExamProperty->nFreezeTime = QVariant(jsonRoot["FREEZE_TIME"].asString().c_str()).toInt(); } if (jsonRoot.isMember("AFTER_EXAM_REMARK") && jsonRoot["AFTER_EXAM_REMARK"] != Json::Value::null) { pGetExamProperty->sAfterExamRemark = jsonRoot["AFTER_EXAM_REMARK"].asString().c_str(); } if (jsonRoot.isMember("IS_OBJ_SCORE_VIEW") && jsonRoot["IS_OBJ_SCORE_VIEW"] != Json::Value::null) { pGetExamProperty->bIsObjScoreView = QVariant(jsonRoot["IS_OBJ_SCORE_VIEW"].asString().c_str()).toBool(); } if (jsonRoot.isMember("SHOW_CHEATING_REMARK") && jsonRoot["SHOW_CHEATING_REMARK"] != Json::Value::null) { pGetExamProperty->bShowCheatingRemark = QVariant(jsonRoot["SHOW_CHEATING_REMARK"].asString().c_str()).toBool(); } if (jsonRoot.isMember("CHEATING_REMARK") && jsonRoot["CHEATING_REMARK"] != Json::Value::null) { pGetExamProperty->sCheatingRemark = jsonRoot["CHEATING_REMARK"].asString().c_str(); } if (jsonRoot.isMember("IS_FACE_VERIFY_BEFORE") && jsonRoot["IS_FACE_VERIFY_BEFORE"] != Json::Value::null) { pGetExamProperty->bIsLivenessBefore = QVariant(jsonRoot["IS_FACE_VERIFY_BEFORE"].asString().c_str()).toBool(); } if (jsonRoot.isMember("OFFLINE_UPLOAD_FILE_TYPE")) { QString sFileType = jsonRoot["OFFLINE_UPLOAD_FILE_TYPE"].asString().c_str(); Json::Reader reader; Json::Value jFileType = Json::Value::null; if (!reader.parse(sFileType.toStdString(), jFileType)) { pGetExamProperty->sMessage = QString::fromLocal8Bit("解析文件类型异常!"); pGetExamProperty->nCode = 0; } int nSize = jFileType.size(); for (int i = 0; i < nSize; ++i) { pGetExamProperty->vOfflineUploadFileType.push_back(jFileType[i].asString().c_str()); } } if(jsonRoot.isMember("FACE_VERIFY_FORCE_EXIT") && jsonRoot["FACE_VERIFY_FORCE_EXIT"] != Json::Value::null) { pGetExamProperty->bFaceVerifyForceExit = QVariant(jsonRoot["FACE_VERIFY_FORCE_EXIT"].asString().c_str()).toBool(); } if(jsonRoot.isMember("SHOW_MULTIPLE_CHOICE_WARNING") && jsonRoot["SHOW_MULTIPLE_CHOICE_WARNING"] != Json::Value::null) { pGetExamProperty->bMutipleAnserCountTips = QVariant(jsonRoot["SHOW_MULTIPLE_CHOICE_WARNING"].asString().c_str()).toBool(); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pStartExamLimit->sMessage << sResponse.c_str(); } pStartExamLimit->nCount = jsonRoot["count"].asInt(); pStartExamLimit->bPass = jsonRoot["pass"].asBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pIpLimit->sMessage << sResponse.c_str(); } pIpLimit->bLimited = jsonRoot["limited"].asBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pStartExam->sMessage << sResponse.c_str(); } pStartExam->sCourseCode = jsonRoot["courseCode"].asString().c_str(); pStartExam->sCourseName = jsonRoot["courseName"].asString().c_str(); pStartExam->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64(); pStartExam->nFaceVerifyMinute = jsonRoot["faceVerifyMinute"].asInt(); pStartExam->sStudentCode = jsonRoot["studentCode"].asString().c_str(); pStartExam->sStudentName = jsonRoot["studentName"].asString().c_str(); } catch (const std::exception &e) { myServerLog()<bEnabled = QVariant(sResponse.c_str()).toBool(); } catch (const std::exception &e) { myServerLog()<bEnabled = QVariant(sResponse.c_str()).toBool(); } catch (const std::exception &e) { myServerLog()<bEnabled = QVariant(sResponse.c_str()).toBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetExamById->sMessage << sResponse.c_str(); } pGetExamById->nId = jsonRoot["id"].asInt64(); pGetExamById->sCode = jsonRoot["code"].asString().c_str(); pGetExamById->nRootOrgId = jsonRoot["rootOrgId"].asInt64(); pGetExamById->sBeginTime = jsonRoot["beginTime"].asString().c_str(); pGetExamById->sEndTime = jsonRoot["endTime"].asString().c_str(); pGetExamById->sName = jsonRoot["name"].asString().c_str(); pGetExamById->sExamType = jsonRoot["examType"].asString().c_str(); pGetExamById->nDuration = jsonRoot["duration"].asInt64(); pGetExamById->bEnable = jsonRoot["enable"].asBool(); pGetExamById->bStarted = jsonRoot["started"].asBool(); pGetExamById->bIpLimitSettingsEnabled = jsonRoot["ipLimitSettingsEnabled"].asBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pStartAnswer->sMessage << sResponse.c_str(); } pStartAnswer->nDuration = jsonRoot["duration"].asInt64(); pStartAnswer->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64(); pStartAnswer->nUsedExamSeconds = jsonRoot["usedExamSeconds"].asInt64(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetQuestion->sMessage << sResponse.c_str(); } pGetQuestion->sId = jsonRoot["id"].asString().c_str(); pGetQuestion->sBody = jsonRoot["masterVersion"]["body"].isNull() ? "" : jsonRoot["masterVersion"]["body"].asString().c_str(); pGetQuestion->sVersion = jsonRoot["masterVersion"]["version"].asString().c_str(); pGetQuestion->bhasAudios = jsonRoot["masterVersion"]["hasAudios"].asBool(); int nSize = jsonRoot["masterVersion"]["questionUnitList"].size(); for (int i = 0; i < nSize; ++i) { Json::Value jQuestionItem = jsonRoot["masterVersion"]["questionUnitList"][i]; CSubQuestion sq; sq.sQuestionType = jQuestionItem["questionType"].asString().c_str(); sq.sBody = jQuestionItem["body"].asString().c_str(); //sq.sQuestionType = jQuestionItem["questionType"].asString().c_str(); int nOptionSize = jQuestionItem["questionOptionList"].size(); for (int j = 0; j < nOptionSize; ++j) { Json::Value jOption = jQuestionItem["questionOptionList"][j]; COption o; o.sBody = jOption["body"].asString().c_str(); sq.vOptions.push_back(o); } int nAnswerSize = jQuestionItem["rightAnswer"].size(); for (int k = 0; k < nAnswerSize; ++k) { Json::Value jAnswer = jQuestionItem["rightAnswer"][k]; sq.vRightAnswer.push_back(jAnswer.asString().c_str()); } pGetQuestion->vSubQuestion.push_back(sq); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetQuestionContent->sMessage << sResponse.c_str(); } pGetQuestionContent->sBody = jsonRoot["body"].isNull() ? "" : jsonRoot["body"].asString().c_str(); pGetQuestionContent->sVersion = jsonRoot["version"].asString().c_str(); pGetQuestionContent->bhasAudios = jsonRoot["hasAudios"].asBool(); int nSize = jsonRoot["questionUnitList"].size(); for (int i = 0; i < nSize; ++i) { Json::Value jQuestionItem = jsonRoot["questionUnitList"][i]; CSubQuestion sq; sq.sQuestionType = jQuestionItem["questionType"].asString().c_str(); sq.sBody = jQuestionItem["body"].asString().c_str(); sq.sAnswerType = jQuestionItem["answerType"].asString().c_str(); int nOptionSize = jQuestionItem["questionOptionList"].size(); for (int j = 0; j < nOptionSize; ++j) { Json::Value jOption = jQuestionItem["questionOptionList"][j]; COption o; o.sBody = jOption["body"].asString().c_str(); sq.vOptions.push_back(o); } for (int jq = 0; jq < jQuestionItem["optionPermutation"].size(); ++jq) { Json::Value Item = jQuestionItem["optionPermutation"][jq]; sq.voptionPermutation.push_back(Item.asInt()); } int nAnswerSize = jQuestionItem["rightAnswer"].size(); for (int k = 0; k < nAnswerSize; ++k) { Json::Value jAnswer = jQuestionItem["rightAnswer"][k]; sq.vRightAnswer.push_back(jAnswer.asString().c_str()); } pGetQuestionContent->vSubQuestion.push_back(sq); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pQueryExamList->sMessage << sResponse.c_str(); } int nExamSize = jsonRoot.size(); for (int i = 0; i < nExamSize; ++i) { Json::Value jExamItem = jsonRoot[i]; CExamCourseInfo eci; genExamCourseInfo(jExamItem, eci); pQueryExamList->vOnlieExamList.push_back(eci); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pQueryExamEndList->sMessage << sResponse.c_str(); } int nExamSize = jsonRoot.size(); for (int i = 0; i < nExamSize; ++i) { Json::Value jExamItem = jsonRoot[i]; CExamCourseInfo eci; genExamCourseInfo(jExamItem, eci); pQueryExamEndList->vOnlieEndExamList.push_back(eci); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pQueryObjectiveScoreList->sMessage << sResponse.c_str(); } int nScoreSize = jsonRoot.size(); for (int i = 0; i < nScoreSize; ++i) { Json::Value jScore = jsonRoot[i]; CObjectiveScore os; os.sEndTime = jScore["endTime"].asString().c_str(); os.nExamOrder = jScore["examOrder"].asInt(); os.nExamRecordDataId = jScore["examRecordDataId"].asInt64(); os.bIsAuditing = jScore["isAuditing"].asBool(); os.bIsExamEnded = jScore["isExamEnded"].asBool(); os.bIsIllegality = jScore["isIllegality"].asBool(); os.fObjectiveScore = jScore["objectiveScore"].asDouble(); os.sStartTime = jScore["startTime"].asString().c_str(); pQueryObjectiveScoreList->vObjectiveScore.push_back(os); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pQueryHomeworkList->sMessage << sResponse.c_str(); } int nExamSize = jsonRoot.size(); for (int i = 0; i < nExamSize; ++i) { Json::Value jExamItem = jsonRoot[i]; CExamCourseInfo eci; genExamCourseInfo(jExamItem, eci); pQueryHomeworkList->vHomeworkExamList.push_back(eci); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pQueryPracticeCourseList->sMessage << sResponse.c_str(); } int nExamSize = jsonRoot.size(); for (int i = 0; i < nExamSize; ++i) { Json::Value jExamItem = jsonRoot[i]; CPracticeCourseInfo pci; pci.fAveObjectiveAccuracy = jExamItem["aveObjectiveAccuracy"].asDouble(); pci.sCourseCode = jExamItem["courseCode"].asString().c_str(); pci.sCourseName = jExamItem["courseName"].asString().c_str(); pci.sEndTime = jExamItem["endTime"].asString().c_str(); pci.bExamCycleEnabled = jExamItem["examCycleEnabled"].asBool(); //pci.sExamCycleTimeRange = jExamItem["examCycleTimeRange"].asDouble(); //pci.sExamCycleWeek = jExamItem["examCycleWeek"].asDouble(); int nWeekSize = jExamItem["examCycleWeek"].size(); for(int i = 0; i < nWeekSize; ++i) { pci.vExamCycleWeek.push_back(jExamItem["examCycleWeek"][i].asInt()); } int nCycleTimeRangeSize = jExamItem["examCycleTimeRange"].size(); for(int i = 0; i < nCycleTimeRangeSize; ++i) { Json::Value jTimeRange = jExamItem["examCycleTimeRange"][i]["timeRange"]; int nTimeRangeSize = jTimeRange.size(); QStringList sTimeRangeList; for(int j = 0; j < nTimeRangeSize; ++j) { sTimeRangeList<vPracticeCourseInfo.push_back(pci); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pQueryPracticeRecordList->sMessage << sResponse.c_str(); } int nSize = jsonRoot.size(); for (int i = 0; i < nSize; ++i) { Json::Value jPracticeItem = jsonRoot[i]; CPracticeRecord pr; pr.sCourseCode = jPracticeItem["courseCode"].asString().c_str(); pr.sCourseName = jPracticeItem["courseName"].asString().c_str(); pr.sEndTime = jPracticeItem["endTime"].asString().c_str(); pr.sExamName = jPracticeItem["examName"].asString().c_str(); pr.nFailQuestionNum = jPracticeItem["failQuestionNum"].asInt(); pr.nId = jPracticeItem["id"].asInt64(); pr.nNotAnsweredCount = jPracticeItem["notAnsweredCount"].asInt(); pr.fObjectiveAccuracy = jPracticeItem["objectiveAccuracy"].asDouble(); pr.nObjectiveNum = jPracticeItem["objectiveNum"].asInt(); pr.sStartTime = jPracticeItem["startTime"].asString().c_str(); pr.nSuccQuestionNum = jPracticeItem["succQuestionNum"].asInt(); pr.nTotalQuestionCount = jPracticeItem["totalQuestionCount"].asInt(); pr.nUsedExamTime = jPracticeItem["usedExamTime"].asInt64(); pQueryPracticeRecordList->vPracticeRecordList.push_back(pr); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetPracticeDetailInfo->sMessage << sResponse.c_str(); } pGetPracticeDetailInfo->sCourseCode = jsonRoot["courseCode"].asString().c_str(); pGetPracticeDetailInfo->sCourseName = jsonRoot["courseName"].asString().c_str(); pGetPracticeDetailInfo->nId = jsonRoot["id"].asInt64(); pGetPracticeDetailInfo->fObjectiveAccuracy = jsonRoot["objectiveAccuracy"].asDouble(); int nSize = jsonRoot["paperStructInfos"].size(); for (int i = 0; i < nSize; ++i) { Json::Value jPaperStructInfo = jsonRoot["paperStructInfos"][i]; CPracticePaperStructInfo ppsi; ppsi.nCount = jPaperStructInfo["count"].asInt(); ppsi.nFailQuestionNum = jPaperStructInfo["failQuestionNum"].asInt(); ppsi.nIndex = jPaperStructInfo["index"].asInt(); ppsi.nNotAnsweredCount = jPaperStructInfo["notAnsweredCount"].asInt(); ppsi.nQuestionCount = jPaperStructInfo["questionCount"].asInt(); ppsi.sQuestionType = jPaperStructInfo["questionType"].asString().c_str(); ppsi.sScore = jPaperStructInfo["score"].asString().c_str(); ppsi.nSuccQuestionNum = jPaperStructInfo["succQuestionNum"].asInt(); ppsi.sTitle = jPaperStructInfo["title"].asString().c_str(); ppsi.fTotalScore = jPaperStructInfo["totalScore"].asDouble(); pGetPracticeDetailInfo->vPracticePaperStructList.push_back(ppsi); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pFindExamRecordDataEntity->sMessage << sResponse.c_str(); } pFindExamRecordDataEntity->nExamId = jsonRoot["examRecord"]["examId"].asInt64(); pFindExamRecordDataEntity->sPaperType = jsonRoot["examRecord"]["paperType"].asString().c_str(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetExamRecordQuestions->sMessage << sResponse.c_str(); } int nSize = jsonRoot["examQuestionEntities"].size(); for (int i = 0; i < nSize; ++i) { Json::Value jQuestionItem = jsonRoot["examQuestionEntities"][i]; CAnsweredQuestion aq; aq.sAnswerType = jQuestionItem["answerType"].asString().c_str(); aq.sAudioPlayTimes = jQuestionItem["audioPlayTimes"].isNull() ? "" : jQuestionItem["audioPlayTimes"].asString().c_str(); aq.sCorrectAnswer = jQuestionItem["correctAnswer"].isNull() ? "" : jQuestionItem["correctAnswer"].asString().c_str(); //aq.sExamQuestionTempId = jQuestionItem["examQuestionTempId"].asString().c_str(); aq.nExamRecordDataId = jQuestionItem["examRecordDataId"].asInt64(); aq.bIsAnswer = jQuestionItem["isAnswer"].asBool(); //aq.bIsInMongo = jQuestionItem["isInMongo"].asBool(); aq.bIsSign = jQuestionItem["isSign"].asBool(); aq.nMainNumber = jQuestionItem["mainNumber"].asInt(); int nOptionSize = jQuestionItem["optionPermutation"].size(); for (int j = 0; j < nOptionSize; ++j) { aq.vOptionPermutation.push_back(jQuestionItem["optionPermutation"][i].asInt()); } aq.nOrder = jQuestionItem["order"].asInt(); aq.sQuestionId = jQuestionItem["questionId"].asString().c_str(); aq.fQuestionScore = jQuestionItem["questionScore"].asDouble(); aq.sQuestionType = jQuestionItem["questionType"].asString().c_str(); aq.sStudentAnswer = jQuestionItem["studentAnswer"].asString().c_str(); aq.fStudentScore = jQuestionItem["studentScore"].asDouble(); pGetExamRecordQuestions->vExamRecordQuestions.push_back(aq); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetOfflineCourse->sMessage << sResponse.c_str(); } int nSize = jsonRoot.size(); for (int i = 0; i < nSize; ++i) { Json::Value jCourseInfo = jsonRoot[i]; COfflineCourseInfo oci; oci.sCourseCode = jCourseInfo["courseCode"].asString().c_str(); oci.sCourseLevel = jCourseInfo["courseLevel"].asString().c_str(); oci.sCourseName = jCourseInfo["courseName"].asString().c_str(); oci.sEndTime = jCourseInfo["endTime"].asString().c_str(); oci.nExamId = jCourseInfo["examId"].asInt64(); oci.sExamName = jCourseInfo["examName"].asString().c_str(); oci.nExamRecordDataId = jCourseInfo["examRecordDataId"].asInt64(); oci.nExamStudentId = jCourseInfo["examStudentId"].asInt64(); oci.bIsvalid = jCourseInfo["isvalid"].asBool(); oci.sOrgName = jCourseInfo["orgName"].asString().c_str(); oci.sPaperId = jCourseInfo["paperId"].asString().c_str(); oci.sSpecialtyName = jCourseInfo["specialtyName"].asString().c_str(); oci.sStartTime = jCourseInfo["startTime"].asString().c_str(); oci.sStatus = jCourseInfo["status"].asString().c_str(); oci.sStudentCode = jCourseInfo["studentCode"].asString().c_str(); oci.sStudentName = jCourseInfo["studentName"].asString().c_str(); int nFileSize = jCourseInfo["offlineFiles"].size(); for (int j = 0; j < nFileSize; ++j) { Json::Value jFileItem = jCourseInfo["offlineFiles"][j]; COfflineFileInfo ofi; ofi.nExamRecordDataId = jFileItem["examRecordDataId"].asInt64(); ofi.sFileType = jFileItem["fileType"].asString().c_str(); ofi.nId = jFileItem["id"].asInt64(); ofi.sOfflineFileName = jFileItem["offlineFileName"].asString().c_str(); ofi.sOfflineFileUrl = jFileItem["offlineFileUrl"].asString().c_str(); ofi.sOriginalFileName = jFileItem["originalFileName"].asString().c_str(); ofi.sProperties = jFileItem["properties"].asString().c_str(); ofi.sSuffix = jFileItem["suffix"].asString().c_str(); oci.vOfflineFileInfo.push_back(ofi); } pGetOfflineCourse->vOfflineCourseInfo.push_back(oci); } } catch (const std::exception &e) { myServerLog()<sAnswerSheetUrl = sResponse.c_str(); } void CHttpBll::genGetOffLineExamPaper(CGetOffLineExamPaper *pGetOffLineExamPaper, const std::string &sResponse) { } void CHttpBll::genPreviewOffLineExamPaper(CPreviewOffLineExamPaper *pPreviewOffLineExamPaper, const std::string &sResponse) { pPreviewOffLineExamPaper->sUrl = sResponse.c_str(); } void CHttpBll::genCheckExamInProgress(CCheckExamInProgress *pCheckExamInProgress, const std::string &sResponse) { try { Json::Reader reader; Json::Value jsonRoot = Json::Value::null; if (!reader.parse(sResponse, jsonRoot)) { pCheckExamInProgress->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pCheckExamInProgress->sMessage << sResponse.c_str(); } if (jsonRoot["data"].isNull()) { pCheckExamInProgress->bHasExamInProgress = false; } else { pCheckExamInProgress->bHasExamInProgress = true; pCheckExamInProgress->nInterruptNum = jsonRoot["data"]["interruptNum"].asInt(); pCheckExamInProgress->nMaxInterruptNum = jsonRoot["data"]["maxInterruptNum"].asInt(); pCheckExamInProgress->bIsExceed = jsonRoot["data"]["isExceed"].asBool(); pCheckExamInProgress->nExamRecordDataId = jsonRoot["data"]["examRecordDataId"].asInt64(); pCheckExamInProgress->nExamId = jsonRoot["data"]["examId"].asInt64(); pCheckExamInProgress->nUsedTime = jsonRoot["data"]["usedTime"].asInt64(); pCheckExamInProgress->nFaceVerifyMinute = jsonRoot["data"]["faceVerifyMinute"].asInt(); pCheckExamInProgress->sExamType = jsonRoot["data"]["examType"].asString().c_str(); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetCourseInfo->sMessage << sResponse.c_str(); } pGetCourseInfo->sCourseName = jsonRoot["courseName"].asString().c_str(); pGetCourseInfo->sCourseCode = jsonRoot["courseCode"].asString().c_str(); } catch (const std::exception &e) { myServerLog()<nLeftTime = QString(sResponse.c_str()).toLongLong(); } void CHttpBll::genFindExamQuestionList(CFindExamQuestionList *pFindExamQuestionList, const std::string &sResponse) { try { Json::Reader reader; Json::Value jsonRoot = Json::Value::null; if (!reader.parse(sResponse, jsonRoot)) { pFindExamQuestionList->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pFindExamQuestionList->sMessage << sResponse.c_str(); } int nSize = jsonRoot.size(); for (int i = 0; i < nSize; ++i) { Json::Value jQuestionItem = jsonRoot[i]; CAnsweredQuestion aq; aq.sAnswerType = jQuestionItem["answerType"].asString().c_str(); aq.sAudioPlayTimes = jQuestionItem["audioPlayTimes"].isNull() ? "" :jQuestionItem["audioPlayTimes"].asString().c_str(); aq.sCorrectAnswer = jQuestionItem["correctAnswer"].isNull() ? "" : jQuestionItem["correctAnswer"].asString().c_str(); aq.sExamQuestionTempId = jQuestionItem["examQuestionTempId"].asString().c_str(); aq.nExamRecordDataId = jQuestionItem["examRecordDataId"].asInt64(); aq.bIsAnswer = jQuestionItem["isAnswer"].asBool(); aq.bIsInMongo = jQuestionItem["isInMongo"].asBool(); aq.bIsSign = jQuestionItem["isSign"].asBool(); aq.nMainNumber = jQuestionItem["mainNumber"].asInt(); int nOptionSize = jQuestionItem["optionPermutation"].size(); for (int j = 0; j < nOptionSize; ++j) { aq.vOptionPermutation.push_back(jQuestionItem["optionPermutation"][i].asInt()); } aq.nOrder = jQuestionItem["order"].asInt(); aq.sQuestionId = jQuestionItem["questionId"].asString().c_str(); aq.fQuestionScore = jQuestionItem["questionScore"].asDouble(); aq.sQuestionType = jQuestionItem["questionType"].asString().c_str(); aq.sStudentAnswer = jQuestionItem["studentAnswer"].asString().c_str(); aq.fStudentScore = jQuestionItem["studentScore"].asDouble(); pFindExamQuestionList->vAnsweredQuestion.push_back(aq); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetExamRecordPaperStruct->sMessage << sResponse.c_str(); } pGetExamRecordPaperStruct->sPaperId = jsonRoot["id"].asString().c_str(); pGetExamRecordPaperStruct->sPaperName = jsonRoot["defaultPaper"]["name"].asString().c_str(); pGetExamRecordPaperStruct->bFullyObjective = jsonRoot["defaultPaper"]["fullyObjective"].asBool(); int nGroupSize = jsonRoot["defaultPaper"]["questionGroupList"].size(); int nOrder = 1; for (int i = 0; i < nGroupSize; ++i) { Json::Value jGroupItem = jsonRoot["defaultPaper"]["questionGroupList"][i]; CPaperGroupStruct pgs; pgs.sGroupName = jGroupItem["groupName"].asString().c_str(); pgs.fGroupScore = jGroupItem["groupScore"].asDouble(); pgs.nNumber = i + 1; int nQuestionSize = jGroupItem["questionWrapperList"].size(); int nShowIndex = 1; int nTotalSubquestion = 0; for (int j = 0; j < nQuestionSize; ++j) { Json::Value jQuestionItem = jGroupItem["questionWrapperList"][j]; CQuestionStruct qs; qs.sQuestionId = jQuestionItem["questionId"].asString().c_str(); qs.sVersion = jQuestionItem["version"].asString().c_str(); qs.fQuestionScore = jQuestionItem["questionScore"].asDouble(); qs.nLimitedPlayTimes = jQuestionItem["limitedPlayTimes"].asInt(); qs.nPlayedTimes = jQuestionItem["playedTimes"].asInt(); qs.nTimeLimit = jQuestionItem["timeLimit"].asInt(); int mSubQuestionSize = jQuestionItem["questionUnitWrapperList"].size(); nTotalSubquestion += mSubQuestionSize; for (int k = 0; k < mSubQuestionSize; ++k) { Json::Value jSubQuestionItem = jQuestionItem["questionUnitWrapperList"][k]; CSubQuestionStruct sqs; sqs.sQuestionType = jSubQuestionItem["questionType"].asString().c_str(); sqs.sAnswerType = jSubQuestionItem["answerType"].asString().c_str(); sqs.fQuestionScore = jSubQuestionItem["questionScore"].asDouble(); sqs.nLimitedPlayTimes = qs.nLimitedPlayTimes; for (int jq = 0; jq < jSubQuestionItem["optionPermutation"].size(); ++jq) { Json::Value Item = jSubQuestionItem["optionPermutation"][jq]; sqs.voptionPermutation.push_back(Item.asInt()); } sqs.nShowNumber = nShowIndex; sqs.nOrder = nOrder; nShowIndex++; nOrder++; qs.vSubQuestionStruct.push_back(sqs); } pgs.vQuestionStruct.push_back(qs); } pgs.nTotalSubquestion = nTotalSubquestion; pGetExamRecordPaperStruct->vPaperGroupStruct.push_back(pgs); } } catch (const std::exception &e) { myServerLog()<bIsCalculate = true; return; } Json::Reader reader; Json::Value jsonRoot = Json::Value::null; if (!reader.parse(sResponse, jsonRoot)) { pGetEndExamInfo->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetEndExamInfo->sMessage << sResponse.c_str(); } pGetEndExamInfo->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64(); pGetEndExamInfo->bIsWarn = jsonRoot["isWarn"].asBool(); pGetEndExamInfo->fObjectiveAccuracy = jsonRoot["objectiveAccuracy"].asDouble(); pGetEndExamInfo->fObjectiveScore = jsonRoot["objectiveScore"].asInt64(); } catch (const std::exception &e) { myServerLog()<sUrl = sResponse.c_str(); } //void CHttpBll::genProcessUpload(CProcessUpload *pProcessUpload, const std::string &sResponse) //{ // try // { // Json::Reader reader; // Json::Value jsonRoot = Json::Value::null; // if (!reader.parse(sResponse, jsonRoot)) // { // pProcessUpload->sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); // myDebug() << pProcessUpload->sMessage << sResponse.c_str(); // } // pProcessUpload->sFileUrl = jsonRoot["fileUrl"].asString().c_str(); // } // catch (const std::exception &e) // { // myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pOrgProperties->sMessage << sResponse.c_str(); } pOrgProperties->nActionNum = QVariant(jsonRoot["ACTION_NUM"].asString().c_str()).toInt(); pOrgProperties->sActionOptions = jsonRoot["ACTION_OPTIONS"].asString().c_str(); pOrgProperties->sActionOrder = jsonRoot["ACTION_ORDER"].asString().c_str(); pOrgProperties->nActionDuration = QVariant(jsonRoot["ACTION_DURATION"].asString().c_str()).toInt(); pOrgProperties->nActionAlert = QVariant(jsonRoot["ACTION_ALERT"].asString().c_str()).toInt(); pOrgProperties->nAllActionDuration = QVariant(jsonRoot["ALL_ACTION_DURATION"].asString().c_str()).toInt(); if(jsonRoot.isMember("PC_CLIENT_FACE_THRESHOLD") && jsonRoot["PC_CLIENT_FACE_THRESHOLD"] != Json::Value::null) { pOrgProperties->nFaceThreshold = QVariant(jsonRoot["PC_CLIENT_FACE_THRESHOLD"].asString().c_str()).toInt(); } } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pStartFaceLiveVerify->sMessage << sResponse.c_str(); } pStartFaceLiveVerify->nFaceLiveVerifyId = jsonRoot["faceLiveVerifyId"].asInt64(); pStartFaceLiveVerify->nStartMinute = jsonRoot["startMinute"].asInt(); pStartFaceLiveVerify->nTimes = jsonRoot["times"].asInt(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pClientExamProcessUploadSign->sMessage << sResponse.c_str(); } pClientExamProcessUploadSign->sType = jsonRoot["fsType"].asString().c_str(); pClientExamProcessUploadSign->sAccessUrl = jsonRoot["accessUrl"].asString().c_str(); pClientExamProcessUploadSign->sSignIdentifier = jsonRoot["signIdentifier"].asString().c_str(); pClientExamProcessUploadSign->sFormUrl = jsonRoot["formUrl"].asString().c_str(); pClientExamProcessUploadSign->sOssAcessKeyId = jsonRoot["formParams"]["OSSAccessKeyId"].asString().c_str(); pClientExamProcessUploadSign->sSignature = jsonRoot["formParams"]["Signature"].asString().c_str(); pClientExamProcessUploadSign->sKey = jsonRoot["formParams"]["key"].asString().c_str(); pClientExamProcessUploadSign->sPolicy = jsonRoot["formParams"]["policy"].asString().c_str(); } catch (const std::exception &e) { myServerLog()<bSkipFaceCheck = QVariant(sResponse.c_str()).toBool(); } catch (const std::exception &e) { myServerLog()<sMessage = QString::fromLocal8Bit("数据请求失败,请检查网络是否正常!"); myDebug() << pGetWXUploadedFile->sMessage << sResponse.c_str(); } pGetWXUploadedFile->nExamRecordDataId = jsonRoot["examRecordDataId"].asInt64(); pGetWXUploadedFile->nQuestionOrder = jsonRoot["questionOrder"].asInt(); pGetWXUploadedFile->sFilePath = jsonRoot["filePath"].asString().c_str(); pGetWXUploadedFile->sStatus = jsonRoot["status"].asString().c_str(); pGetWXUploadedFile->sTransferFileType = jsonRoot["transferFileType"].asString().c_str(); } catch (const std::exception &e) { myServerLog()<