#pragma once #include "AIGCJson.hpp" #define USER_REAL_PLATFORM (0) class ProtocolBase { public: ProtocolBase() { this->ver = 1; this->timeStamp = static_cast(time(nullptr)); this->cryptoType = 0; } unsigned int ver; unsigned int cryptoType; unsigned int timeStamp; AIGC_JSON_HELPER(ver, cryptoType, timeStamp) void SetVersion(unsigned int versino) { this->ver = versino; } void SetTimeStamp(unsigned int ts) { this->timeStamp = ts; } void SetCryptoType(unsigned int crypto) { this->cryptoType = crypto; } }; class ResponseStatus { public: int errCode; std::string errMessage; AIGC_JSON_HELPER(errCode, errMessage) }; template class ProtocolRequest : public ProtocolBase { public: T msgContent; AIGC_JSON_HELPER(msgContent) AIGC_JSON_HELPER_BASE((ProtocolBase *)this) }; template class ProtocolResponse : public ProtocolBase { public: int code; T msgContent; AIGC_JSON_HELPER(code, msgContent) AIGC_JSON_HELPER_BASE((ProtocolBase *)this) };