feat: 建群

This commit is contained in:
hugy 2023-07-29 10:03:59 +08:00
parent 17aff3b6aa
commit 1268d37a57
5 changed files with 76 additions and 1 deletions

View File

@ -874,7 +874,7 @@ enableHttp=0时使用ipport的tcp服务回传消息。
``` ```
#### 16.hook日志** #### 17.hook日志**
###### 接口功能 ###### 接口功能
> hook微信日志输出在wechat安装目录的logs目录下 > hook微信日志输出在wechat安装目录的logs目录下
@ -954,3 +954,43 @@ enableHttp=0时使用ipport的tcp服务回传消息。
"msg": "success" "msg": "success"
} }
``` ```
#### 19.建群**
###### 接口功能
> 建群(不建议使用,容易被封,测试期间被封了,无法保证效果)
###### 接口地址
> [/api/createChatRoom](/api/createChatRoom)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|memberIds|string|群成员id以,分割|
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,0成功, -1失败|
|msg|string|成功提示|
|data|object|null|
###### 接口示例
入参:
``` javascript
```
响应:
``` javascript
{
"code": 1,
"data": null,
"msg": "success"
}
```

View File

@ -380,6 +380,14 @@ 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/createChatRoom")) {
std::vector<std::wstring> wxids = GetArrayParam(j_param, "memberIds");
INT64 success =
wxhelper::GlobalContext::GetInstance().mgr->CreateChatRoom(wxids);
nlohmann::json ret_data = {
{"code", success}, {"msg", "success"}, {"data", {}}};
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

@ -552,4 +552,25 @@ INT64 Manager::InviteMemberToChatRoom(const std::wstring &room_id,
reinterpret_cast<UINT64>(&temp)); reinterpret_cast<UINT64>(&temp));
return success; return success;
} }
INT64 Manager::CreateChatRoom(const std::vector<std::wstring>& wxids){
INT64 success = -1;
UINT64 get_chat_room_mgr_addr = base_addr_ + offset::kChatRoomMgr;
UINT64 create_chat_room_addr = base_addr_ + offset::kCreateChatRoom;
func::__GetChatRoomMgr get_chat_room_mgr =
(func::__GetChatRoomMgr)get_chat_room_mgr_addr;
func::__CreateChatRoom create_chat_room =
(func::__CreateChatRoom)create_chat_room_addr;
std::vector<prototype::WeChatString> wxid_list;
common::VectorInner *list = (common::VectorInner *)&wxid_list;
INT64 head = (INT64)&list->start;
for (int i = 0; i < wxids.size(); i++) {
prototype::WeChatString id(wxids[i]);
wxid_list.push_back(id);
}
INT64 end = list->end;
UINT64 mgr = get_chat_room_mgr();
success = create_chat_room(mgr, head, end);
return success;
}
} // namespace wxhelper } // namespace wxhelper

View File

@ -29,6 +29,7 @@ class Manager {
INT64 RemoveTopMsg(const std::wstring& room_id,ULONG64 msg_id); INT64 RemoveTopMsg(const std::wstring& room_id,ULONG64 msg_id);
INT64 InviteMemberToChatRoom(const std::wstring& room_id, INT64 InviteMemberToChatRoom(const std::wstring& room_id,
const std::vector<std::wstring>& wxids); const std::vector<std::wstring>& wxids);
INT64 CreateChatRoom(const std::vector<std::wstring>& wxids);
private: private:
UINT64 base_addr_; UINT64 base_addr_;

View File

@ -237,6 +237,9 @@ typedef UINT64 (*__DoTopMsg)(UINT64,UINT64);
typedef UINT64 (*__RemoveTopMsg)(UINT64,UINT64,UINT64); typedef UINT64 (*__RemoveTopMsg)(UINT64,UINT64,UINT64);
typedef UINT64 (*__InviteMemberToChatRoom)(UINT64,UINT64,UINT64,UINT64); typedef UINT64 (*__InviteMemberToChatRoom)(UINT64,UINT64,UINT64,UINT64);
typedef UINT64 (*__CreateChatRoom)(UINT64,UINT64,UINT64);
} // namespace function } // namespace function
namespace prototype { namespace prototype {
@ -338,6 +341,8 @@ const UINT64 kRemoveTopMsg = 0xe787b0;
const UINT64 kInviteMember = 0xe63650; const UINT64 kInviteMember = 0xe63650;
const UINT64 kHookLog = 0x1304e60; const UINT64 kHookLog = 0x1304e60;
const UINT64 kCreateChatRoom = 0xe63340;
} // namespace offset } // namespace offset
} // namespace V3_9_5_81 } // namespace V3_9_5_81