feat: 获取群成员详情
This commit is contained in:
1 parent
80718a2af5
commit
826e504fb3
6 files changed
+122
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user