LoginRet
Store the information gotten after the user logs in the game
typedef struct loginRet_ {
int flag; //return identifier, which marks success or failure
std::string desc; //return identifier, which marks success or failure
int platform; //the platform currently logged in
std::string open_id;
std::vector<TokenRet> token;
std::string user_id; //the user’s ID; first retain it, and wait to negotiate with WeChat
std::string pf;
std::string pf_key;
std::string prajna_ext; //New fields for 3.3.7
#ifdef __APPLE__
loginRet_ ():flag(-1),platform(0){};
#endif
}LoginRet;
eMSDK_SCREENDIR
typedef enum _eMSDK_SCREENDIR {
eMSDK_SCREENDIR_SENSOR=0, //Portrait and landscape modes
eMSDK_SCREENDIR_PORTRAIT=1, //Portrait mode
eMSDK_SCREENDIR_LANDSCAPE=2, //Landscape mode
}eMSDK_SCREENDIR;
WGWebviewObserver
class WGWebviewObserver
{
public:
/*! @brief Webview callback
*
* Inform the upper App of the created operation result
* @param WebviewRet Created result
* @return void
*/
virtual void OnWebviewNotify(WebviewRet& webviewRet)=0;
virtual ~WGWebviewObserver() {};
};
WebviewRet
typedef struct {
int flag; //0 succeed
std::string msgData; //user-defined data in webviewNotify, which is passed to the game from H5 page's JS
}WebviewRet;
Token information
typedef struct {
int type;
std::string value;
long long expiration;
}TokenRet;
token type
typedef enum _eTokenType
{
eToken_QQ_Access=1, // mobile QQ accessToken
eToken_QQ_Pay, // mobile QQ payToken
eToken_WX_Access, // WeChat accessToken
eToken_WX_Code, // WeChat code, already discarded
eToken_WX_Refresh, // WeChat refreshToken
eToken_Guest_Access // token in the Guest pattern
}eTokenType;
platform | token type | token use | type | valid period | |
---|---|---|---|---|---|
mobile QQ | accesstoken | query mobile QQ user, friends, relation chain, share and other functions | eToken_QQ_Access | 90 days | |
mobile QQ | paytoken | pay-related | eToken_QQ_Pay | 7 days | |
accesstoken | query WeChat user, friends, relation chain, share, payment, etc. | eToken_WX_Access | 2 hours | ||
refreshtoken | refresh accesstoken | eToken_WX_Refresh | 30 days |
WakeupRet
Store the information passed from the platform to the client when the game is awakened by the platform
typedef struct
{
int flag; //ErrorCode
int platform; //activated by what platform
std::string media_tag_name; //meidaTagName passed back by wx (WeChat)
std::string open_id; //openid Passed by qq
std::string desc; //description
std::string lang; //language currently available only for versions higher than WeChat 5.1 and not for mobile QQ
std::string country; //country currently available only for versions higher than WeChat 5.1 and not for mobile QQ
std::string messageExt; //a user-defined string passed in by the game for sharing; it is returned without any processing after the platform launches the game. Presently, it is only used in versions higher than WeChat 5.1 and is not used in mobile QQ
std::vector<KVPair> extInfo; //a user-defined parameter carried by game-platform; only for mobile QQ
}WakeupRet;
LocationRet
Geographical position information
typedef struct {
int flag;
std::string desc;
double longitude;
double latitude;
}LocationRet;
RelationRet
Relation chain information, that is, "a group of" friends' information
typedef struct {
int flag; //search result flag, 0 indicates success
std::string desc; // description
std::vector<PersonInfo> persons;//store friends’ or personal information
std::string extInfo; //an incoming user-defined field used to query games; used to indicate a single query
eRelationRetType type; //used to distinguish callback sources; 0: personal information callback; 1: game friends' callback
}RelationRet;
PersonInfo
Friend's information
typedef struct {
std::string nickName; //nickname
std::string openId; //an account's only identifier
std::string gender; //gender
std::string pictureSmall; //small head portrait
std::string pictureMiddle; //mid-sized head portrait
std::string pictureLarge; //datouxiang
std::string provice; //province (old versions’ property; not saved in AddressInfo so as to avoid external apps from changing the code)
std::string city; //city (old versions’ property; not saved in AddressInfo so as to avoid external apps from changing the code)
bool isFriend; //Friend or not
int distance; //Distance to the place located this time
std::string lang; //language
std::string country; //Country
std::string gpsCity; //City gotten according to GPS information
}PersonInfo;
Shared information
typedef struct
{
int platform; //platform type
int flag; //operation result
std::string desc; //result description (retained)
std::string extInfo; //an incoming user-defined string for game sharing; used to indicate sharing
}ShareRet;
GroupRet
Group information
typedef struct {
int flag; //0 succeed
int errorCode; //a parameter returned by the platform; pay attention to it when flag is not 0
std::string desc; //error information
int platform; //Platform
WXGroupInfo wxGroupInfo; //WeChat group information
QQGroupInfo qqGroupInfo; //QQ group information
}GroupRet;
QQGroupInfo
QQ group information
typedef struct {
std::string groupName; //group name
std::string fingerMemo; //the group's brief introduction
std::string memberNum; //number of group members
std::string maxNum; //The maximum number of members that the group can accommodate
std::string ownerOpenid; //group leader's openid
std::string unionid; //Guild ID bound with the QQ group
std::string zoneid; //Zone ID
std::string adminOpenids; //Administrator's openid. If there are multiple administrators, use "," to separate them, for example 0000000000000000000000002329FBEF,0000000000000000000000002329FAFF
//group openID
std::string groupOpenid; //groupOpenid of the QQ group bound with the game guild ID
//group key for joining a group
std::string groupKey; //the corresponding key of the QQ group needing to add
std::string relation; //The relationship between the user and the group; 1: group leader, 2: administrator, 3: ordinary member, 4: non-member
}QQGroupInfo;
WXGroupInfo
WeChat group information
typedef struct {
std::string openIdList; //group member's openId, partitioned with ","
std::string memberNum; //number of group members
std::string chatRoomURL; //URL of the created (joined) group chat
int status; //return of the result of querying the group status; 0: not create or join any group; 1: have created or joined some groups
}WXGroupInfo;
eFlag
Login return code
typedef enum _eFlag
{
eFlag_Succ =0,
eFlag_QQ_NoAcessToken =1000, //QQ&QZone login fail and can't get accesstoken
eFlag_QQ_UserCancel =1001, //QQ&QZone user has cancelled login process (tencentDidNotLogin)
eFlag_QQ_LoginFail =1002, //QQ&QZone login fail (tencentDidNotLogin)
eFlag_Login_NetworkErr =1003, //QQ&QZone&wx login networkErr
eFlag_QQ_NotInstall =1004, //QQ is not install
eFlag_QQ_NotSupportApi =1005, //QQ don't support open api
eFlag_QQ_AccessTokenExpired=1006, // QQ Actoken expires; it is needed to log in again
eFlag_QQ_PayTokenExpired=1007, // QQ Pay token expires
eFlag_QQ_UnRegistered=1008, // Have yet to register at qq
eFlag_QQ_MessageTypeErr=1009, // QQ message type error
eFlag_QQ_MessageContentEmpty=1010, // QQ message is null
eFlag_QQ_MessageContentErr=1011, // QQ message is unavailable (overlong or due to other reasons)
eFlag_WX_NotInstall =2000, //Weixin is not installed
eFlag_WX_NotSupportApi =2001, //Weixin don't support api
eFlag_WX_UserCancel =2002, //Weixin user has cancelled
eFlag_WX_UserDeny =2003, //Weixin User has deny
eFlag_WX_LoginFail =2004, //Weixin login fail
eFlag_WX_RefreshTokenSucc=2005, // Weixin (WeChat) refreshes the token successfully
eFlag_WX_RefreshTokenFail=2006, // Weixin (WeChat) refreshes the token unsuccessfully
eFlag_WX_AccessTokenExpired=2007, // Weixin AccessToken expires; at this time, you can try to replace refreshToken with token
eFlag_WX_RefreshTokenExpired=2008, // Weixin refresh token expires; re-authorization is needed
eFlag_WX_Group_HasNoAuthority=2009, //The game doesn't have the permission to create a group
eFlag_WX_Group_ParameterError=2010, //Parameter inspection error
eFlag_WX_Group_HadExist=2011, //WeChat group has already existed
eFlag_WX_Group_AmountBeyond=2012, //The number of created groups exceeds the upper limit
eFlag_WX_Group_IDNotExist=2013, //Group ID doesn't exist
eFlag_Error =-1,
eFlag_Local_Invalid=-2, // local token is invalid; it is needed to go to the game's login page for re-authorization
eFlag_LbsNeedOpenLocationService=-4, // need to guide the user to open the location-based service(LBS)
eFlag_LbsLocateFail=-5, // Position fails
eFlag_UrlTooLong=-6, // for WGOpenUrl
eFlag_NeedLogin=3001, //need to enter the login page
eFlag_UrlLogin=3002, //Use URL to log in successfully
eFlag_NeedSelectAccount=3003, //Need to pop up the account inconsistency prompt
eFlag_AccountRefresh=3004, //Refresh token via the URL
eFlag_NeedRealNameAuth=3005, //Require real name authentication
eFlag_WebviewClosed=6001 //inside webview is closed
eFlag_Webview_page_event=7000 //the js message passed
#ifdef ANDROID
,
eFlag_NotInWhiteList=-3 // not in the white list
#endif
#ifdef __APPLE__
,
eFlag_InvalidOnGuest=-7, //This feature is not available under Guest pattern
eFlag_Guest_AccessTokenInvalid=4001, //Guest token expires
eFlag_Guest_LoginFailed=4002, //Login in the Guest pattern fails
eFlag_Guest_RegisterFailed=4003, //Registration in the Guest pattern fails
eFlag_Checking_Token=5001
eFlag_Logining=5002, //Under logging in now. Please wait for login callback before operation
eFlag_Login_Timeout=5003, //Under logging in now. Please wait for login callback before operation
eFlag_RequestTooFrequently=5004,//Call interfaces too frequently
eFlag_WebviewClosed=6001, //built-in browser closed
eFlag_Invalid_Delete_Account_URL=6002, //The url for opening the account cancellation page is invalid
eFlag_Invalid_Login_Channel=6003, //In case of the account cancellation operation, the account is not logged in or the login channel does not support the operation
eFlag_Webview_page_event=7000, //The event that webview js passes parameters to native
//Apple Sign In Return Code Instructions
eFlag_Apple_NotSupport=8002, //Sign in with Apple is not supported on versions below iOS 13
eFlag_Apple_UserCancel=8003, //user cancel
eFlag_Apple_LoginFailed=8004, //Apple login failed, for the specific reason, check the des field
eFlag_Apple_AccessTokenExpired=8005, //Apple access token expired, need to log in again
eFlag_Apple_Revoked=8006, //The user revoked the authorization and needs to log in again
eFlag_Apple_NotFound=8007, //The user has not authorized it
eFlag_Apple_Unknown=8008, //Unknown error, please check the des field
eFlag_Apple_NetworkError=8009, //Network Error
#endif
}eFlag;
``
Mobile QQ related:
|return code|name|description|recommended handling method| |: ------- :|: ------- :|: ------- :|: ------- :| |1000|eFlag_QQ_NoAcessToken| mobile QQ login fails; not get accesstoken| return to the login page, and guide the player to get the login authorization again| |1001|eFlag_QQ_UserCancel| the player cancels mobile QQ-authorized login| return to the login page, and notify that the player has cancelled mobile QQ-authorized login| |1002|eFlag_QQ_LoginFail| mobile QQ login fails | return to the login page, and guide the player to get the login authorization again| |1003|eFlag_QQ_NetworkErr| network error | retry | |1004|eFlag_QQ_NotInstall| the player's device doesn't install mobile QQ client | guide the player to install mobile QQ client | |1005|eFlag_QQ_NotSupportApi| the player's mobile QQ client doesn't support this interface | guide the player to upgrade mobile QQ client | |1006|eFlag_QQ_AccessTokenExpired|accesstoken expires|return to the login page, and guide the player to get the login authorization again| |1007|eFlag_QQ_PayTokenExpired|paytoken expires|return to the login page, and guide the player to get the login authorization again|
WeChat related:
return code | name | description | recommended handling method |
---|---|---|---|
2000 | eFlag_WX_NotInstall | the player's device doesn't install WeChat client | guide the player to install WeChat client |
2001 | eFlag_WX_NotSupportApi | the player's WeChat client doesn't support this interface | guide the player to upgrade WeChat client |
2002 | eFlag_WX_UserCancel | the player cancels WeChat-authorized login | return to the login page, and notify that the player has cancelled WeChat-authorized login |
2003 | eFlag_WX_UserDeny | the player refuses WeChat-authorized login | return to the login page, and notify that the player has refused WeChat-authorized login |
2004 | eFlag_WX_LoginFail | WeChat login fails | return to the login page, and guide the player to get the login authorization again |
2005 | eFlag_WX_RefreshTokenSucc | WeChat refreshes the token successfully | get WeChat token, and login the game |
2006 | eFlag_WX_RefreshTokenFail | WeChat refreshes the token unsuccessfully | return to the login page, and guide the player to get the login authorization again |
2007 | eFlag_WX_AccessTokenExpired | WeChat accessToken expires | try to use refreshtoken to refresh the token |
2008 | eFlag_WX_RefreshTokenExpired | WeChat refreshtoken expires | return to the login page, and guide the player to get the login authorization again |
account inconsistency related:
return code | name | description | recommended handling method |
---|---|---|---|
3001 | eFlag_NeedLogin | the game's local account and launched account can not login the game | return to the login page, and guide the player to get the login authorization again |
3002 | eFlag_UrlLogin | Account inconsistency does not exist. The game is quickly logged in successfully via the launched account | read the token in LoginRet struct for the game's authorization process |
3003 | eFlag_NeedSelectAccount | there is account inconsistency between the game's local account and launched account | pop up a dialog box to let the user select the login account |
3004 | eFlag_AccountRefresh | Account inconsistency does not exist. MSDK has refreshed the local account token via the refresh interface | read the token in LoginRet struct for the game's authorization process |
Related to mobile QQ group (v2):
Return code | Description | Recommended handling way |
---|---|---|
221001 | Bound group | No need to deal with |
221002 | Unbound group | No need to deal with |
221003 | Bound group packet return error | No need to deal with |
221004 | Fail in getting uin and tskey | check if the login state is correct |
221005 | Current user is not group leader | No need to deal with |
221006 | Invalid openid | Check if the openid is valid |
221007 | Parameter is invalid | Check the interface parameters, like appid, guild_id,zone_id, gc. For details, refer to interface parameter list |
221008 | No interface call authority | Refer to authority management to apply for authority |
-182001 | Fail in requesting group background cgi | No need to deal with |
-182002 | Fail in operating cmem | No need to deal with |
-182003 | "Create group" fails | No need to deal with |
-182004 | Fail in searching the group | No need to deal with |
-182005 | Fail in converting openid into uin | No need to deal with |
-182008 | Fail in consulting the idip | No need to deal with |
-500003~-500009 | Fail in parsing services and returning the data | No need to deal with |
-120000 | login state verification failed | Check if the login state is effective |
Related to WeChat group (create a group, unbind a group):
Return code | Description | Recommended handling way |
---|---|---|
-1 | System error | Retry once; if failed, please contact the mobile & online game department's MSDK technical support staff through the enterprise's QQ (800013811). |
-10000 | internal error | game fails to create the group authority. |
-10001 | This game has no authority to create group | The game did not open or create the group authority in the game center. |
-10002 | Parameter check error | Confirm the correctness of parameters; if failed, please contact the mobile & online game department's MSDK technical support staff through the enterprise's QQ (800013811). |
-10003 | Link does not exist (has nothing to do with the group) | None |
-10004 | Failed to get hoplink (has nothing to do with the group) | None |
-10005 | group ID has already existed | Never create the group repeatedly |
-10006 | Number of created group exceeds the upper limit | Change a user to create the group |
-10007 | group ID does not exist | Use the existing group ID |
-10008 | group ID is unavailable | group ID may create only one group chat in a day, and the continual creation may be conducted on the next day (if the group ID has been unbound, the group IP may not create the group within 24 hours ) |
-10009 | The user is not in the group | None |
-20001 | Groups created by the user exceed the limit | Number of groups created by users shall not exceed 20 or the number of unbound groups shall not exceed 20 |
-201608 | kv read fails | Contact interface personnel in relation to WeChat |
-201609 | kv write fails | Contact interface personnel in relation to WeChat |
Related to WeChat group (create a group, unbind a group); the error codes are used in 2.18.0 and later versions; their Anroid and iOS versions are unified:
Return code | Description | Recommended handling way |
---|---|---|
-1 | System error | Retry once; if failed, please contact the mobile & online game department's MSDK technical support staff through the enterprise's QQ (800013811). |
2014 | A group has been created today | Use another id to create a group. |
2015 | The number of groups joined with the ID exceeds the upper limit | Try again the next day. |
2009 | No permission to create groups | Contact product staff to open the permission. |
2012 | The number of created or unbound groups exceeds the upper limit | None |
2011 | WeChat group already exists | None |
2013 | Group ID does not exist | None |
2010 | Parameter check error | None |
eQQScene
Mobile QQ scene enumeration
typedef enum _eQQScene
{
QQScene_QZone =1,//pop up a popup box to share messages to Qzone by default
QQScene_Session=2,//pop up a popup box to share messages to friends by default
}eQQScene;
eWechatScene
WeChat scene enumeration
typedef enum _eWechatScene
{
WechatScene_Session =0,
WechatScene_Timeline=1,
}eWechatScene;
ePlatform
Platform enumeration
typedef enum _ePlatform
{
ePlatform_None,
ePlatform_Weixin,
ePlatform_QQ
#ifdef ANDROID
,
ePlatform_WTLogin,
ePlatform_QQHall
#endif
#ifdef __APPLE__
,
ePlatform_Guest=5,
ePlatform_Auto=6
#endif
}ePlatform;
eStatusType
public enum eStatusType{
ISCREATED=0,
ISJONINED=1
}
eRelationRetType
public enum eRelationRetType{
eRet_QueryMyInfo=0,
eRet_QueryGameFriends=1
}
NoticeInfo
Notice information
typedef struct
{
std::string msg_id; //notice id
std::string open_id; //the user's open_id
std::string msg_url; //notice's hoplink
eMSG_NOTICETYPE msg_type; //notice type,eMSG_NOTICETYPE
std::string msg_scene; //notice display scene; the administration end's back-end configuration
std::string start_time; //notice valid period's start time
std::string end_time; //notice valid period's end time
eMSG_CONTENTTYPE content_type; //notice content type,eMSG_CONTENTTYPE
//webpage notice's special field
std::string content_url; //webpage notice URL
//a special field for the image notice
std::vector<PicInfo> picArray; //image array
//text notice's special field
std::string msg_title; //notice title
std::string msg_content; //notice content
int msg_order; //a notice's priority level; the higher the value, the higher the priority level of the notice; newly added for MSDK2.8.0 version
std::string msg_custom; //a parameter defined by the notice itself
}NoticeInfo;
eBuglyLogLevel
Level of log reported to bugly
typedef enum _eBuglyLogLevel
{
eBuglyLogLevel_S=0, //Silent
eBuglyLogLevel_E=1, //Error
eBuglyLogLevel_W=2, //Warning
eBuglyLogLevel_I=3, //Info
eBuglyLogLevel_D=4, //Debug
eBuglyLogLevel_V=5 //Verbose
}eBuglyLogLevel;
LocalMessage
typedef struct
{
std::string fireDate; //local push's triggering time, format yyyy-MM-dd HH:mm:ss
std::string alertBody; //the push content
int badge; //the number of the superscript
std::string alertAction; //replace the button text content of the popup box (default to"Start")
std::vector<KVPair> userInfo;//User-defined parameter, which can be used to identify push and add additional information
std::string userInfoKey; //the identifier Key of the local push in the front-end push
std::string userInfoValue; //the corresponding value of the identifier Key of the local push in the front-end push
}LocalMessage;
GetCountryFromIPRet
typedef struct
{
int ret; // query result flag; 0 means success
std::string msg; // description
std::string country; // country
bool isQueryByRequestHeader; // indicate whether to query the request header
} GetCountryFromIPRet;
CheckULRet
typedef struct sCheckULRet
{
int step; //check steps
bool success; //whether the test was successful
std::string errorInfo; //error message
std::string suggestion; //suggested solutions for developers
sCheckULRet() {}
} CheckULRet;
eULCheckStep
typedef enum _eULCheckStep {
eULCheckStepParams, // parameter check
eULCheckStepSystemVersion, // current system version check
eULCheckStepWechatVersion, // WeChat client version check
eULCheckStepSDKInnerOperation, // WeChat SDK internal operation check
eULCheckStepLaunchWechat, // App pulls up WeChat to check
eULCheckStepBackToCurrentApp, // Return current App check from WeChat
eULCheckStepFinal, // final check
} eULCheckStep;
GetIPInfoRet
typedef struct
{
int ret; //Query result flag, 0 means success
int country_no; //Country number
int province_no; //Province number
int city_no; //City number
std::string msg; //Description
std::string country; //Country
std::string province; //Province
std::string city; //City
bool isQueryByRequestHeader; //A flag used to show whether to query the request header
} GetIPInfoRet;