feat:补充好友标签,增加打开url

This commit is contained in:
ttttupup 2024-01-06 13:56:51 +08:00
parent 28db38b45e
commit 2eb798458c
7 changed files with 125 additions and 1 deletions

View File

@ -43,7 +43,7 @@ void GlobalManager::initialize(HMODULE module) {
http_server->AddHttpApiUrl("/api/getLoginUrl", GetLoginUrl);
http_server->AddHttpApiUrl("/api/translateVoice", TranslateVoice);
http_server->AddHttpApiUrl("/api/getTranslateVoiceText", GetTranslateVoiceText);
http_server->AddHttpApiUrl("/api/openUrlByWeChat", OpenUrlByWeChat);
http_server->Start();
base::ThreadPool::GetInstance().Create(2, 8);

View File

@ -103,6 +103,10 @@ std::string GetContacts(mg_http_message* hm) {
{"pinyinAll", vec[i].pinyin_all},
{"reserved1", vec[i].reserved1},
{"reserved2", vec[i].reserved2},
{"remark",vec[i].remark},
{"remarkPinyin",vec[i].remark_pinyin},
{"remarkPinyinAll",vec[i].remark_pinyin_all},
{"labelIds",vec[i].label_ids},
};
ret_data["data"].push_back(item);
}
@ -321,4 +325,16 @@ std::string GetTranslateVoiceText(struct mg_http_message* hm) {
{"code", 1}, {"msg", "success"}, {"data", {{"transtext", content}}}};
return ret_data.dump();
}
std::string OpenUrlByWeChat(struct mg_http_message* hm){
nlohmann::json j_param = nlohmann::json::parse(
hm->body.ptr, hm->body.ptr + hm->body.len, nullptr, false);
std::wstring url = GetWStringParam(j_param, "url");
int flag = GetIntParam(j_param, "flag");
INT64 success =
wxhelper::WechatService::GetInstance().OpenUrlByWeChatBrowser(url,flag);
nlohmann::json ret_data = {
{"code", success}, {"msg", "success"}, {"data", {}}};
return ret_data.dump();
}
} // namespace wxhelper

View File

@ -23,6 +23,7 @@ std::string SendMultiAtText(struct mg_http_message* hm);
std::string GetLoginUrl(struct mg_http_message* hm);
std::string TranslateVoice(struct mg_http_message* hm);
std::string GetTranslateVoiceText(struct mg_http_message* hm);
std::string OpenUrlByWeChat(struct mg_http_message* hm);
} // namespace wxhelper
#endif

View File

@ -142,6 +142,10 @@ struct ContactInner {
std::string nickname;
std::string pinyin;
std::string pinyin_all;
std::string remark;
std::string remark_pinyin;
std::string remark_pinyin_all;
std::string label_ids;
DWORD type;
DWORD verify_flag;
DWORD reserved1;
@ -153,6 +157,10 @@ struct ContactInner {
nickname = "";
pinyin = "";
pinyin_all = "";
remark = "";
remark_pinyin = "";
remark_pinyin_all = "";
label_ids = "";
type = -1;
verify_flag = -1;
reserved1 = -1;
@ -296,6 +304,11 @@ typedef UINT64 (*__UpdateMsg)(UINT64,UINT64,UINT64);
typedef UINT64 (*__GetVoiceMgr)();
typedef UINT64 (*__ChatMsg2NetSceneSendMsg)(UINT64,UINT64);
typedef UINT64 (*__TranslateVoice)(UINT64,UINT64,UINT64);
typedef UINT64 (*__ShowWebView)(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
typedef UINT64 (*__NewWebViewPageConfig)(UINT64);
typedef UINT64 (*__FreeWebViewPageConfig)(UINT64);
typedef UINT64 (*__GetWebViewMgr)();
typedef UINT64 (*__SetUrl)(UINT64,UINT64,UINT64);
} // namespace function
namespace prototype {
@ -466,6 +479,11 @@ const UINT64 kUpdateMsg = 0xf15c40;
const UINT64 kGetVoiceMgr = 0xbf78f0;
const UINT64 kChatMsg2NetSceneSendMsg = 0x96e8d0;
const UINT64 kTranslateVoice = 0x11217e0;
const UINT64 kNewWebViewPageConfig = 0x9512f0;
const UINT64 kFreeWebViewPageConfig = 0x951520;
const UINT64 kGetWebViewMgr = 0x9412d0;
const UINT64 kShowWebView = 0x1d236b0;
const UINT64 kSetUrl = 0x13dd410;
} // namespace offset
} // namespace V3_9_8_15

View File

@ -358,6 +358,10 @@ INT64 WechatService::GetContacts(std::vector<common::ContactInner>& vec) {
temp.wxid = wxutils::ReadWstringThenConvert(start + 0x10);
temp.custom_account = wxutils::ReadWstringThenConvert(start + 0x30);
temp.encrypt_name = wxutils::ReadWstringThenConvert(start + 0x50);
temp.remark = wxutils::ReadWstringThenConvert(start + 0x80);
temp.remark_pinyin = wxutils::ReadWstringThenConvert(start + 0x148);
temp.remark_pinyin_all = wxutils::ReadWstringThenConvert(start + 0x168);
temp.label_ids = wxutils::ReadWstringThenConvert(start + 0xc0);
temp.nickname = wxutils::ReadWstringThenConvert(start + 0xA0);
temp.pinyin = wxutils::ReadWstringThenConvert(start + 0x108);
temp.pinyin_all = wxutils::ReadWstringThenConvert(start + 0x128);
@ -748,4 +752,35 @@ std::string WechatService::GetTranslateVoiceText(UINT64 msg_id) {
}
return "";
}
INT64 WechatService::OpenUrlByWeChatBrowser(const std::wstring &url, int flag) {
INT64 success = -1;
UINT64 config_addr = base_addr_ + offset::kNewWebViewPageConfig;
func::__NewWebViewPageConfig config =(func::__NewWebViewPageConfig)config_addr;
UINT64 free_config_addr = base_addr_ + offset::kFreeWebViewPageConfig;
func::__FreeWebViewPageConfig free_config =(func::__FreeWebViewPageConfig)free_config_addr;
UINT64 web_view_mgr_addr = base_addr_ + offset::kGetWebViewMgr;
func::__GetWebViewMgr web_view_mgr = (func::__GetWebViewMgr)web_view_mgr_addr;
UINT64 show_addr = base_addr_ + offset::kShowWebView;
func::__ShowWebView show_web_view = (func::__ShowWebView)show_addr;
UINT64 set_url_addr = base_addr_ + offset::kSetUrl;
func::__SetUrl set_url = (func::__SetUrl)set_url_addr;
int a = flag >> 4;
int b = flag & 0x1;
int c = flag & 0x2;
int d = flag & 0x4;
int e = flag & 0x8;
char* web_config= (char*)HeapAlloc(GetProcessHeap(),0,0xA20);
UINT64 ptr = config(reinterpret_cast<UINT64>(web_config));
set_url( ptr + 0x868,reinterpret_cast<UINT64>(url.c_str()),url.size());
web_view_mgr();
success = show_web_view(ptr,a,b,c,d,e);
free_config(ptr);
return success;
}
} // namespace wxhelper

View File

@ -81,6 +81,7 @@ class WechatService : public base::Singleton<WechatService> {
void SetJsApiAddr(UINT64 addr);
INT64 TranslateVoice(UINT64 msg_id);
std::string GetTranslateVoiceText(UINT64 msg_id);
INT64 OpenUrlByWeChatBrowser(const std::wstring& url, int flag);
private:
UINT64 base_addr_;

View File

@ -288,6 +288,10 @@ enableHttp=0时使用ipport的tcp服务回传消息。
|&#8194;&#8194;nickname|string|昵称|
|&#8194;&#8194;pinyin|string|简拼|
|&#8194;&#8194;pinyinAll|string|全拼|
|&#8194;&#8194;remark|string|备注|
|&#8194;&#8194;remark_pinyin|string|备注拼音|
|&#8194;&#8194;remark_pinyin_all|string|备注全拼|
|&#8194;&#8194;label_ids|string|标签id|
|&#8194;&#8194;reserved1|number|未知|
|&#8194;&#8194;reserved2|number|未知|
|&#8194;&#8194;type|number|未知|
@ -312,6 +316,10 @@ enableHttp=0时使用ipport的tcp服务回传消息。
"nickname": "文件传输助手",
"pinyin": "WJCSZS",
"pinyinAll": "wenjianchuanshuzhushou",
"remark":"",
"remark_pinyin":"",
"remark_pinyin_all":"",
"label_ids":"",
"reserved1": 1,
"reserved2": 1,
"type": 3,
@ -948,4 +956,49 @@ enableHttp=0时使用ipport的tcp服务回传消息。
},
"msg": "success"
}
```
#### 19.通过浏览器打开url**
###### 接口功能
> 微信内置浏览器打开url或者本地浏览器打开url
###### 接口地址
> [/api/openUrlByWeChat](/api/openUrlByWeChat)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|url|string|需要打开的链接|
|flag|number|内置或者本地浏览器mask 后四位按位取值具体参数意义自行尝试简单可直接传012|
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,大于0成功, -1失败|
|msg|string|成功提示|
|data|object|返回内容|
###### 接口示例
入参:
``` javascript
{
"url":"http://mp.weixin.qq.com/s?__biz=MzUzMTA",
"flag":2
}
```
响应:
``` javascript
{
"code": 1,
"data": null,
"msg": "success"
}
```