mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-22 18:29:23 +08:00
'feat:拍一拍,ocr'
This commit is contained in:
parent
2863f8258f
commit
1ba2ed87b7
@ -1688,7 +1688,7 @@ enableHttp=0时,使用ip,port的tcp服务回传消息。
|
|||||||
> 发送小程序(待完善,不稳定),相关参数可以参考示例的滴滴小程序的内容自行组装。
|
> 发送小程序(待完善,不稳定),相关参数可以参考示例的滴滴小程序的内容自行组装。
|
||||||
|
|
||||||
###### 接口地址
|
###### 接口地址
|
||||||
> [/api/sendCustomEmotion](/api/sendApplet)
|
> [/api/sendApplet](/api/sendApplet)
|
||||||
|
|
||||||
###### HTTP请求方式
|
###### HTTP请求方式
|
||||||
> POST JSON
|
> POST JSON
|
||||||
@ -1738,3 +1738,92 @@ enableHttp=0时,使用ip,port的tcp服务回传消息。
|
|||||||
"msg": "success"
|
"msg": "success"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### 35.拍一拍**
|
||||||
|
###### 接口功能
|
||||||
|
> 拍一拍
|
||||||
|
|
||||||
|
###### 接口地址
|
||||||
|
> [/api/sendPatMsg](/api/sendPatMsg)
|
||||||
|
|
||||||
|
###### HTTP请求方式
|
||||||
|
> POST JSON
|
||||||
|
|
||||||
|
###### 请求参数
|
||||||
|
|参数|必选|类型|说明|
|
||||||
|
|---|---|---|---|
|
||||||
|
|wxid|string|被拍人id|
|
||||||
|
|receiver|string|接收人id,可以是自己wxid,私聊好友wxid,群id|
|
||||||
|
|
||||||
|
|
||||||
|
###### 返回字段
|
||||||
|
|返回字段|字段类型|说明 |
|
||||||
|
|---|---|---|
|
||||||
|
|code|int|返回状态,大于0成功, -1失败|
|
||||||
|
|msg|string|成功提示|
|
||||||
|
|data|object|null|
|
||||||
|
|
||||||
|
###### 接口示例
|
||||||
|
|
||||||
|
入参:
|
||||||
|
``` javascript
|
||||||
|
|
||||||
|
{
|
||||||
|
"wxid":"wxid_1234",
|
||||||
|
"receiver":"wxid_1234",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
响应:
|
||||||
|
``` javascript
|
||||||
|
{
|
||||||
|
"code": 1,
|
||||||
|
"data": {},
|
||||||
|
"msg": "success"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### 36.OCR**
|
||||||
|
###### 接口功能
|
||||||
|
> OCR识别文字,非0时再调用一次,一般需要调用2次
|
||||||
|
|
||||||
|
###### 接口地址
|
||||||
|
> [/api/ocr](/api/ocr)
|
||||||
|
|
||||||
|
###### HTTP请求方式
|
||||||
|
> POST JSON
|
||||||
|
|
||||||
|
###### 请求参数
|
||||||
|
|参数|必选|类型|说明|
|
||||||
|
|---|---|---|---|
|
||||||
|
|imagePath|string|图片全路径|
|
||||||
|
|
||||||
|
|
||||||
|
###### 返回字段
|
||||||
|
|返回字段|字段类型|说明 |
|
||||||
|
|---|---|---|
|
||||||
|
|code|int|返回状态,0成功, 非0时再调用一次|
|
||||||
|
|msg|string|成功提示|
|
||||||
|
|data|object|识别得结果|
|
||||||
|
|
||||||
|
###### 接口示例
|
||||||
|
|
||||||
|
入参:
|
||||||
|
``` javascript
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
"imagePath":"C:\\var\\123.jpg"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
响应:
|
||||||
|
``` javascript
|
||||||
|
{
|
||||||
|
"code": 0,
|
||||||
|
"data": "17 硬卧下铺别人能不能坐?12306回应\r\n18 中南财大被解聘女讲师已失联4个多月\r\n19 新一轮存款利率下调即将落地\r\n",
|
||||||
|
"msg": "success"
|
||||||
|
}
|
||||||
|
```
|
@ -579,6 +579,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/sendPatMsg")) {
|
||||||
|
std::wstring room_id = GetWStringParam(j_param, "receiver");
|
||||||
|
std::wstring wxid = GetWStringParam(j_param, "wxid");
|
||||||
|
INT64 success =
|
||||||
|
wxhelper::GlobalContext::GetInstance().mgr->SendPatMsg(room_id, wxid);
|
||||||
|
nlohmann::json ret_data = {
|
||||||
|
{"code", success}, {"msg", "success"}, {"data", {}}};
|
||||||
|
ret = ret_data.dump();
|
||||||
|
return ret;
|
||||||
|
} else if (mg_http_match_uri(hm, "/api/ocr")) {
|
||||||
|
std::wstring image_path = GetWStringParam(j_param, "imagePath");
|
||||||
|
std::string text("");
|
||||||
|
INT64 success = wxhelper::GlobalContext::GetInstance().mgr->DoOCRTask(image_path,text);
|
||||||
|
nlohmann::json ret_data = {
|
||||||
|
{"code", success}, {"msg", "success"}, {"data", text}};
|
||||||
|
ret = ret_data.dump();
|
||||||
|
return ret;
|
||||||
} else if (mg_http_match_uri(hm, "/api/test")) {
|
} else if (mg_http_match_uri(hm, "/api/test")) {
|
||||||
INT64 success = wxhelper::GlobalContext::GetInstance().mgr->Test();
|
INT64 success = wxhelper::GlobalContext::GetInstance().mgr->Test();
|
||||||
nlohmann::json ret_data = {
|
nlohmann::json ret_data = {
|
||||||
|
@ -1213,6 +1213,49 @@ INT64 Manager::SendApplet(const std::wstring &recv_wxid,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT64 Manager::SendPatMsg(const std::wstring &room_id,
|
||||||
|
const std::wstring &wxid) {
|
||||||
|
INT64 success = -1;
|
||||||
|
UINT64 send_pat_msg_addr = base_addr_ + offset::kSendPatMsg;
|
||||||
|
func::__SendPatMsg send_pat_msg =(func::__SendPatMsg)send_pat_msg_addr;
|
||||||
|
prototype::WeChatString chat_room(room_id);
|
||||||
|
prototype::WeChatString target(wxid);
|
||||||
|
success = send_pat_msg(reinterpret_cast<UINT64>(&chat_room),reinterpret_cast<UINT64>(&target));
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
INT64 Manager::DoOCRTask(const std::wstring &img_path, std::string &result) {
|
||||||
|
INT64 success = -1;
|
||||||
|
UINT64 ocr_manager_addr = base_addr_ + offset::kGetOCRManager;
|
||||||
|
func::__GetOCRManager ocr_manager = (func::__GetOCRManager)ocr_manager_addr;
|
||||||
|
|
||||||
|
UINT64 do_ocr_task_addr = base_addr_ + offset::kDoOCRTask;
|
||||||
|
func::__DoOCRTask do_ocr_task = (func::__DoOCRTask)do_ocr_task_addr;
|
||||||
|
|
||||||
|
prototype::WeChatString img(img_path);
|
||||||
|
std::vector<INT64> *temp = Utils::WxHeapAlloc<std::vector<INT64>>(0x20);
|
||||||
|
INT64 unkonwn = 0;
|
||||||
|
common::VectorInner *list = (common::VectorInner *)temp;
|
||||||
|
list->start = reinterpret_cast<INT64>(&list->start);
|
||||||
|
list->finsh = list->start;
|
||||||
|
char buff[0x28] = {0};
|
||||||
|
memcpy(buff, &list->start, sizeof(INT64));
|
||||||
|
UINT64 mgr = ocr_manager();
|
||||||
|
success = do_ocr_task(mgr, reinterpret_cast<UINT64>(&img),1,
|
||||||
|
reinterpret_cast<UINT64>(buff),reinterpret_cast<UINT64>(&unkonwn));
|
||||||
|
INT64 number = *(INT64 *)(buff + 0x8);
|
||||||
|
if (number > 0) {
|
||||||
|
INT64 header = list->start;
|
||||||
|
for (unsigned int i = 0; i < number - 1; i++) {
|
||||||
|
INT64 content = *(INT64 *)header;
|
||||||
|
result += Utils::ReadWstringThenConvert(content + 0x28);
|
||||||
|
result += "\r\n";
|
||||||
|
header = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
INT64 Manager::Test() {
|
INT64 Manager::Test() {
|
||||||
auto vec = Utils::QWordScan(base_addr_ + 0x32D1318, 0x1, L"WeChatWin.dll");
|
auto vec = Utils::QWordScan(base_addr_ + 0x32D1318, 0x1, L"WeChatWin.dll");
|
||||||
for (int i = 0; i < vec.size(); i++) {
|
for (int i = 0; i < vec.size(); i++) {
|
||||||
|
@ -56,12 +56,14 @@ class Manager {
|
|||||||
INT64 GetVoiceByDB(ULONG64 msg_id, const std::wstring& dir);
|
INT64 GetVoiceByDB(ULONG64 msg_id, const std::wstring& dir);
|
||||||
INT64 SendCustomEmotion(const std::wstring& file_path,
|
INT64 SendCustomEmotion(const std::wstring& file_path,
|
||||||
const std::wstring& wxid);
|
const std::wstring& wxid);
|
||||||
INT64 Manager::SendApplet(
|
INT64 SendApplet(
|
||||||
const std::wstring& recv_wxid, const std::wstring& waid_suff,
|
const std::wstring& recv_wxid, const std::wstring& waid_suff,
|
||||||
const std::wstring& waid_w, const std::string& waid_s,
|
const std::wstring& waid_w, const std::string& waid_s,
|
||||||
const std::string& wa_wxid, const std::string& json_param,
|
const std::string& wa_wxid, const std::string& json_param,
|
||||||
const std::string& head_image, const std::string& big_image,
|
const std::string& head_image, const std::string& big_image,
|
||||||
const std::string& index_page);
|
const std::string& index_page);
|
||||||
|
INT64 SendPatMsg(const std::wstring& room_id, const std::wstring& wxid);
|
||||||
|
INT64 DoOCRTask(const std::wstring& img_path, std::string &result);
|
||||||
INT64 Test();
|
INT64 Test();
|
||||||
private:
|
private:
|
||||||
UINT64 base_addr_;
|
UINT64 base_addr_;
|
||||||
|
@ -282,6 +282,9 @@ typedef UINT64 (*__GetAppInfoByWaid)(UINT64,UINT64);
|
|||||||
typedef UINT64 (*__CopyShareAppMessageRequest)(UINT64,UINT64);
|
typedef UINT64 (*__CopyShareAppMessageRequest)(UINT64,UINT64);
|
||||||
typedef UINT64 (*__NewWAUpdatableMsgInfo)(UINT64);
|
typedef UINT64 (*__NewWAUpdatableMsgInfo)(UINT64);
|
||||||
typedef UINT64 (*__FreeWAUpdatableMsgInfo)(UINT64);
|
typedef UINT64 (*__FreeWAUpdatableMsgInfo)(UINT64);
|
||||||
|
typedef UINT64 (*__SendPatMsg)(UINT64,UINT64);
|
||||||
|
typedef UINT64 (*__GetOCRManager)();
|
||||||
|
typedef UINT64 (*__DoOCRTask)(UINT64,UINT64,UINT64,UINT64,UINT64);
|
||||||
|
|
||||||
|
|
||||||
} // namespace function
|
} // namespace function
|
||||||
@ -440,6 +443,9 @@ const UINT64 kGetAppInfoByWaid = 0x13c5790;
|
|||||||
const UINT64 kCopyShareAppMessageRequest = 0x13c0670;
|
const UINT64 kCopyShareAppMessageRequest = 0x13c0670;
|
||||||
const UINT64 kNewWAUpdatableMsgInfo = 0x919ca0;
|
const UINT64 kNewWAUpdatableMsgInfo = 0x919ca0;
|
||||||
const UINT64 kFreeWAUpdatableMsgInfo = 0x8fc230;
|
const UINT64 kFreeWAUpdatableMsgInfo = 0x8fc230;
|
||||||
|
const UINT64 kSendPatMsg = 0x195f340;
|
||||||
|
const UINT64 kGetOCRManager = 0x999780;
|
||||||
|
const UINT64 kDoOCRTask = 0x190b2a0;
|
||||||
|
|
||||||
} // namespace offset
|
} // namespace offset
|
||||||
} // namespace V3_9_5_81
|
} // namespace V3_9_5_81
|
||||||
|
Loading…
Reference in New Issue
Block a user