diff --git a/doc/3.9.5.81.md b/doc/3.9.5.81.md index 8958bfc..8f3b8c6 100644 --- a/doc/3.9.5.81.md +++ b/doc/3.9.5.81.md @@ -874,7 +874,7 @@ enableHttp=0时,使用ip,port的tcp服务回传消息。 ``` -#### 16.hook日志** +#### 17.hook日志** ###### 接口功能 > hook微信日志,输出在wechat安装目录的logs目录下 @@ -953,4 +953,44 @@ enableHttp=0时,使用ip,port的tcp服务回传消息。 "data": null, "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" +} ``` \ No newline at end of file diff --git a/src/http_server_callback.cc b/src/http_server_callback.cc index f4f1b7e..7694606 100644 --- a/src/http_server_callback.cc +++ b/src/http_server_callback.cc @@ -380,6 +380,14 @@ std::string HttpDispatch(struct mg_connection *c, struct mg_http_message *hm) { {"code", success}, {"msg", "success"}, {"data", {}}}; ret = ret_data.dump(); return ret; + } else if (mg_http_match_uri(hm, "/api/createChatRoom")) { + std::vector 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 { nlohmann::json ret_data = { {"code", 200}, {"data", {}}, {"msg", "not support url"}}; diff --git a/src/manager.cc b/src/manager.cc index 5fa99ec..9bf4e53 100644 --- a/src/manager.cc +++ b/src/manager.cc @@ -552,4 +552,25 @@ INT64 Manager::InviteMemberToChatRoom(const std::wstring &room_id, reinterpret_cast(&temp)); return success; } + +INT64 Manager::CreateChatRoom(const std::vector& 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 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 \ No newline at end of file diff --git a/src/manager.h b/src/manager.h index 1a5edb9..f1edf3c 100644 --- a/src/manager.h +++ b/src/manager.h @@ -29,6 +29,7 @@ class Manager { INT64 RemoveTopMsg(const std::wstring& room_id,ULONG64 msg_id); INT64 InviteMemberToChatRoom(const std::wstring& room_id, const std::vector& wxids); + INT64 CreateChatRoom(const std::vector& wxids); private: UINT64 base_addr_; diff --git a/src/wechat_function.h b/src/wechat_function.h index 028a80b..9656d40 100644 --- a/src/wechat_function.h +++ b/src/wechat_function.h @@ -237,6 +237,9 @@ typedef UINT64 (*__DoTopMsg)(UINT64,UINT64); typedef UINT64 (*__RemoveTopMsg)(UINT64,UINT64,UINT64); typedef UINT64 (*__InviteMemberToChatRoom)(UINT64,UINT64,UINT64,UINT64); +typedef UINT64 (*__CreateChatRoom)(UINT64,UINT64,UINT64); + + } // namespace function namespace prototype { @@ -338,6 +341,8 @@ const UINT64 kRemoveTopMsg = 0xe787b0; const UINT64 kInviteMember = 0xe63650; const UINT64 kHookLog = 0x1304e60; +const UINT64 kCreateChatRoom = 0xe63340; + } // namespace offset } // namespace V3_9_5_81