mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-23 02:39:25 +08:00
commit
e6e72dd492
@ -985,6 +985,92 @@ enableHttp=0时,使用ip,port的tcp服务回传消息。
|
|||||||
``` javascript
|
``` javascript
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
响应:
|
||||||
|
``` javascript
|
||||||
|
{
|
||||||
|
"code": 1,
|
||||||
|
"data": null,
|
||||||
|
"msg": "success"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 20.退群**
|
||||||
|
###### 接口功能
|
||||||
|
> 退群
|
||||||
|
|
||||||
|
###### 接口地址
|
||||||
|
> [/api/quitChatRoom](/api/quitChatRoom)
|
||||||
|
|
||||||
|
###### HTTP请求方式
|
||||||
|
> POST JSON
|
||||||
|
|
||||||
|
###### 请求参数
|
||||||
|
|参数|必选|类型|说明|
|
||||||
|
|---|---|---|---|
|
||||||
|
|chatRoomId|string|群id|
|
||||||
|
|
||||||
|
|
||||||
|
###### 返回字段
|
||||||
|
|返回字段|字段类型|说明 |
|
||||||
|
|---|---|---|
|
||||||
|
|code|int|返回状态,大于0成功, -1失败|
|
||||||
|
|msg|string|成功提示|
|
||||||
|
|data|object|null|
|
||||||
|
|
||||||
|
|
||||||
|
###### 接口示例
|
||||||
|
|
||||||
|
入参:
|
||||||
|
``` javascript
|
||||||
|
{
|
||||||
|
"chatRoomId":"123456@chatroom"
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
响应:
|
||||||
|
``` javascript
|
||||||
|
{
|
||||||
|
"code": 119536579329,
|
||||||
|
"data": null,
|
||||||
|
"msg": "success"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 21.转发消息**
|
||||||
|
###### 接口功能
|
||||||
|
> 转发消息
|
||||||
|
|
||||||
|
###### 接口地址
|
||||||
|
> [/api/forwardMsg](/api/forwardMsg)
|
||||||
|
|
||||||
|
###### HTTP请求方式
|
||||||
|
> POST JSON
|
||||||
|
|
||||||
|
###### 请求参数
|
||||||
|
|参数|必选|类型|说明|
|
||||||
|
|---|---|---|---|
|
||||||
|
|wxid|string|接收人id|
|
||||||
|
|msgId|string|消息id|
|
||||||
|
|
||||||
|
|
||||||
|
###### 返回字段
|
||||||
|
|返回字段|字段类型|说明 |
|
||||||
|
|---|---|---|
|
||||||
|
|code|int|返回状态,1成功, -1失败|
|
||||||
|
|msg|string|成功提示|
|
||||||
|
|data|object|null|
|
||||||
|
|
||||||
|
|
||||||
|
###### 接口示例
|
||||||
|
|
||||||
|
入参:
|
||||||
|
``` javascript
|
||||||
|
{
|
||||||
|
"wxid":"filehelper",
|
||||||
|
"msgId":"1233312233123"
|
||||||
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
响应:
|
响应:
|
||||||
``` javascript
|
``` javascript
|
||||||
|
@ -274,6 +274,36 @@ def createChatRoom():
|
|||||||
response = requests.request("POST", url, headers=headers, data=payload)
|
response = requests.request("POST", url, headers=headers, data=payload)
|
||||||
print(response.text)
|
print(response.text)
|
||||||
|
|
||||||
|
def quitChatRoom():
|
||||||
|
print("modify chatRoomId ")
|
||||||
|
raise RuntimeError("modify chatRoomId then deleted me")
|
||||||
|
url = "127.0.0.1:19088/api/quitChatRoom"
|
||||||
|
|
||||||
|
payload = json.dumps({
|
||||||
|
"chatRoomId": "123@chatroom"
|
||||||
|
})
|
||||||
|
headers = {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.request("POST", url, headers=headers, data=payload)
|
||||||
|
print(response.text)
|
||||||
|
|
||||||
|
def forwardMsg():
|
||||||
|
print("modify msgId ")
|
||||||
|
raise RuntimeError("modify msgId then deleted me")
|
||||||
|
url = "127.0.0.1:19088/api/forwardMsg"
|
||||||
|
|
||||||
|
payload = json.dumps({
|
||||||
|
"wxid": "filehelper",
|
||||||
|
"msgId": "12331"
|
||||||
|
})
|
||||||
|
headers = {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
response = requests.request("POST", url, headers=headers, data=payload)
|
||||||
|
print(response.text)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
checkLogin()
|
checkLogin()
|
||||||
|
@ -17,7 +17,9 @@ GlobalContext::~GlobalContext() {
|
|||||||
void GlobalContext::initialize(HMODULE module) {
|
void GlobalContext::initialize(HMODULE module) {
|
||||||
state =GlobalContextState::INITIALIZING;
|
state =GlobalContextState::INITIALIZING;
|
||||||
module_ = module;
|
module_ = module;
|
||||||
// Utils::Hide(module);
|
#ifndef _DEBUG
|
||||||
|
Utils::Hide(module);
|
||||||
|
#endif
|
||||||
UINT64 base = Utils::GetWeChatWinBase();
|
UINT64 base = Utils::GetWeChatWinBase();
|
||||||
config.emplace();
|
config.emplace();
|
||||||
config->Initialize();
|
config->Initialize();
|
||||||
|
@ -24,13 +24,6 @@ class GlobalContext : public Singleton<GlobalContext> {
|
|||||||
std::unique_ptr<HttpServer> http_server;
|
std::unique_ptr<HttpServer> http_server;
|
||||||
std::unique_ptr<Manager> mgr;
|
std::unique_ptr<Manager> mgr;
|
||||||
|
|
||||||
// std::optional<ContactMgr> contact_mgr;
|
|
||||||
// std::optional<MiscMgr> misc_mgr;
|
|
||||||
// std::optional<SendMessageMgr> send_mgr;
|
|
||||||
// std::optional<AccountMgr> account_mgr;
|
|
||||||
// std::optional<ChatRoomMgr> chat_room_mgr;
|
|
||||||
// std::optional<SNSMgr> sns_mgr;
|
|
||||||
|
|
||||||
GlobalContextState state = GlobalContextState::NOT_INITIALIZED;
|
GlobalContextState state = GlobalContextState::NOT_INITIALIZED;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -183,7 +183,7 @@ std::string HttpDispatch(struct mg_connection *c, struct mg_http_message *hm) {
|
|||||||
timeout = GetIntParam(j_param, "timeout");
|
timeout = GetIntParam(j_param, "timeout");
|
||||||
}
|
}
|
||||||
INT64 success =
|
INT64 success =
|
||||||
wxhelper::hooks::HookSyncMsg(ip, port, url, timeout, false);
|
wxhelper::hooks::HookSyncMsg(ip, port, url, timeout, enable);
|
||||||
nlohmann::json ret_data = {
|
nlohmann::json ret_data = {
|
||||||
{"code", success}, {"data", {}}, {"msg", "success"}};
|
{"code", success}, {"data", {}}, {"msg", "success"}};
|
||||||
ret = ret_data.dump();
|
ret = ret_data.dump();
|
||||||
@ -406,6 +406,23 @@ 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/quitChatRoom")) {
|
||||||
|
std::wstring room_id = GetWStringParam(j_param, "chatRoomId");
|
||||||
|
INT64 success =
|
||||||
|
wxhelper::GlobalContext::GetInstance().mgr->QuitChatRoom(room_id);
|
||||||
|
nlohmann::json ret_data = {
|
||||||
|
{"code", success}, {"msg", "success"}, {"data", {}}};
|
||||||
|
ret = ret_data.dump();
|
||||||
|
return ret;
|
||||||
|
} else if (mg_http_match_uri(hm, "/api/forwardMsg")) {
|
||||||
|
INT64 msg_id = GetINT64Param(j_param, "msgId");
|
||||||
|
std::wstring wxid = GetWStringParam(j_param, "wxid");
|
||||||
|
INT64 success =
|
||||||
|
wxhelper::GlobalContext::GetInstance().mgr->ForwardMsg(msg_id,wxid);
|
||||||
|
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"}};
|
||||||
|
@ -573,4 +573,34 @@ INT64 Manager::CreateChatRoom(const std::vector<std::wstring>& wxids){
|
|||||||
success = create_chat_room(mgr, head, end);
|
success = create_chat_room(mgr, head, end);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
INT64 Manager::QuitChatRoom(const std::wstring &room_id) {
|
||||||
|
INT64 success = -1;
|
||||||
|
UINT64 get_chat_room_mgr_addr = base_addr_ + offset::kChatRoomMgr;
|
||||||
|
UINT64 quit_chat_room_addr = base_addr_ + offset::kQuitChatRoom;
|
||||||
|
func::__GetChatRoomMgr get_chat_room_mgr =
|
||||||
|
(func::__GetChatRoomMgr)get_chat_room_mgr_addr;
|
||||||
|
func::__QuitChatRoom quit_chat_room =
|
||||||
|
(func::__QuitChatRoom)quit_chat_room_addr;
|
||||||
|
UINT64 mgr = get_chat_room_mgr();
|
||||||
|
prototype::WeChatString chat_room_id(room_id);
|
||||||
|
success = quit_chat_room(mgr, reinterpret_cast<UINT64>(&chat_room_id), 0);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
INT64 Manager::ForwardMsg(UINT64 msg_id, const std::wstring &wxid) {
|
||||||
|
INT64 success = -1;
|
||||||
|
UINT64 forward_addr = base_addr_ + offset::kForwardMsg;
|
||||||
|
func::__ForwardMsg forward_msg = (func::__ForwardMsg)forward_addr;
|
||||||
|
INT64 index = 0;
|
||||||
|
INT64 local_id = DB::GetInstance().GetLocalIdByMsgId(msg_id, index);
|
||||||
|
if (local_id <= 0 || index >> 32 == 0) {
|
||||||
|
success = -2;
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
LARGE_INTEGER l;
|
||||||
|
l.HighPart = index >> 32;
|
||||||
|
l.LowPart = (DWORD)local_id;
|
||||||
|
prototype::WeChatString *recv = BuildWechatString(wxid);
|
||||||
|
success = forward_msg(reinterpret_cast<UINT64>(recv), l.QuadPart, 0x4, 0x0);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
} // namespace wxhelper
|
} // namespace wxhelper
|
@ -30,6 +30,8 @@ class Manager {
|
|||||||
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);
|
INT64 CreateChatRoom(const std::vector<std::wstring>& wxids);
|
||||||
|
INT64 QuitChatRoom(const std::wstring& room_id);
|
||||||
|
INT64 ForwardMsg(UINT64 msg_id, const std::wstring& wxid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UINT64 base_addr_;
|
UINT64 base_addr_;
|
||||||
|
@ -238,6 +238,8 @@ 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);
|
typedef UINT64 (*__CreateChatRoom)(UINT64,UINT64,UINT64);
|
||||||
|
typedef UINT64 (*__QuitChatRoom)(UINT64,UINT64,UINT64);
|
||||||
|
typedef UINT64 (*__ForwardMsg)(UINT64,UINT64,UINT64,UINT64);
|
||||||
|
|
||||||
|
|
||||||
} // namespace function
|
} // namespace function
|
||||||
@ -342,6 +344,8 @@ const UINT64 kInviteMember = 0xe63650;
|
|||||||
const UINT64 kHookLog = 0x1304e60;
|
const UINT64 kHookLog = 0x1304e60;
|
||||||
|
|
||||||
const UINT64 kCreateChatRoom = 0xe63340;
|
const UINT64 kCreateChatRoom = 0xe63340;
|
||||||
|
const UINT64 kQuitChatRoom = 0xe6e3b0;
|
||||||
|
const UINT64 kForwardMsg = 0xfcd0f0;
|
||||||
|
|
||||||
} // namespace offset
|
} // namespace offset
|
||||||
} // namespace V3_9_5_81
|
} // namespace V3_9_5_81
|
||||||
|
Loading…
Reference in New Issue
Block a user