mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-25 03:39:24 +08:00
feat:收藏
This commit is contained in:
parent
e9a6e0da57
commit
129bb55c36
@ -1176,3 +1176,93 @@ enableHttp=0时,使用ip,port的tcp服务回传消息。
|
||||
"msg": "success"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### 24.收藏消息**
|
||||
###### 接口功能
|
||||
> 收藏消息
|
||||
|
||||
###### 接口地址
|
||||
> [/api/addFavFromMsg](/api/addFavFromMsg)
|
||||
|
||||
###### HTTP请求方式
|
||||
> POST JSON
|
||||
|
||||
###### 请求参数
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|msgId|number|消息id|
|
||||
|
||||
|
||||
|
||||
###### 返回字段
|
||||
|返回字段|字段类型|说明 |
|
||||
|---|---|---|
|
||||
|code|int|返回状态,1成功, -1失败|
|
||||
|msg|string|成功提示|
|
||||
|data|object|null|
|
||||
|
||||
|
||||
###### 接口示例
|
||||
|
||||
入参:
|
||||
``` javascript
|
||||
{
|
||||
|
||||
"msgId":123
|
||||
}
|
||||
|
||||
```
|
||||
响应:
|
||||
``` javascript
|
||||
{
|
||||
"code": 1,
|
||||
"data": null,
|
||||
"msg": "success"
|
||||
}
|
||||
```
|
||||
|
||||
#### 24.收藏图片**
|
||||
###### 接口功能
|
||||
> 收藏图片
|
||||
|
||||
###### 接口地址
|
||||
> [/api/addFavFromImage](/api/addFavFromImage)
|
||||
|
||||
###### HTTP请求方式
|
||||
> POST JSON
|
||||
|
||||
###### 请求参数
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|wxid|string|wxid|
|
||||
|imagePath|string|图片地址|
|
||||
|
||||
|
||||
###### 返回字段
|
||||
|返回字段|字段类型|说明 |
|
||||
|---|---|---|
|
||||
|code|int|返回状态,1成功, -1失败|
|
||||
|msg|string|成功提示|
|
||||
|data|object|null|
|
||||
|
||||
|
||||
###### 接口示例
|
||||
|
||||
入参:
|
||||
``` javascript
|
||||
{
|
||||
|
||||
"wxid":"wxid_12333",
|
||||
"imagePath":"C:\\test\\test.png"
|
||||
}
|
||||
|
||||
```
|
||||
响应:
|
||||
``` javascript
|
||||
{
|
||||
"code": 1,
|
||||
"data": null,
|
||||
"msg": "success"
|
||||
}
|
||||
```
|
@ -304,6 +304,63 @@ def forwardMsg():
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
print(response.text)
|
||||
|
||||
def getSNSFirstPage():
|
||||
url = "127.0.0.1:19088/api/getSNSFirstPage"
|
||||
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
print(response.text)
|
||||
|
||||
def getSNSNextPage():
|
||||
print("modify snsId ")
|
||||
raise RuntimeError("modify snsId then deleted me")
|
||||
url = "127.0.0.1:19088/api/getSNSNextPage"
|
||||
|
||||
payload = json.dumps({
|
||||
"snsId": ""
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
print(response.text)
|
||||
|
||||
def addFavFromMsg():
|
||||
print("modify msgId ")
|
||||
raise RuntimeError("modify msgId then deleted me")
|
||||
url = "127.0.0.1:19088/api/addFavFromMsg"
|
||||
|
||||
payload = json.dumps({
|
||||
"msgId": "1222222"
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
print(response.text)
|
||||
|
||||
def addFavFromImage():
|
||||
print("modify wxid imagePath ")
|
||||
raise RuntimeError("modify wxid imagePath then deleted me")
|
||||
url = "127.0.0.1:19088/api/addFavFromImage"
|
||||
|
||||
payload = json.dumps({
|
||||
"wxid": "",
|
||||
"imagePath": ""
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
print(response.text)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
checkLogin()
|
||||
|
@ -450,6 +450,23 @@ 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/addFavFromMsg")) {
|
||||
UINT64 msg_id = GetUINT64Param(j_param, "msgId");
|
||||
INT64 success =
|
||||
wxhelper::GlobalContext::GetInstance().mgr->AddFavFromMsg(msg_id);
|
||||
nlohmann::json ret_data = {
|
||||
{"code", success}, {"msg", "success"}, {"data", {}}};
|
||||
ret = ret_data.dump();
|
||||
return ret;
|
||||
} else if (mg_http_match_uri(hm, "/api/addFavFromImage")) {
|
||||
std::wstring wxid = GetWStringParam(j_param, "wxid");
|
||||
std::wstring image_path = GetWStringParam(j_param, "imagePath");
|
||||
INT64 success = wxhelper::GlobalContext::GetInstance().mgr->AddFavFromImage(
|
||||
wxid, image_path);
|
||||
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"}};
|
||||
|
@ -629,4 +629,58 @@ INT64 Manager::GetSNSNextPage(UINT64 sns_id) {
|
||||
success = sns_next_page(mgr, sns_id);
|
||||
return success;
|
||||
}
|
||||
|
||||
INT64 Manager::AddFavFromMsg(UINT64 msg_id) {
|
||||
INT64 success = -1;
|
||||
UINT64 get_chat_mgr_addr = base_addr_ + offset::kGetChatMgr;
|
||||
UINT64 get_by_local_id_addr = base_addr_ + offset::kGetMgrByPrefixLocalId;
|
||||
UINT64 add_fav_addr = base_addr_ + offset::kAddFavFromMsg;
|
||||
UINT64 get_favorite_mgr_addr = base_addr_ + offset::kGetFavoriteMgr;
|
||||
UINT64 free_chat_msg_addr = base_addr_ + offset::kFreeChatMsg;
|
||||
func::__GetMgrByPrefixLocalId get_by_local_id = (func::__GetMgrByPrefixLocalId)get_by_local_id_addr;
|
||||
UINT64 new_chat_msg_addr = base_addr_ + offset::kChatMsgInstanceCounter;
|
||||
|
||||
func::__AddFavFromMsg add_fav = (func::__AddFavFromMsg)add_fav_addr;
|
||||
func::__GetChatMgr get_chat_mgr = (func::__GetChatMgr)get_chat_mgr_addr;
|
||||
func::__GetFavoriteMgr get_favorite_mgr = (func::__GetFavoriteMgr)get_favorite_mgr_addr;
|
||||
func::__FreeChatMsg free_chat_msg = (func::__FreeChatMsg)free_chat_msg_addr;
|
||||
func::__NewChatMsg new_chat_msg = (func::__NewChatMsg)new_chat_msg_addr;
|
||||
|
||||
INT64 index = 0;
|
||||
INT64 local_id = DB::GetInstance().GetLocalIdByMsgId(msg_id, index);
|
||||
if (local_id <= 0 || index >> 32 == 0) {
|
||||
success = -2;
|
||||
return success;
|
||||
}
|
||||
char chat_msg[0x460]= {0};
|
||||
LARGE_INTEGER l;
|
||||
l.HighPart = index >> 32;
|
||||
l.LowPart = (DWORD)local_id;
|
||||
UINT64 p_chat_msg = new_chat_msg(reinterpret_cast<UINT64>(&chat_msg));
|
||||
|
||||
get_chat_mgr();
|
||||
get_by_local_id(l.QuadPart,p_chat_msg);
|
||||
UINT64 mgr = get_favorite_mgr();
|
||||
success = add_fav(mgr,p_chat_msg);
|
||||
free_chat_msg(p_chat_msg);
|
||||
return success;
|
||||
}
|
||||
|
||||
INT64 Manager::AddFavFromImage(const std::wstring &wxid,
|
||||
const std::wstring &image_path) {
|
||||
INT64 success = -1;
|
||||
UINT64 get_favorite_mgr_addr = base_addr_ + offset::kGetFavoriteMgr;
|
||||
UINT64 add_fav_from_image_addr = base_addr_ + offset::kAddFavFromImage;
|
||||
prototype::WeChatString *send_id = BuildWechatString(wxid);
|
||||
prototype::WeChatString *path = BuildWechatString(image_path);
|
||||
func::__GetFavoriteMgr get_favorite_mgr =
|
||||
(func::__GetFavoriteMgr)get_favorite_mgr_addr;
|
||||
func::__AddFavFromImage add_fav_from_image =
|
||||
(func::__AddFavFromImage)add_fav_from_image_addr;
|
||||
UINT64 mgr = get_favorite_mgr();
|
||||
success = add_fav_from_image(mgr, reinterpret_cast<UINT64>(path),
|
||||
reinterpret_cast<UINT64>(send_id));
|
||||
return success;
|
||||
}
|
||||
|
||||
} // namespace wxhelper
|
@ -34,6 +34,9 @@ class Manager {
|
||||
INT64 ForwardMsg(UINT64 msg_id, const std::wstring& wxid);
|
||||
INT64 GetSNSFirstPage();
|
||||
INT64 GetSNSNextPage(UINT64 sns_id);
|
||||
INT64 AddFavFromMsg(UINT64 msg_id);
|
||||
INT64 AddFavFromImage(const std::wstring& wxid,
|
||||
const std::wstring& image_path);
|
||||
|
||||
private:
|
||||
UINT64 base_addr_;
|
||||
|
@ -246,6 +246,11 @@ typedef UINT64 (*__GetSNSNextPageScene)(UINT64,UINT64);
|
||||
|
||||
typedef UINT64 (*__GetSNSDataMgr)();
|
||||
typedef UINT64 (*__GetSnsTimeLineMgr)();
|
||||
typedef UINT64 (*__GetMgrByPrefixLocalId)(UINT64,UINT64);
|
||||
typedef UINT64 (*__AddFavFromMsg)(UINT64,UINT64);
|
||||
typedef UINT64 (*__GetChatMgr)();
|
||||
typedef UINT64 (*__GetFavoriteMgr)();
|
||||
typedef UINT64 (*__AddFavFromImage)(UINT64,UINT64,UINT64);
|
||||
|
||||
|
||||
} // namespace function
|
||||
@ -358,6 +363,11 @@ const UINT64 kSNSGetFirstPage = 0x1a51dd0;
|
||||
const UINT64 kSNSGetNextPageScene = 0x1a77240;
|
||||
const UINT64 kSNSDataMgr = 0xeebda0;
|
||||
const UINT64 kSNSTimeLineMgr = 0x19e83a0;
|
||||
const UINT64 kGetMgrByPrefixLocalId = 0xe4add0;
|
||||
const UINT64 kAddFavFromMsg = 0x1601520;
|
||||
const UINT64 kGetChatMgr = 0x8f0400;
|
||||
const UINT64 kGetFavoriteMgr = 0x8c69b0;
|
||||
const UINT64 kAddFavFromImage = 0x160b920;
|
||||
|
||||
} // namespace offset
|
||||
} // namespace V3_9_5_81
|
||||
|
Loading…
Reference in New Issue
Block a user