mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-22 10:19:23 +08:00
feat: 获取群成员详情
This commit is contained in:
parent
80718a2af5
commit
826e504fb3
@ -36,6 +36,7 @@
|
||||
57.获取消息语音文件
|
||||
58.登录二维码
|
||||
59.邀请入群
|
||||
60.获取群/群成员详情
|
||||
|
||||
|
||||
### 接口文档:
|
||||
@ -1694,4 +1695,52 @@
|
||||
响应:
|
||||
``` javascript
|
||||
{"code":1,"result":"OK"}
|
||||
```
|
||||
|
||||
|
||||
#### 60.群/群成员详情**
|
||||
###### 接口功能
|
||||
> 邀请入群
|
||||
|
||||
###### 接口地址
|
||||
> [/api/?type=60](/api/?type=60)
|
||||
|
||||
###### HTTP请求方式
|
||||
> POST JSON
|
||||
|
||||
###### 请求参数
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|wxid|string|wxid|
|
||||
|
||||
|
||||
|
||||
###### 返回字段
|
||||
|返回字段|字段类型|说明 |
|
||||
|---|---|---|
|
||||
|code|int|返回状态,1成功, 非0失败|
|
||||
|result|string|成功提示|
|
||||
|
||||
|
||||
|
||||
|
||||
###### 接口示例
|
||||
入参:
|
||||
``` javascript
|
||||
{
|
||||
"wxid":"wxid_8888"
|
||||
}
|
||||
|
||||
```
|
||||
响应:
|
||||
``` javascript
|
||||
{
|
||||
"account": "lllla",
|
||||
"code": 1,
|
||||
"headImage": "",
|
||||
"nickname": "昵称",
|
||||
"result": "OK",
|
||||
"v3": "v3_020b3sssd031xxxxx05@stranger",
|
||||
"wxid": "wxid_888888"
|
||||
}
|
||||
```
|
@ -73,6 +73,7 @@ typedef enum HTTP_API_ROUTE {
|
||||
WECHAT_GET_VOICE,
|
||||
WECHAT_GET_QRCODE,
|
||||
WECHAT_INVITE_MEMBERS,
|
||||
WECHAT_GET_MEMBER_PROFILE,
|
||||
} WECHAT_HTTP_APIS,
|
||||
*PWECHAT_HTTP_APIS;
|
||||
|
||||
|
@ -217,4 +217,42 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
int ContactMgr::GetContactByWxid(wchar_t *wxid,ContactProfile& profile){
|
||||
int success = -1;
|
||||
char buff[0x440] = {0};
|
||||
WeChatString pri(wxid);
|
||||
DWORD contact_mgr_addr = base_addr_ + WX_CONTACT_MGR_OFFSET;
|
||||
DWORD get_contact_addr = base_addr_ + WX_GET_CONTACT_OFFSET;
|
||||
DWORD free_contact_addr = base_addr_ + WX_FREE_CONTACT_OFFSET;
|
||||
__asm {
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
CALL contact_mgr_addr
|
||||
LEA ECX,buff
|
||||
PUSH ECX
|
||||
LEA ECX,pri
|
||||
PUSH ECX
|
||||
MOV ECX,EAX
|
||||
CALL get_contact_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
success = 0;
|
||||
profile.wxid = READ_WSTRING(buff, 0x10);
|
||||
profile.account = READ_WSTRING(buff, 0x24);
|
||||
profile.v3 = READ_WSTRING(buff, 0x38);
|
||||
profile.nickname = READ_WSTRING(buff, 0x6C);
|
||||
profile.head_image = READ_WSTRING(buff, 0x110);
|
||||
__asm {
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
LEA ECX,buff
|
||||
CALL free_contact_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
success = 1;
|
||||
return success;
|
||||
}
|
||||
} // namespace wxhelper
|
@ -15,6 +15,7 @@ class ContactMgr : public BaseMgr {
|
||||
std::wstring GetContactOrChatRoomNickname(wchar_t* id);
|
||||
int AddFriendByWxid(wchar_t* wxid,wchar_t* msg);
|
||||
int VerifyApply(wchar_t *v3, wchar_t *v4,int permission);
|
||||
int GetContactByWxid(wchar_t* wxid,ContactProfile& profile);
|
||||
};
|
||||
} // namespace wxhelper
|
||||
|
||||
|
@ -591,7 +591,32 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
case WECHAT_GET_MEMBER_PROFILE: {
|
||||
wstring pri_id = GetWStringParam(j_param, "wxid");
|
||||
ContactProfile profile;
|
||||
int success =
|
||||
g_context.contact_mgr->GetContactByWxid(WS2LPWS(pri_id),profile);
|
||||
if(success==1){
|
||||
json ret_data = {
|
||||
{"code", success},
|
||||
{"result", "OK"},
|
||||
{"account", Utils::WstringToUTF8(profile.account)},
|
||||
{"headImage", Utils::WstringToUTF8(profile.head_image)},
|
||||
{"nickname", Utils::WstringToUTF8(profile.nickname)},
|
||||
{"v3", Utils::WstringToUTF8(profile.v3)},
|
||||
{"wxid", Utils::WstringToUTF8(profile.wxid)},
|
||||
};
|
||||
ret = ret_data.dump();
|
||||
} else {
|
||||
json ret_data = {{"result", "ok"}, {"code", success}};
|
||||
ret = ret_data.dump();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
json ret_data = {{"result", "ERROR"}, {"msg", "not support api"}};
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -778,4 +778,12 @@ struct Unkown{
|
||||
DWORD field5= 0;
|
||||
DWORD field6= 0;
|
||||
};
|
||||
|
||||
struct ContactProfile{
|
||||
std::wstring wxid;
|
||||
std::wstring account;
|
||||
std::wstring v3;
|
||||
std::wstring nickname;
|
||||
std::wstring head_image;
|
||||
};
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user