Outline
By calling MSDK's group function, the president player of a faction inside the game can bind the faction to the chat group and unbind the faction-bound chat group; and common players can join various factions' chat groups. This can easily help the game increase the player groups' interaction, thus enhancing the players' activity and viscosity. Currently, chat groups support QQ groups and WeChat groups, and each faction can bind a QQ group and a WeChat group at most
Bind QQ group:
Join QQ group:
Bind WeChat group:
Join WeChat group:
Access Guide
1 Preconditions
1) You have completed access configuration by the instructions for accessing the configuration module.
2) You have completed access login by the instructions for accessing the login module.
mobile QQ group function new version V2 (3.2.5a and higher versions)
1 Summary description
Compared with the old version, the new version of mobile QQ simplifies the process of joining or binding a group.
2 Registration callback
1) Function description
The result of querying the group information can be asynchronously notified to the game through this callback. The group functions of mobile QQ and WeChat share the callback.
2) Interface declaration
void WGSetGroupObserver(WGGroupObserver Observer)
3) Parameter name
Parameter name | Type | Description |
---|---|---|
Observer | WGGroupObserver class | The group function information class. As for its specific members |
4) Return value
None
5) Demo code
void MyObserver::OnCreateGroupV2Notify(GroupRet& groupRet) {
// the callback of V2 for creating a mobile QQ group. The group interface callback information of V2 is all placed in mQQGroupInfoV2
//Creation callback processing example:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
Vector<QQGroup> qqGroups = groupRet.mQQGroupInfoV2.qqGroups;
if (qqGroups != null && qqGroups.size () > 0) {
QQGroup qqGroup = qqGroups.get (0);
String groupId = qqGroup.groupId; // group id
String groupName = qqGroup.groupName; // group name
}
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
void MyObserver::OnJoinGroupV2Notify(GroupRet& groupRet) {
// the callback of V2 for joining a mobile QQ group. The group interface callback information of V2 is all placed in mQQGroupInfoV2
//example of how to handle the callback of joining a group:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
// succeed to join the group
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
void MyObserver::OnQueryGroupInfoV2Notify(GroupRet& groupRet) {
// the callback of V2 for querying the relationship with a mobile QQ group. The group interface callback information of V2 is all placed in mQQGroupInfoV2
//example of how to handle the callback of querying the relationship with a mobile QQ group:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
// Relationship between the user and the group: 1: owner, 2: administrator, 3: normal member, 4: non-member, -1 query error
int relation = groupRet.mQQGroupInfoV2.relation;
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
void MyObserver::OnUnbindGroupV2Notify(GroupRet& groupRet) {
// the callback of V2 for unbinding a mobile QQ group. The group interface callback information of V2 is all placed in mQQGroupInfoV2
//example of how to handle the callback of unbinding a mobile QQ group:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
Vector<QQGroup> qqGroups = groupRet.mQQGroupInfoV2.qqGroups;
if (qqGroups != null && qqGroups.size () > 0) {
QQGroup qqGroup = qqGroups.get (0);
String groupId = qqGroup.groupId; // unbound group id (only return group id in case of unbinding)
}
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
void MyObserver::OnGetGroupCodeV2Notify(GroupRet& groupRet) {
// the callback of V2 for getting the group information bound with the guild. The group interface callback information of V2 is all placed in mQQGroupInfoV2
//example of how to handle the callback of getting the group number bound with the guild:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
Vector<QQGroup> qqGroups = groupRet.mQQGroupInfoV2.qqGroups;
if (qqGroups != null && qqGroups.size () > 0) {
QQGroup qqGroup = qqGroups.get (0);
String groupId = qqGroup.groupId; // group id
String groupName = qqGroup.groupName; // group name
}
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
void MyObserver::OnQueryBindGuildV2Notify(GroupRet& groupRet) {
// the callback of V2 for querying the guild bound with the group. The group interface callback information of V2 is all placed in mQQGroupInfoV2
//example of how to handle the callback of querying the guild bound with the group:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
String guildId = groupRet.mQQGroupInfoV2.guildId;
String guildName = groupRet.mQQGroupInfoV2.guildName;
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
void MyObserver::OnBindExistGroupV2Notify(GroupRet& groupRet) {
// the callback of V2 for binding with the existing mobile QQ group. The group interface callback information of V2 is all placed in mQQGroupInfoV2
// example of how to handle the callback of binding with the existing mobile QQ group:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
Vector<QQGroup> qqGroups = groupRet.mQQGroupInfoV2.qqGroups;
if (qqGroups != null && qqGroups.size () > 0) {
QQGroup qqGroup = qqGroups.get (0);
String groupId = qqGroup.groupId; // group id
String groupName = qqGroup.groupName; // group name
}
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
void MyObserver::OnGetGroupListV2Notify(GroupRet& groupRet) {
// the callback of V2 for getting the list of the created mobile QQ groups. The group interface callback information of V2 is all placed in mQQGroupInfoV2
//example of how to handle the callback of getting the list of the created mobile QQ groups:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
Vector<QQGroup> qqGroups = groupRet.mQQGroupInfoV2.qqGroups;
if (qqGroups != null && qqGroups.size () > 0) {
for (QQGroup qqGroup : qqGroups) {
String groupId = qqGroup.groupId; // group id
String groupName = qqGroup.groupName; // group name
}
}
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
void MyObserver::OnRemindGuildLeaderV2Notify(GroupRet& groupRet) {
// the callback of V2 for reminding the guild leader of binding a group. The group interface callback information of V2 is all placed in mQQGroupInfoV2
//example of how to handle the callback of reminding the guild leader of binding a group:
/*if (groupRet.flag == CallbackFlag.eFlag_Succ) {
// Succeed to remind
}else{
int errorCode = groupRet.errorCode;
// Handle according to errorCode
}*/
}
6) Special description
After MSDK 3.2 version, all group interfaces of V2 use the new V2 group callbacks
7) Term interpretation
1 Call the interface of creating a QQ group (v2)
1) Function description
Create a QQ group. The result can be called back to the game via OnCreateGroupV2Notify of WGGroupObserver.
2) Interface declaration
void WGCreateQQGroupV2(GameGuild& gameGuild);
3) Parameter description
GameGuild: set parameter description
Parameter name | Type | Description |
---|---|---|
guildId | String | (required) guild id;The string needs to use numbers, such as: "123456" |
guildName | String | (required) guild nickname |
zoneId | String | (required) zone id |
roleId | String | (required) role id |
partition | String | (optional) partition id (sub-zone); it is allowed to fill in it; the parameter is useless temporarily |
userZoneId | String | (optional) the user’s zone ID; can transfer the ID to a person who doesn’t belong to the zone, the guild’s zone is not necessarily the user’s zone |
userLabel | String | (optional) Modify the group's business card; if the parameter is null, this means not modifying the group's business card. The rule is "【YYYY】zzzz", in which YYYY refers to the user's game data, and zzzz refers to the user's nickname in the game |
nickName | String | (optional) user nickname |
type | String | (required) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values. |
areaId | String | (required) game zone ID, "1" QQ (by default), "2" WeChat (optional) |
4) Return value
None; the result can be called back to the game via OnCreateGroupV2Notify of WGGroupObserver.
5) Demo code:
GameGuild gameGuild;
gameGuild.guildName = [[param objectForKey:@"msdk"] UTF8String];
gameGuild.guildId = [[param objectForKey:@"100703379"] UTF8String];
gameGuild.roleId = [[param objectForKey:@"jingjing"] UTF8String];
gameGuild.partition = [[param objectForKey:@"10"] UTF8String];
gameGuild.zoneId = [[param objectForKey:@"100"] UTF8String];
WGPlatform::GetInstance()->WGCreateQQGroupV2(gameGuild);
6) Special description
Fill in the required parameters according to the parameter description, and fill in the optional parameters according to the need.
7) Term interpretation
None
2 Call the interface of querying the relationship between the player and QQ group (v2)
1) Function description
Get the relationship between the player and the group. The result can be called back to the game via OnQueryGroupInfoNotify of WGGroupObserver.
2) Interface declaration
void WGQueryQQGroupInfoV2(String groupId);
3) Parameter description
Parameter name | Type | Description |
---|---|---|
groupId | String | group id returned when creating a group(Group id is the group account number) |
4) Return value
None; The result can be called back to the game via OnQueryGroupInfoNotify of WGGroupObserver.
5) Demo code:
WGPlatform::GetInstance()->WGQueryQQGroupInfoV2("11002222");
6) Special description
None
7) Term interpretation
None
3 Call the interface of joining a QQ group (v2)
1) Function description
Join a QQ group; the result can be called back to the game via OnJoinQQGroupNotify of WGGroupObserver.
2) Interface declaration
Pay attention to the order of parameters passed when the function is called
void WGJoinQQGroupV2(GameGuild& gameGuild,String groupId);
3) Parameter description
Parameter name | Type | Description |
---|---|---|
gameGuild | GameGuild | (required) guild information |
groupId | String | (required) group id(Group id is the group account number) |
GameGuild: set parameter description
Parameter name | Type | Description |
---|---|---|
guildId | String | (required) guild id;The string needs to use numbers, such as: "123456" |
zoneId | String | (required) zone id |
roleId | String | (required) role id |
partition | String | (optional) partition id (sub-zone); it is allowed to fill in it; the parameter is useless temporarily |
userZoneId | String | (optional) the user’s zone ID; can transfer the ID to a person who doesn’t belong to the zone, the guild’s zone is not necessarily the user’s zone |
userLabel | String | (optional) Modify the group's business card; if the parameter is null, this means not modifying the group's business card. The rule is "【YYYY】zzzz", in which YYYY refers to the user's game data, and zzzz refers to the user's nickname in the game |
nickName | String | (optional) user nickname |
type | String | (required) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values. |
areaId | String | (required) game zone ID, "1" QQ (by default), "2" WeChat (optional) |
4) Return value
None; the result can be called back to the game via OnJoinQQGroupNotify of WGGroupObserver.
5) Demo code:
GameGuild gameGuild;
gameGuild.guildId = [[param objectForKey:@"100703379"] UTF8String];
gameGuild.roleId = [[param objectForKey:@"jingjing"] UTF8String];
gameGuild.partition = [[param objectForKey:@"10"] UTF8String];
gameGuild.zoneId = [[param objectForKey:@"100"] UTF8String];
WGPlatform::GetInstance()->WGJoinQQGroupV2(gameGuild,"11002222");
6) Special description
Fill in the required parameters according to the parameter description, and fill in the optional parameters according to the need.
7) Term interpretation
None
4 Call the interface of unbinding QQ group (v2)
1) Function description
Unbind a QQ group; the result can be called back to the game via OnUnbindGroupNotify of WGGroupObserver.
2) Interface declaration
void WGUnbindQQGroupV2(GameGuild& gameGuild);
3) Parameter description
GameGuild: set parameter description
Parameter name | Type | Description |
---|---|---|
guildId | String | (required) guild id;The string needs to use numbers, such as: "123456" |
guildName | String | (required) guild name |
zoneId | String | (required) zone id |
userZoneId | String | (optional) the user’s zone ID; can transfer the ID to a person who doesn’t belong to the zone, the guild’s zone is not necessarily the user’s zone |
type | String | (required) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values. |
areaId | String | (required) game zone ID, "1" QQ (by default), "2" WeChat (optional) |
4) Return value
None, the result can be called back to the game via OnUnbindGroupNotify of WGGroupObserver.
5) Demo code:
GameGuild gameGuild;
gameGuild.guildId = [[param objectForKey:@"100703379"] UTF8String];
gameGuild.guildName = [[param objectForKey:@"msdk"] UTF8String];
gameGuild.zoneId = [[param objectForKey:@"100"] UTF8String];
WGPlatform::GetInstance()->WGUnbindQQGroupV2(gameGuild);
6) Special description
Fill in the required parameters according to the parameter description, and fill in the optional parameters according to the need.
7) Term interpretation
None
5 Call the interface of binding the existing mobile QQ group (v2)
1) Function description
Bind the existing mobile QQ group
2) Interface declaration
void WGBindExistQQGroupV2(GameGuild& gameGuild,String groupId,String groupName);
3) Parameter description
Parameter name | Type | Description |
---|---|---|
gameGuild | GameGuild | (required) guild information |
groupId | String | (required) group id(Group id is the group account number) |
groupName | String | (required) group nickname |
GameGuild: set parameter description
Parameter name | Type | Description |
---|---|---|
guildId | String | (required) guild id;The string needs to use numbers, such as: "123456" |
roleId | String | (required) role id |
zoneId | String | (required) zone id |
userZoneId | String | (optional) the user’s zone ID; can transfer the ID to a person who doesn’t belong to the zone, the guild’s zone is not necessarily the user’s zone |
type | String | (required) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values. |
areaId | String | (required) game zone ID, "1" QQ (by default), "2" WeChat (optional) |
4) Return value
None
5) Demo code:
GameGuild gameGuild;
gameGuild.guildId = [[param objectForKey:@"100703379"] UTF8String];
gameGuild.roleId = [[param objectForKey:@"10"] UTF8String];
gameGuild.zoneId = [[param objectForKey:@"100"] UTF8String];
WGPlatform::GetInstance()->WGBindExistQQGroupV2(gameGuild,"111022","msdk");
6) Special description
Fill in the required parameters according to the parameter description, and fill in the optional parameters according to the need.
7) Term interpretation
None
6 Call the interface of getting the group information of the bound mobile QQ group (v2)
1) Function description
Get the group information of the bound mobile QQ group
2) Interface declaration
void WGGetQQGroupCodeV2(GameGuild& gameGuild);
3) Parameter description
GameGuild: set parameter description
Parameter name | Type | Description |
---|---|---|
guildId | String | (required) guild id;The string needs to use numbers, such as: "123456" |
zoneId | String | (required) zone id |
type | String | (optional) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values. |
4) Return value
None
5) Demo code:
GameGuild gameGuild;
gameGuild.guildId = [[param objectForKey:@"100703379"] UTF8String];
gameGuild.roleId = [[param objectForKey:@"10"] UTF8String];
gameGuild.zoneId = [[param objectForKey:@"100"] UTF8String];
WGPlatform::GetInstance()->WGGetQQGroupCodeV2(gameGuild);
6) Special description
Fill in the required parameters according to the parameter description, and fill in the optional parameters according to the need.
7) Term interpretation
None
7 Call the interface of querying guilds bound by a group (v2)
1) Function description
Query guilds bound by the specified group
2) Interface declaration
void WGQueryBindGuildV2(String groupId, int type);
3) Parameter description
Parameter name | Type | Description |
---|---|---|
groupId | String | (required) group id(Group id is the group account number) |
type | int | (required) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values. |
4) Return value
None
5) Demo code:
WGPlatform::GetInstance()->WGQueryBindGuildV2("111002",0);
6) Special description
Fill in the required parameters according to the parameter description, and fill in the optional parameters according to the need.
7) Term interpretation
None
8 Call the interface of querying the list of created QQ groups (v2)
1) Function description
Query the list of created QQ groups
2) Interface declaration
void WGGetQQGroupListV2();
3) Parameter description
None
4) Return value
None
5) Demo code:
WGPlatform::GetInstance()->WGGetQQGroupListV2();
6) Special description
None
7) Term interpretation
None
9 Call the interface of reminding the guild leader of binding a group (v2)
1) Function description
Remind the guild leader of binding a group
2) Interface declaration
Pay attention to the order of parameters passed when the function is called
void WGRemindGuildLeaderV2(GameGuild& gameGuild);
3) Parameter description
GameGuild: set parameter description
Parameter name | Type | Description |
---|---|---|
guildId | String | (required) guild id;The string needs to use numbers, such as: "123456" |
zoneId | String | (required) zone id |
roleId | String | (required) role id |
roleName | String | (required) role name |
leaderOpenid | String | (required) the guild leader's openid |
leaderRoleId | String | (required) the guild leader's roleid |
leaderZoneId | String | (optional) the guild leader’s zone information; the guild leader can transfer the ID to a person who doesn’t belong to the zone |
userZoneId | String | (optional) the user’s zone ID; can transfer the ID to a person who doesn’t belong to the zone, the guild’s zone is not necessarily the user’s zone |
type | String | (required) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values. |
areaId | String | (required) game zone ID, "1" QQ (by default), "2" WeChat (optional) |
4) Return value
None
5) Demo code:
GameGuild gameGuild;
gameGuild.guildId = [[param objectForKey:@"100703379"] UTF8String];
gameGuild.roleId = [[param objectForKey:@"12"] UTF8String];
gameGuild.roleName = [[param objectForKey:@"jingjing"] UTF8String];
gameGuild.zoneId = [[param objectForKey:@"100"] UTF8String];
gameGuild.leaderOpenid = [[param objectForKey:@"78AADD8DC9CF80E655EE68039B1D02C9"] UTF8String];
gameGuild.leaderZoneId= [[param objectForKey:@"1234"] UTF8String];
WGPlatform::GetInstance()->WGRemindGuildLeaderV2(gameGuild);
6) Special description
Fill in the required parameters according to the parameter description, and fill in the optional parameters according to the need.
7) Term interpretation
None
WeChat group function
1 Summary
You should first register WeChat group function callback, and then call WeChat group function interface according to the recommended workflow. After these steps, you can access WeChat group function The interface calling workflow is shown in the following diagram:
2 Set group information callback
1)Function description
Before calling interfaces in relation to WeChat group function, you need to set the group information callback, so as to call the WeChat group creation result, group information query result and group-joining result back to the game.
2)Interface declaration
void WGSetGroupObserver(WGGroupObserver* pGroupObserver);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
pGroupObserver | WGGroupObserver class | Group function callback information |
4)Return value
None
5)Demo code
MyObserver *ob = MyObserver::GetInstance();
WGPlatform::GetInstance()->WGSetGroupObserver(ob);
6)Special description
None
7)Term interpretation
None
3 Query WeChat group information
1)Function description
In the game, query the guild's WeChat group information. The query result is used to check whether the guild's WeChat group has been created and whether the corresponding users have joined the group.
2)Interface declaration
void WGQueryWXGroupInfo(
unsigned char* unionID,
unsigned char* openIdLists
);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionID | unsigned char* | guild ID |
openIdLists | unsigned char* | the openid list of users awaiting to be checked if they are in the group; separated with "," |
4)Return value
None, the call result will be called back to the game through OnQueryGroupInfoNotify
5)Demo code
WGPlatform::GetInstance()->WGQueryWXGroupInfo((unsigned char*)[self.wxGroupUnionId UTF8String],
(unsigned char*)[self.wxGroupQueryOpenIDLists UTF8String]);
6)Special description
None
7)Term interpretation
None
4 Handle the callback of querying WeChat group information
1)Function description
Call the queried WeChat group information back to the game.
2)Interface declaration
virtual void OnQueryGroupInfoNotify(GroupRet& groupRet) = 0;
3)Parameter description
Parameter name | Type | Description |
---|---|---|
groupRet | GroupRet class | Group function callback information |
4)Return value
None
5)Demo code
void MyObserver::OnQueryGroupInfoNotify(GroupRet& groupRet)
{
if (groupRet.flag == 0)
{
NSLog(@"Succeed in querying group members");
}
else
{
switch (groupRet.errorCode)
{
case eFlag_Error:
// System error
NSLog(@"System error.Please try again");
break;
case eFlag_WX_Group_ParameterError:
//Parameter inspection error
NSLog(@"System error; parameter check error.Please check the parameter and then try again");
break;
case eFlag_WX_Group_IDNotExist:
//Group ID doesn't exist
NSLog(@"system error; group ID doesn't exist. Please check this and then try again");
break;
default:
break;
}
}
}
6)Special description
None
7)Term interpretation
None
5 Create guild WeChat group
1)Function description
In the game, create the guild's WeChat group.
2)Interface declaration
void WGCreateWXGroup(
unsigned char* unionid,
unsigned char* chatRoomName,
unsigned char* chatRoomNickName
);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionID | unsigned char* | guild ID |
chatRoomName | unsigned char* | chat group name |
chatRoomNickName | unsigned char* | the user's self-defined nickname in the chat group |
4)Return value
None, the call result will be called back to the game through OnCreateWXGroupNotify
5)Demo code
WGPlatform::GetInstance()->WGCreateWXGroup((unsigned char*)[self.wxGroupUnionId UTF8String],
(unsigned char*)[self.wxGroupChatRoomName UTF8String],
(unsigned char*)[self.wxGroupChatRoomNickName UTF8String]);
6)Special description
None
7)Term interpretation
None
6 Handle the callback of creating WeChat group
1)Function description
Call the WeChat group creation result back to the game.
2)Interface declaration
virtual void OnCreateWXGroupNotify(GroupRet& groupRet) = 0;
3)Parameter description
Parameter name | Type | Description |
---|---|---|
groupRet | GroupRet class | Group function callback information |
4)Return value
None
5)Demo code
void MyObserver::OnCreateWXGroupNotify(GroupRet& groupRet)
{
if (groupRet.flag == eFlag_Succ)
{
NSLog(@"Succeed in creating WeChat group");
}
else
{
switch (groupRet.errorCode)
{
case eFlag_Error:
// System error
NSLog(@"System error.Please try again");
break;
case eFlag_WX_Group_HasNoAuthority:
// The game doesn't have permissions to create a group
NSLog(@"System error; the game doesn't have permissions to create a group. Please try again");
break;
case eFlag_WX_Group_ParameterError:
//Parameter inspection error
NSLog(@"System error; parameter check error.Please check the parameter and then try again");
break;
case eFlag_WX_Group_HadExist:
//Group ID has existed
NSLog(@"System error; WeChat group has existed. Please check this and then try again");
break;
case eFlag_WX_Group_AmountBeyond:
//The number of created groups exceeds the upper limit
NSLog(@"system error; the number of established groups exceeds the upper limit. Please check this and then try again");
break;
default:
break;
}
}
}
6)Special description
None
7)Term interpretation
None
7 Join guild WeChat group
1)Function description
In the game, join the guild's WeChat group.
2)Interface declaration
void WGJoinWXGroup(
unsigned char* unionid,
unsigned char* chatRoomNickName
);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionID | unsigned char* | guild ID |
chatRoomNickName | unsigned char* | the user's self-defined nickname in the chat group |
4)Return value
None, the call result will be called back to the game through OnJoinWXGroupNotify
5)Demo code
WGPlatform::GetInstance()->WGJoinWXGroup((unsigned char*)[self.wxGroupUnionId UTF8String],
(unsigned char*)[self.wxGroupChatRoomNickName UTF8String]);
6)Special description
None
7)Term interpretation
None
8 Handle the WeChat group joining callback
1)Function description
Call the WeChat group joining result back o the game.
2)Interface declaration
virtual void OnJoinWXGroupNotify(GroupRet& groupRet) = 0;
3)Parameter description
Parameter name | Type | Description |
---|---|---|
groupRet | GroupRet class | Group function callback information |
4)Return value
None
5)Demo code
void MyObserver::OnJoinWXGroupNotify(GroupRet& groupRet)
{
if (groupRet.flag == 0)
{
NSLog(@"Succeed in joining WeChat group");
}
else
{
switch (groupRet.errorCode)
{
case eFlag_Error:
// System error
NSLog(@"System error.Please try again");
break;
case eFlag_WX_Group_ParameterError:
//Parameter inspection error
NSLog(@"System error; parameter check error.Please check the parameter and then try again");
break;
case eFlag_WX_Group_IDNotExist:
//Group ID doesn't exist
NSLog(@"system error; group ID doesn't exist. Please check this and then try again");
break;
default:
break;
}
}
}
6)Special description
None
7)Term interpretation
None
9 Call the interface to query WeChat group status(2.18.0 and higher versions)
1)Function description
In the game, query whether the specified guild id has created or joined any group.
2)Interface declaration
void WGQueryWXGroupStatus(unsigned char* groupId,eStatusType opType);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionID | unsigned char* | guild ID |
type | eStatusType | Enumeration type: ISCREATED (whether or not create a group), ISJONINED (whether or not join a group) |
4)Return value
void MyObserver::OnQueryWXGroupStatusNotify(GroupRet& groupRet)
{
if (groupRet.flag == 0) //succeed
{
if(groupRet.platform == ePlatform_WeiXin)
{
WXGroupInfo wxGroupInfo = groupRet.wxGroupInfo;
int status = wxGroupInfo.status; //0: not create or join any group; 1: have created or joined some groups
...
}
}
else
{
if(groupRet.platform == ePlatform_WeiXin)
{
switch (groupRet.errorCode)
{
}
}
}
}
5)Demo code
NSString* groupId = @"10001";
WGPlatform::GetInstance()->WGQueryWXGroupStatus((unsigned char*)[groupId UTF8String],ISCREATED);
6)Special description
None
7)Name interpretation
None
10 Call the interface to unbind WeChat group(2.17.0 and higher versions)
1)Function description
In the game, unbind the specified guild group.
2)Interface declaration
void WGUnbindWeiXinGroup(unsigned char* groupId);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionID | unsigned char* | guild ID |
4)Return value
Callback acquisition example(note: Unbinding WeChat group and unbinding mobile QQ group use the same callback function. We must first distinguish whether the callback platform is mobile QQ or WeChat):
void MyObserver::OnUnbindGroupNotify(GroupRet& groupRet)
{
if (groupRet.flag == 0) //succeed
{
if(groupRet.platform == ePlatform_WeiXin)
{
int errorCode = groupRet.errorCode;
std::string desc = groupRet.desc;
...
}
}
else
{
if(groupRet.platform == ePlatform_WeiXin)
{
switch (groupRet.errorCode)
{
}
}
}
}
5)Demo code
NSString* groupId = @"10001";
WGPlatform::GetInstance()->WGUnbindWeiXinGroup((unsigned char*)[groupId UTF8String]);
6)Special description
None
7)Name interpretation
None
FAQ
- If a QQ group is disbanded, there are two ways to cancel its binding relations:
1.The president calls the unbinding interface to unbind the group's relations;
2.When a guild member calls the group-joining interface, the group ID can't be queried at this time and unbinding is performed by default.
When a QQ group is disbanded without performing any of the above operations, the binding relationship does not disappear automatically. - After chairman does the transfer, the new chairman may perform unbinding operation.