#include "stdafx.h" #include "CVersion.h" CVersion::CVersion() { } CVersion::~CVersion() { } bool CVersion::Inti(std::string data) { if (data.empty()) { return false; } try { nlohmann::json j = nlohmann::json::parse(data.begin(), data.end()); if (j["code"].get() == 0) { /*"version": "1.0.0", "appmsg" : "修复一些bug", "download_url" : "https://dw.appwang2.net/down/wlt1.0.apk", "isUpdate" : 0*/ // this->appversion = j["data"]["version"].get(); this->appdownload = j["data"]["download_url"].get(); this->appmsg = j["data"]["appmsg"].get(); this->versionupdate = j["data"]["isUpdate"].get(); return true; } else { SStringW msg; msg.Format(L"当前版本号:%s", VERSION, S_CA2W(j["message"].get().c_str(), CP_UTF8)); this->m_error_msg = msg.GetBuffer(0); return false; } } catch (...) { this->m_error_msg = L"解析数据错误"; return false; } return false; }