123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include "stdafx.h"
- #include "CLoginInfo.h"
- CLoginInfo::CLoginInfo()
- {
- }
- CLoginInfo::~CLoginInfo()
- {
- }
- bool CLoginInfo::Init(std::string data)
- {
- if (data.empty())
- {
- return false;
- }
- try
- {
- nlohmann::json j = nlohmann::json::parse(data.begin(), data.end());
- if (j["code"].get<int>() == 0)
- {
- //
- this->token = j["data"]["token"].get<std::string>();
- this->auth_data = j["data"]["auth_data"].get<std::string>();
- return true;
- }
- else
- {
- this->m_error_msg = S_CA2W(j["message"].get<std::string>().c_str(), CP_UTF8).GetBuffer(0);
- return false;
- }
- }
- catch (...)
- {
- this->m_error_msg = L"½âÎöÊý¾Ý´íÎó";
- return false;
- }
- return false;
- }
|