/* * @Description: * @Version: 1.0 * @Autor: lishengyin * @Date: 2021-11-04 09:39:46 * @LastEditors: Your Name lishengyin@sz-sunwin.com * @LastEditTime: 2022-09-04 21:26:21 */ #ifndef __HTTPTOKEN_HPP_ #define __HTTPTOKEN_HPP_ #include using namespace std; #include #include #include #include class HttpToken { public: std::string authToken = ""; std::string expiration = ""; std::string refreshToken = ""; public: HttpToken() {} ~HttpToken() {} /** * @description: json反序列为对象 * @param {*} * @return {*} */ bool jsonToObject(const rapidjson::Value& object){ const auto end = object.MemberEnd(); if(end == object.FindMember("authToken") || !object["authToken"].IsString()){ return false; }else{ authToken = object["authToken"].GetString(); } if(end == object.FindMember("expiration") || !object["expiration"].IsString()){ return false; }else{ expiration = object["expiration"].GetString(); } if(end == object.FindMember("refreshToken") || !object["refreshToken"].IsString()){ return false; }else{ refreshToken = object["refreshToken"].GetString(); } return true; } void ObjectToJson(rapidjson::Writer& writer){ writer.StartObject(); writer.EndObject(); } }; #endif