Merge pull request #214 from ttttupup/dev-3.9.5.81

Dev 3.9.5.81
This commit is contained in:
ttttupup 2023-07-14 22:28:57 +08:00 committed by GitHub
commit e0c946bf72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 213 additions and 2 deletions

View File

@ -642,3 +642,98 @@ enableHttp=0时使用ipport的tcp服务回传消息。
``` javascript ``` javascript
{"code":1,"msg":"success","data":null} {"code":1,"msg":"success","data":null}
``` ```
#### 12.删除群成员**
###### 接口功能
> 删除群成员
###### 接口地址
> [/api/delMemberFromChatRoom](/api/delMemberFromChatRoom)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|chatRoomId |true |string| 群id |
|memberIds |true |string| 成员id,用,分隔 |
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,1成功, -1失败|
|msg|string|成功提示|
|data|object|null|
###### 接口示例
入参:
``` javascript
{
"chatRoomId":"1234@chatroom",
"memberIds":"wxid_123"
}
```
响应:
``` javascript
{"code":1,"msg":"success","data":null}
```
#### 13.获取群成员**
###### 接口功能
> 获取群成员
###### 接口地址
> [/api/getMemberFromChatRoom](/api/getMemberFromChatRoom)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|chatRoomId |true |string| 群id |
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,1成功, -1失败|
|msg|string|成功提示|
|data|object|null|
|  chatRoomId|string|群id|
|  members|string|成员id|
|  memberNickname|string|成员昵称|
|  admin|string|群管理|
|  adminNickname|string|管理昵称|
###### 接口示例
入参:
``` javascript
{
"chatRoomId":"1234@chatroom"
}
```
响应:
``` javascript
{
"code": 1,
"data": {
"admin": "wxid_2222",
"adminNickname": "123",
"chatRoomId": "22224@chatroom",
"memberNickname": "^G123^G^G",
"members": "wxid_2222^Gwxid_333"
},
"msg": "success"
}
```

View File

@ -101,7 +101,7 @@ VOID CALLBACK SendHttpMsgCallback(PTP_CALLBACK_INSTANCE instance, PVOID context,
return; return;
} }
std::string jstr = j_msg.dump() + "\n"; std::string jstr = j_msg.dump() + "\n";
// HttpClient::GetInstance().SendRequest(jstr); HttpClient::GetInstance().SendRequest(jstr);
} }
void HandleSyncMsg(INT64 param1, INT64 param2, INT64 param3) { void HandleSyncMsg(INT64 param1, INT64 param2, INT64 param3) {

View File

@ -307,6 +307,40 @@ std::string HttpDispatch(struct mg_connection *c, struct mg_http_message *hm) {
{"code", success}, {"msg", "success"}, {"data", {}}}; {"code", success}, {"msg", "success"}, {"data", {}}};
ret = ret_data.dump(); ret = ret_data.dump();
return ret; return ret;
} else if (mg_http_match_uri(hm, "/api/delMemberFromChatRoom")) {
std::wstring room_id = GetWStringParam(j_param, "chatRoomId");
std::vector<std::wstring> wxids = GetArrayParam(j_param, "memberIds");
std::vector<std::wstring> wxid_list;
for (unsigned int i = 0; i < wxids.size(); i++) {
wxid_list.push_back(wxids[i]);
}
INT64 success =
wxhelper::GlobalContext::GetInstance().mgr->DelMemberFromChatRoom(
room_id, wxid_list);
nlohmann::json ret_data = {
{"code", success}, {"msg", "success"}, {"data", {}}};
ret = ret_data.dump();
return ret;
} else if (mg_http_match_uri(hm, "/api/getMemberFromChatRoom")) {
std::wstring room_id = GetWStringParam(j_param, "chatRoomId");
common::ChatRoomMemberInner member;
INT64 success =
wxhelper::GlobalContext::GetInstance().mgr->GetMemberFromChatRoom(
room_id, member);
nlohmann::json ret_data = {
{"code", success}, {"msg", "success"}, {"data", {}}};
if (success >= 0) {
nlohmann::json member_info = {
{"admin", member.admin},
{"chatRoomId", member.chat_room_id},
{"members", member.member},
{"adminNickname", member.admin_nickname},
{"memberNickname", member.member_nickname},
};
ret_data["data"] = member_info;
}
ret = ret_data.dump();
return ret;
} else { } else {
nlohmann::json ret_data = { nlohmann::json ret_data = {
{"code", 200}, {"data", {}}, {"msg", "not support url"}}; {"code", 200}, {"data", {}}, {"msg", "not support url"}};

View File

@ -444,4 +444,60 @@ INT64 Manager::ModChatRoomMemberNickName(const std::wstring &room_id,
reinterpret_cast<UINT64>(self_id), reinterpret_cast<UINT64>(name)); reinterpret_cast<UINT64>(self_id), reinterpret_cast<UINT64>(name));
return success; return success;
} }
} // namespace wxhelper`
INT64 Manager::DelMemberFromChatRoom(const std::wstring &room_id,
const std::vector<std::wstring> &members) {
INT64 success = -1;
UINT64 get_chat_room_mgr_addr = base_addr_ + offset::kChatRoomMgr;
UINT64 del_members_addr = base_addr_ + offset::kDelMemberFromChatRoom;
func::__GetChatRoomMgr get_chat_room_mgr =
(func::__GetChatRoomMgr)get_chat_room_mgr_addr;
func::__DoDelMemberFromChatRoom del_members =
(func::__DoDelMemberFromChatRoom)del_members_addr;
prototype::WeChatString *chat_room_id = BuildWechatString(room_id);
std::vector<prototype::WeChatString> member_list;
UINT64 temp[2] = {0};
common::VectorInner *list = (common::VectorInner *)&member_list;
INT64 members_ptr = (INT64)&list->start;
for (int i = 0; i < members.size(); i++) {
prototype::WeChatString member(members[i]);
member_list.push_back(member);
}
UINT64 mgr = get_chat_room_mgr();
success =
del_members(mgr, members_ptr, reinterpret_cast<UINT64>(chat_room_id));
return success;
}
INT64 Manager::GetMemberFromChatRoom(const std::wstring &room_id,
common::ChatRoomMemberInner &member) {
INT64 success = -1;
UINT64 get_chat_room_mgr_addr = base_addr_ + offset::kChatRoomMgr;
UINT64 get_members_addr = base_addr_ + offset::kGetMemberFromChatRoom;
UINT64 new_chat_room_addr = base_addr_ + offset::kNewChatRoom;
UINT64 free_chat_room_addr = base_addr_ + offset::kFreeChatRoom;
func::__GetChatRoomMgr get_chat_room_mgr =
(func::__GetChatRoomMgr)get_chat_room_mgr_addr;
func::__GetMemberFromChatRoom get_members =
(func::__GetMemberFromChatRoom)get_members_addr;
func::__NewChatRoom new_chat_room = (func::__NewChatRoom)new_chat_room_addr;
func::__FreeChatRoom free_chat_room =
(func::__FreeChatRoom)free_chat_room_addr;
prototype::WeChatString chat_room_id(room_id);
char chat_room_info[0x2E0] = {0};
UINT64 addr = reinterpret_cast<UINT64>(&chat_room_info);
new_chat_room(addr);
UINT64 mgr = get_chat_room_mgr();
success = get_members(mgr, reinterpret_cast<UINT64>(&chat_room_id), addr);
member.chat_room_id = Utils::ReadWstringThenConvert(addr + 0x10);
member.admin = Utils::ReadWstringThenConvert(addr + 0x78);
member.member_nickname = Utils::ReadWstringThenConvert(addr + 0x50);
member.admin_nickname = Utils::ReadWstringThenConvert(addr + 0xA0);
member.member = Utils::ReadWeChatStr(addr + 0x30);
free_chat_room(addr);
return success;
}
} // namespace wxhelper

View File

@ -21,6 +21,10 @@ class Manager {
INT64 ModChatRoomMemberNickName(const std::wstring& room_id, INT64 ModChatRoomMemberNickName(const std::wstring& room_id,
const std::wstring& wxid, const std::wstring& wxid,
const std::wstring& nickname); const std::wstring& nickname);
INT64 DelMemberFromChatRoom(const std::wstring& room_id,
const std::vector<std::wstring>& members);
INT64 GetMemberFromChatRoom(const std::wstring& room_id,
common::ChatRoomMemberInner& member);
private: private:
UINT64 base_addr_; UINT64 base_addr_;

View File

@ -184,6 +184,20 @@ struct VectorInner {
INT64 end; INT64 end;
}; };
struct ChatRoomMemberInner {
std::string chat_room_id;
std::string admin;
std::string admin_nickname;
std::string member_nickname;
std::string member;
ChatRoomMemberInner()
: chat_room_id(""),
admin(""),
admin_nickname(""),
member_nickname(""),
member("") {}
};
} // namespace common } // namespace common
namespace V3_9_5_81 { namespace V3_9_5_81 {
namespace function { namespace function {
@ -214,6 +228,10 @@ typedef UINT64 (*__GetChatRoomDetailInfo)(UINT64,UINT64,UINT64,UINT64);
typedef UINT64 (*__DoAddMemberToChatRoom)(UINT64,UINT64,UINT64,UINT64); typedef UINT64 (*__DoAddMemberToChatRoom)(UINT64,UINT64,UINT64,UINT64);
typedef UINT64 (*__DoModChatRoomMemberNickName)(UINT64,UINT64,UINT64,UINT64); typedef UINT64 (*__DoModChatRoomMemberNickName)(UINT64,UINT64,UINT64,UINT64);
typedef UINT64 (*__DoDelMemberFromChatRoom)(UINT64,UINT64,UINT64);
typedef UINT64 (*__GetMemberFromChatRoom)(UINT64,UINT64,UINT64);
typedef UINT64 (*__NewChatRoom)(UINT64);
typedef UINT64 (*__FreeChatRoom)(UINT64);
} // namespace function } // namespace function
@ -307,6 +325,10 @@ const UINT64 kNewChatRoomInfo = 0x12006b0;
const UINT64 kFreeChatRoomInfo = 0x1200890; const UINT64 kFreeChatRoomInfo = 0x1200890;
const UINT64 kDoAddMemberToChatRoom = 0xe63c70; const UINT64 kDoAddMemberToChatRoom = 0xe63c70;
const UINT64 kDoModChatRoomMemberNickName = 0xe6db00; const UINT64 kDoModChatRoomMemberNickName = 0xe6db00;
const UINT64 kDelMemberFromChatRoom = 0xe64290;
const UINT64 kGetMemberFromChatRoom = 0xe74de0;
const UINT64 kNewChatRoom = 0x11fde50;
const UINT64 kFreeChatRoom = 0x11fe030;
} // namespace offset } // namespace offset
} // namespace V3_9_5_81 } // namespace V3_9_5_81