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:
Unbind 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.
2 Callback of registering the group function
1)Function description
The call result of querying the group information is informed to the game asynchronously through this callback, and mobile QQ and WeChat's group functions share this callback.
2)Interface declaration
public static void WGSetGroupObserver(WGGroupObserver Observer)
3)Parameter name
Parameter name | Type | Description |
---|---|---|
Observer | WGGroupObserver class | as for group function information class's specific members |
4)Return value
None
5)Demo code
WGPlatform.WGSetGroupObserver(new MsdkGroupCallback());
class MsdkGroupCallback implements WGGroupObserver {
// QQ V2 group interface callback
virtual void OnCreateGroupV2Notify(GroupRet& groupRet)
{
LOGD("GroupCallback OnCreateGroupV2Notify;flag:%d;errorCode:%d;desc:%s", groupRet.flag, groupRet.errorCode,
groupRet.desc.c_str());
int size = groupRet.mQQGroupInfoV2.qqGroups.size();
std::string groupName = "";
std::string groupId = "";
if(size > 0){
groupName = groupRet.mQQGroupInfoV2.qqGroups[0].groupName;
groupId = groupRet.mQQGroupInfoV2.qqGroups[0].groupId;
}
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnCreateGroupV2Notify;flag:%d;errorCode:%d;desc:%s;groupSize:%d;"
"groupName:%s;groupId:%s", groupRet
.flag,
groupRet.errorCode, groupRet.desc.c_str(),size,groupName.c_str(),groupId.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnJoinGroupV2Notify(GroupRet &groupRet)
{
LOGD("QQGroupCallback OnJoinGroupV2Notify;flag:%d;errorCode:%d;desc:%s", groupRet.flag, groupRet.errorCode,
groupRet.desc.c_str());
char buffer[512];
snprintf(buffer, 512, "QQGroupCallback OnJoinGroupV2Notify;flag:%d;errorCode:%d;desc:%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnQueryGroupInfoV2Notify(GroupRet &groupRet)
{
// The game adds the logic after the query group information is returned here
LOGD("GroupCallback OnQueryGroupInfoV2Notify;flag:%d;errorCode:%d;desc:%s;relation:%d", groupRet.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupRet.mQQGroupInfoV2.relation);
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnQueryGroupInfoV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;relation:%d",
groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupRet.mQQGroupInfoV2.relation);
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnUnbindGroupV2Notify(GroupRet &groupRet)
{
// This is where the game adds the return result after the call unbinds the interface
std::string groupId = "";
std::vector<QQGroup> groups = groupRet.mQQGroupInfoV2.qqGroups;
if(!groups.empty()){
groupId = groups[0].groupId;
}
LOGD("GroupCallback OnUnbindGroupV2Notify;flag:%d;errorCode:%d;desc:%s;groupId%s", groupRet.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupId.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnUnbindGroupV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;groupId%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupId.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnBindExistGroupV2Notify(GroupRet &groupRet)
{
// The game returns the result after adding the call to bind the existing group interface
std::string groupId = "";
std::vector<QQGroup> groups = groupRet.mQQGroupInfoV2.qqGroups;
if(!groups.empty()){
groupId = groups[0].groupId;
}
LOGD("GroupCallback OnBindExistGroupV2Notify;flag:%d;errorCode:%d;desc:%s;groupId%s", groupRet.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupId.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnBindExistGroupV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;groupId%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupId.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnGetGroupCodeV2Notify(GroupRet &groupRet)
{
// The game adds a call here to get the return result after the group interface is retrieved
std::string groupId = "";
std::string groupName = "";
std::vector<QQGroup> groups = groupRet.mQQGroupInfoV2.qqGroups;
if(!groups.empty()){
groupId = groups[0].groupId;
groupName = groups[0].groupName;
}
LOGD("GroupCallback OnGetGroupCodeV2Notify;flag:%d;errorCode:%d;desc:%s;groupId:%s;groupName:%s", groupRet
.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupId.c_str(),groupName.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnGetGroupCodeV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;"
"groupId:%s;groupName:%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupId.c_str(),groupName.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnQueryBindGuildV2Notify(GroupRet &groupRet)
{
// This is where the game adds the return result after calling the query union information interface
LOGD("GroupCallback OnQueryBindGuildV2Notify;flag:%d;errorCode:%d;desc:%s;guildId:%s;guildName:%s", groupRet
.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupRet.mQQGroupInfoV2.guildId.c_str(),groupRet.mQQGroupInfoV2.guildName.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnQueryBindGuildV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;"
"guildId:%s;guildName:%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupRet.mQQGroupInfoV2.guildId.c_str(),groupRet.mQQGroupInfoV2.guildName.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnRemindGuildLeaderV2Notify(GroupRet &groupRet)
{
// This is where the game adds the return result after the call to alert the binding group interface
LOGD("GroupCallback OnRemindGuildLeaderV2Notify;flag:%d;errorCode:%d;desc:%s", groupRet
.flag, groupRet
.errorCode,
groupRet.desc.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnRemindGuildLeaderV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnGetGroupListV2Notify(GroupRet &groupRet)
{
// This is where the game adds the return result after calling the query union information interface
std::vector<QQGroup> groups = groupRet.mQQGroupInfoV2.qqGroups;
std::stringstream ss;
if(!groups.empty()){
for(int i = 0 ; i < groups.size(); i++){
ss << "groupId:" << groups[i].groupId << " ";
ss << "groupName:" << groups[i].groupName<< " ";
}
}
LOGD("GroupCallback OnGetGroupListV2Notify;flag:%d;errorCode:%d;desc:%s;groups:%s", groupRet.flag, groupRet.errorCode,
groupRet.desc.c_str(),ss.str().c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnGetGroupListV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;"
"groups:%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),ss.str().c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
@Override
public void OnJoinWXGroupNotify(GroupRet groupRet) {
// TODO GAME Add the callback of joining a WeChat group
Logger.d("flag:"+ groupRet.flag + ";errorCode:"+ groupRet.errorCode + ";desc:" + groupRet.desc);
if(CallbackFlag.eFlag_Succ == groupRet.flag){
MsdkCallback.sendResult("Join the group successfully.");
}else{
handleWXGroupNotifyErrorCode(groupRet);
}
}
@Override
public void OnCreateWXGroupNotify(GroupRet groupRet) {
// TODO GAME Add the callback of creating a WeChat group
Logger.d("flag:"+ groupRet.flag + ";errorCode:"+ groupRet.errorCode + ";desc:" + groupRet.desc);
if(CallbackFlag.eFlag_Succ == groupRet.flag){
MsdkCallback.sendResult("Create a group successfully.");
}else{
handleWXGroupNotifyErrorCode(groupRet);
}
}
//Note: This (query WeChat group status) callback is only available in msdk 2.17.1a and later versions
@Override
public void OnQueryWXGroupStatusNotify(GroupRet groupRet) {
Logger.d(groupRet.toString());
if(CallbackFlag.eFlag_Succ == groupRet.flag){
WXGroupInfo wxgroupInfo = groupRet.getWXGroupInfo();
Logger.d("Query succeeds")
if(wxgroupInfo.status == 0){//0 represents that the user has not created or joined any group
Logger.d("Have not created or joined any group")
}elseif(wxgroupInfo.status == 1){//represent that the user has created or joined some groups
Logger.d("Have created or joined some groups")
}
}else{
Logger.d("Query fails!")
}
}
public void handleWXGroupNotifyErrorCode(GroupRet groupRet){
if(CallbackFlag.eFlag_Succ != groupRet.flag){
switch (groupRet.errorCode) {
case CallbackFlag.eFlag_WX_UserCancel:
MsdkCallback.sendResult("The user cancels");
break;
case CallbackFlag.eFlag_WX_Group_IDHadCreatedToday:
MsdkCallback.sendResult("A group has been created today; each ID can only create a group chat a day");
break;
case CallbackFlag.eFlag_WX_Group_JoinAmountBeyond:
MsdkCallback.sendResult("The number of groups joined with the ID exceeds the upper limit; an ID can join not more than 2 groups a day");
break;
case CallbackFlag.eFlag_WX_Group_HasNoAuthority:
MsdkCallback.sendResult("The game doesn't have the permission to create a group");
break;
case CallbackFlag.eFlag_WX_Group_AmountBeyond:
MsdkCallback.sendResult("The number of created or unbound groups exceeds the upper limit; one user can create or unbind not more than 5 groups");
break;
case CallbackFlag.eFlag_WX_Group_HadExist:
MsdkCallback.sendResult("WeChat group has already existed");
break;
case CallbackFlag.eFlag_WX_Group_IDNotExist:
MsdkCallback.sendResult("Group ID doesn't exist");
break;
case CallbackFlag.eFlag_WX_Group_ParameterError:
MsdkCallback.sendResult("Parameter inspection error");
break;
case CallbackFlag.eFlag_Error:
MsdkCallback.sendResult("Unknown error. Please refer to WeChat's error codes");
break;
default:
MsdkCallback.sendResult("System error,("+groupRet.errorCode+"), Please try again");
break;
}
}
}
6)Special description
None
7)Name interpretation
GroupRet definition description
Mobile QQ group function new version V2 (3.2.5a and higher versions)
1 Summary
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
public static 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
class GroupCallback : public WGGroupObserver
{
// QQ V2 group interface callback
virtual void OnCreateGroupV2Notify(GroupRet& groupRet)
{
LOGD("GroupCallback OnCreateGroupV2Notify;flag:%d;errorCode:%d;desc:%s", groupRet.flag, groupRet.errorCode,
groupRet.desc.c_str());
int size = groupRet.mQQGroupInfoV2.qqGroups.size();
std::string groupName = "";
std::string groupId = "";
if(size > 0){
groupName = groupRet.mQQGroupInfoV2.qqGroups[0].groupName;
groupId = groupRet.mQQGroupInfoV2.qqGroups[0].groupId;
}
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnCreateGroupV2Notify;flag:%d;errorCode:%d;desc:%s;groupSize:%d;"
"groupName:%s;groupId:%s", groupRet
.flag,
groupRet.errorCode, groupRet.desc.c_str(),size,groupName.c_str(),groupId.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnJoinGroupV2Notify(GroupRet &groupRet)
{
LOGD("QQGroupCallback OnJoinGroupV2Notify;flag:%d;errorCode:%d;desc:%s", groupRet.flag, groupRet.errorCode,
groupRet.desc.c_str());
char buffer[512];
snprintf(buffer, 512, "QQGroupCallback OnJoinGroupV2Notify;flag:%d;errorCode:%d;desc:%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnQueryGroupInfoV2Notify(GroupRet &groupRet)
{
// The game adds the logic after the query group information is returned here
LOGD("GroupCallback OnQueryGroupInfoV2Notify;flag:%d;errorCode:%d;desc:%s;relation:%d", groupRet.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupRet.mQQGroupInfoV2.relation);
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnQueryGroupInfoV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;relation:%d",
groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupRet.mQQGroupInfoV2.relation);
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnUnbindGroupV2Notify(GroupRet &groupRet)
{
// This is where the game adds the return result after the call unbinds the interface
std::string groupId = "";
std::vector<QQGroup> groups = groupRet.mQQGroupInfoV2.qqGroups;
if(!groups.empty()){
groupId = groups[0].groupId;
}
LOGD("GroupCallback OnUnbindGroupV2Notify;flag:%d;errorCode:%d;desc:%s;groupId%s", groupRet.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupId.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnUnbindGroupV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;groupId%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupId.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnBindExistGroupV2Notify(GroupRet &groupRet)
{
// The game returns the result after adding the call to bind the existing group interface
std::string groupId = "";
std::vector<QQGroup> groups = groupRet.mQQGroupInfoV2.qqGroups;
if(!groups.empty()){
groupId = groups[0].groupId;
}
LOGD("GroupCallback OnBindExistGroupV2Notify;flag:%d;errorCode:%d;desc:%s;groupId%s", groupRet.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupId.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnBindExistGroupV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;groupId%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupId.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnGetGroupCodeV2Notify(GroupRet &groupRet)
{
// The game adds a call here to get the return result after the group interface is retrieved
std::string groupId = "";
std::string groupName = "";
std::vector<QQGroup> groups = groupRet.mQQGroupInfoV2.qqGroups;
if(!groups.empty()){
groupId = groups[0].groupId;
groupName = groups[0].groupName;
}
LOGD("GroupCallback OnGetGroupCodeV2Notify;flag:%d;errorCode:%d;desc:%s;groupId:%s;groupName:%s", groupRet
.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupId.c_str(),groupName.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnGetGroupCodeV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;"
"groupId:%s;groupName:%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupId.c_str(),groupName.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnQueryBindGuildV2Notify(GroupRet &groupRet)
{
// This is where the game adds the return result after calling the query union information interface
LOGD("GroupCallback OnQueryBindGuildV2Notify;flag:%d;errorCode:%d;desc:%s;guildId:%s;guildName:%s", groupRet
.flag, groupRet
.errorCode,
groupRet.desc.c_str(),groupRet.mQQGroupInfoV2.guildId.c_str(),groupRet.mQQGroupInfoV2.guildName.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnQueryBindGuildV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;"
"guildId:%s;guildName:%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),groupRet.mQQGroupInfoV2.guildId.c_str(),groupRet.mQQGroupInfoV2.guildName.c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnRemindGuildLeaderV2Notify(GroupRet &groupRet)
{
// This is where the game adds the return result after the call to alert the binding group interface
LOGD("GroupCallback OnRemindGuildLeaderV2Notify;flag:%d;errorCode:%d;desc:%s", groupRet
.flag, groupRet
.errorCode,
groupRet.desc.c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnRemindGuildLeaderV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
virtual void OnGetGroupListV2Notify(GroupRet &groupRet)
{
// This is where the game adds the return result after calling the query union information interface
std::vector<QQGroup> groups = groupRet.mQQGroupInfoV2.qqGroups;
std::stringstream ss;
if(!groups.empty()){
for(int i = 0 ; i < groups.size(); i++){
ss << "groupId:" << groups[i].groupId << " ";
ss << "groupName:" << groups[i].groupName<< " ";
}
}
LOGD("GroupCallback OnGetGroupListV2Notify;flag:%d;errorCode:%d;desc:%s;groups:%s", groupRet.flag, groupRet.errorCode,
groupRet.desc.c_str(),ss.str().c_str());
char buffer[512];
snprintf(buffer, 512, "GroupCallback OnGetGroupListV2Notify;flag:%d;errorCode:%d;desc:%s;msg:%s;"
"groups:%s", groupRet.flag,
groupRet.errorCode, groupRet.desc.c_str(),handlerWXErrorCode(groupRet).c_str(),ss.str().c_str());
buffer[511] = '\0';
displayResult(std::string(buffer));
}
};
6)Special description
After MSDK 3.2 version, all group interfaces of V2 use the new V2 group callbacks
7)Name interpretation
3 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 WGPlatform::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 = new GameGuild ();
gameGuild.guildName = "msdk"
gameGuild.guildId = "100703379";
gameGuild.roleId = "Jing Jing";
gameGuild.partition = "10"
gameGuild.zoneId = "100";
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
4 Call the interface of querying the relationship between the player and QQ group (v2)
1)Function description
Query the relations with QQ group; the result will be called back to the game via WGGroupObserver's OnQueryGroupInfoV2Notify.
2)Interface declaration
void WGQueryQQGroupInfoV2(const char *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 OnQueryGroupInfoV2Notify of WGGroupObserver.
5)Demo code:
WGPlatform::GetInstance()->WGQueryQQGroupInfoV2("10001");
6)Special description
None
7)Name interpretation
None
5 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 OnJoinGroupV2Notify of WGGroupObserver.
2)Interface declaration
Pay attention to the order of parameters passed when the function is called
void WGJoinQQGroupV2(GameGuild &gameGuild,const char *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 OnJoinGroupV2Notify of WGGroupObserver.
5)Demo code:
GameGuild gameGuild = new GameGuild ();
gameGuild.guildId = "100703379";
gameGuild.roleId = "Jing Jing";
gameGuild.partition = "10"
gameGuild.zoneId = "100";
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)Name interpretation
None
6 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 OnUnbindGroupV2Notify 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 OnUnbindGroupV2Notify of WGGroupObserver.
5)Demo code:
GameGuild gameGuild = new GameGuild ();
gameGuild.guildId = "100703379";
gameGuild.guildName = "msdk"
gameGuild.zoneId = "100";
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)Name interpretation
None
7 Call the interface of binding the existing mobile QQ group (v2)
1) Function description
Bind the existing mobile QQ group,the result can be called back to the game via OnBindExistGroupV2Notify of WGGroupObserver.
2) Interface declaration
void WGBindExistQQGroupV2(GameGuild &gameGuild,const char *groupId,const char *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, the result can be called back to the game via OnBindExistGroupV2Notify of WGGroupObserver.
5) Demo code:
GameGuild gameGuild = new GameGuild ();
gameGuild.guildId = "100703379";
gameGuild.roleId = "10"
gameGuild.zoneId = "100";
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
8 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,the result can be called back to the game via OnGetGroupCodeV2Notify of WGGroupObserver.
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,the result can be called back to the game via OnGetGroupCodeV2Notify of WGGroupObserver.
5) Demo code:
GameGuild gameGuild = new GameGuild ();
gameGuild.guildId = "100703379";
gameGuild.roleId = "10"
gameGuild.zoneId = "100";
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
9 Call the interface of querying guilds bound by a group (v2)
1) Function description
Query guilds bound by the specified group,the result can be called back to the game via OnQueryBindGuildV2Notify of WGGroupObserver.
2) Interface declaration
void WGQueryBindGuildV2(const char *groupId, const int type = 0);
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,the result can be called back to the game via OnQueryBindGuildV2Notify of WGGroupObserver.
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
10 Call the interface of querying the list of created QQ groups (v2)
1) Function description
Query the list of created QQ groups,the result can be called back to the game via OnGetGroupListV2Notify of WGGroupObserver.
2) Interface declaration
void WGGetQQGroupListV2();
3) Parameter description
None
4) Return value
None,the result can be called back to the game via OnGetGroupListV2Notify of WGGroupObserver.
5) Demo code:
WGPlatform::GetInstance()->WGGetQQGroupListV2();
6) Special description
None
7) Term interpretation
None
11 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,the result can be called back to the game via OnRemindGuildLeaderV2Notify of WGGroupObserver.
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,the result can be called back to the game via OnRemindGuildLeaderV2Notify of WGGroupObserver.
5) Demo code:
GameGuild gameGuild = new GameGuild ();
gameGuild.guildId = "100703379";
gameGuild.roleId = "12";
gameGuild.roleName = "Jing Jing"
gameGuild.zoneId = "100";
gameGuild.leaderOpenid = "78AADD8DC9CF80E655EE68039B1D02C9";
gameGuild.leaderZoneId= "1234";
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 first register the group's functional callback and then call WeChat group's functional interface according to the recommended workflow. After these, you can access WeChat group functions Please refer to Registration group functional callback The interface calling workflow is shown in the following diagram:
2 Registration callback
Please refer to Registration group functional callback
3 Call the interface used to 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. The result will be called back to the game via WGGroupObserver's OnQueryGroupInfoNotify.
2)Interface declaration
public static void WGQueryWXGroupInfo(String unionid,String openIdList);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionid | String | guild id |
openIdList | String | check if it is the list of in-group users' openid, which should be separated with comma |
4)Return value
None; the call result will be called back to the game via WGGroupObserver's OnQueryGroupInfoNotify.
5)Demo code
WGPlatform.WGQueryWXGroupInfo ("union1", "openid"););
6)Special description
None
7)Name interpretation
None
4 Call the interface used to create the guild's WeChat group
1)Function description
In the game, create the guild's WeChat group. The result will be called back to the game via WGGroupObserver's OnCreateWXGroupNotify.
2)Interface declaration
public static void WGCreateWXGroup(String unionid,String chatRoomName,String chatRoomNickName);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionid | String | guild id |
chatRoomName | String | chat group name |
chatRoomNickName | String | the user's self-defined nickname in the chat group |
4)Return value
None; the result will be called back to the game via WGGroupObserver's OnCreateWXGroupNotify.
5)Demo code
WGPlatform.WGCreateWXGroup ("union1", "MSDK guild", "the user's group nickname");
6)Special description
None
7)Name interpretation
None
5 Call the interface used to join the guild's WeChat group
1)Function description
In the game, join the guild's WeChat group. The result will be called back to the game via WGGroupObserver's OnJoinWXGroupNotify.
2)Interface declaration
public static void WGJoinWXGroup(String unionid,String chatRoomNickName);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionid | String | guild id |
chatRoomNickName | String | the user's self-defined nickname in the chat group |
4)Return value
None; the result will be called back to the game via WGGroupObserver's OnJoinWXGroupNotify.
5)Demo code
WGPlatform.WGJoinWXGroup ("union1", "the user's group nickname");
6)Special description
None
7)Name interpretation
None
6 Call the interface to query WeChat group status(2.17.1a and higher versions)
1)Function description
In the game, query whether the specified guild id has created or joined any group. The result will be called back to the game via WGGroupObserver's OnQueryWXGroupStatusNotify.
2)Interface declaration
public static void WGQueryWXGroupStatus(String unionid, eStatusType type);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionid | String | guild group id |
type | eStatusType | Enumeration type: ISCREATED (whether or not create a group), ISJONINED (whether or not join a group) |
4)Return value
None; the result will be called back to the game via WGGroupObserver's OnQueryWXGroupStatusNotify.
5)Demo code
WGPlatform.WGQueryWXGroupStatus ("union1", eStatusType.ISCREATED);
6)Special description
None
7)Name interpretation
None
7 Call the interface to unbind WeChat group (2.17.1a and higher versions)
1)Function description
In the game, unbind the specified guild group, the result will be called back to the game via WGGroupObserver's OnUnbindGroupNotify.
2)Interface declaration
public static void WGUnbindWeiXinGroup(String unionid);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
unionid | String | guild id |
4)Return value
None; the result will be called back to the game via WGGroupObserver's OnUnbindGroupNotify.
5)Demo code
WGPlatform.WGUnbindWeiXinGroup ("union1");
6)Special description
None
7)Name interpretation
None
FAQ
- If a QQ group is disbanded, there are two ways to cancel its binding relations:
- The president calls the unbinding interface to unbind the group's relations;
- 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.