mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-05 18:09:24 +08:00
feat: 发送小程序 close issue #158
This commit is contained in:
parent
e0b8805263
commit
ef666c59a2
@ -40,7 +40,7 @@
|
||||
61.撤回消息
|
||||
62.发送公众号消息
|
||||
63.转发公众号消息
|
||||
|
||||
64.发送小程序
|
||||
|
||||
### 接口文档:
|
||||
|
||||
@ -1874,4 +1874,45 @@
|
||||
响应:
|
||||
``` javascript
|
||||
{"code":0,"result":"OK"}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 64.发送小程序**
|
||||
###### 接口功能
|
||||
> 发送小程序(该接口不是很完善,调用多了就提示操作过于频繁,可稍后再试。有兴趣的可以完善一下)
|
||||
|
||||
###### 接口地址
|
||||
> [/api/?type=64](/api/?type=64)
|
||||
|
||||
###### HTTP请求方式
|
||||
> POST JSON
|
||||
|
||||
###### 请求参数
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|appletId|string|小程序id|
|
||||
|wxid|string|接收人wxid|
|
||||
|
||||
###### 返回字段
|
||||
|返回字段|字段类型|说明 |
|
||||
|---|---|---|
|
||||
|code|int|返回状态,1成功, 0失败|
|
||||
|result|string|成功提示|
|
||||
|
||||
|
||||
|
||||
|
||||
###### 接口示例
|
||||
入参:
|
||||
``` javascript
|
||||
{
|
||||
"appletId": "wa11223212",
|
||||
"wxid": "filehelper"
|
||||
}
|
||||
|
||||
```
|
||||
响应:
|
||||
``` javascript
|
||||
{"code":1,"result":"OK"}
|
||||
```
|
@ -77,6 +77,7 @@ typedef enum HTTP_API_ROUTE {
|
||||
WECHAT_REVOKE_MSG,
|
||||
WECHAT_FORWARD_PUBLIC_MSG,
|
||||
WECHAT_FORWARD_PUBLIC_MSG_BY_SVRID,
|
||||
WECHAT_SEND_APP_MSG,
|
||||
} WECHAT_HTTP_APIS,
|
||||
*PWECHAT_HTTP_APIS;
|
||||
|
||||
|
@ -642,6 +642,14 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
case WECHAT_SEND_APP_MSG:{
|
||||
wstring wxid = GetWStringParam(j_param, "wxid");
|
||||
wstring applet = GetWStringParam(j_param, "appletId");
|
||||
int success= g_context.send_mgr->SendAppletMsg(WS2LPWS(wxid),WS2LPWS(applet));
|
||||
json ret_data = {{"code", success}, {"result", "OK"}};
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
json ret_data = {{"result", "ERROR"}, {"msg", "not support api"}};
|
||||
ret = ret_data.dump();
|
||||
|
@ -371,4 +371,86 @@ int SendMessageMgr::ForwardPublicMsgByMsgSvrId(wchar_t *wxid, unsigned long long
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
int SendMessageMgr::SendAppletMsg(wchar_t* wxid, wchar_t* appletid){
|
||||
int success = -1;
|
||||
|
||||
DWORD init_chat_msg_addr = base_addr_ + WX_INIT_CHAT_MSG_OFFSET;
|
||||
DWORD new_share_app_msg_req_addr = base_addr_ + NEW_SHARE_APP_MSG_REQ_OFFSET;
|
||||
DWORD free_share_app_msg_req_addr = base_addr_ + FREE_SHARE_APP_MSG_REQ_OFFSET;
|
||||
DWORD send_app_msg_addr = base_addr_ + SEND_APP_MSG_OFFSET;
|
||||
DWORD new_wa_updatable_msg_info_addr = base_addr_ + NEW_WA_UPDATABLE_MSG_INFO_OFFSET;
|
||||
DWORD free_wa_addr = base_addr_ + FREE_WA_UPDATABLE_MSG_INFO_OFFSET;
|
||||
|
||||
std::wstring applet_id(appletid);
|
||||
std::string s_applet_id = Utils::WCharToUTF8(appletid);
|
||||
const char * c_applet_id = s_applet_id.c_str();
|
||||
|
||||
std::vector<WeChatString> receiver_list;
|
||||
WeChatString wwxid(wxid);
|
||||
receiver_list.push_back(wwxid);
|
||||
VectorInner* list = (VectorInner*)&receiver_list;
|
||||
DWORD receiver_list_ptr = (DWORD)&list->start;
|
||||
|
||||
WeChatString wapplet(appletid);
|
||||
char req[0x268]={0};
|
||||
char temp[0x4] = {0};
|
||||
char buff[0x88]={0};
|
||||
__asm{
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
LEA ECX,req
|
||||
CALL new_share_app_msg_req_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
// 0x40 gh
|
||||
// 0xE8 img
|
||||
memcpy(&req[0x4], &c_applet_id, sizeof(c_applet_id));
|
||||
__asm{
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
LEA ECX,buff
|
||||
CALL new_wa_updatable_msg_info_addr
|
||||
LEA EAX,buff
|
||||
PUSH EAX
|
||||
SUB ESP,0x14
|
||||
MOV ESI,ESP
|
||||
MOV dword ptr [EBP - 0x280],ESP
|
||||
MOV dword ptr [EBP - 0x27c],ESI
|
||||
MOV dword ptr [ESI],0x0
|
||||
MOV dword ptr [ESI + 0x4],0
|
||||
MOV dword ptr [ESI + 0x8],0
|
||||
MOV dword ptr [ESI + 0xc],0
|
||||
MOV dword ptr [ESI + 0x10],0
|
||||
|
||||
LEA EAX,req
|
||||
PUSH EAX
|
||||
MOV EAX,dword ptr[receiver_list_ptr]
|
||||
PUSH EAX
|
||||
SUB ESP,0x14
|
||||
LEA EAX,wapplet
|
||||
MOV ECX,ESP
|
||||
PUSH EAX
|
||||
CALL init_chat_msg_addr
|
||||
LEA ECX,temp
|
||||
CALL send_app_msg_addr
|
||||
MOV success,EAX
|
||||
LEA ECX,buff
|
||||
CALL free_wa_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
|
||||
__asm{
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
LEA ECX,req
|
||||
PUSH 0x0
|
||||
CALL free_share_app_msg_req_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
return success;
|
||||
}
|
||||
} // namespace wxhelper
|
@ -13,6 +13,7 @@ class SendMessageMgr:public BaseMgr {
|
||||
int ForwardMsg(wchar_t *wxid, unsigned long long msgid);
|
||||
int ForwardPublicMsg(wchar_t* wxid, wchar_t* title, wchar_t* url, wchar_t* thumburl,wchar_t* senderId,wchar_t* senderName,wchar_t* digest);
|
||||
int ForwardPublicMsgByMsgSvrId(wchar_t *wxid, unsigned long long msgid);
|
||||
int SendAppletMsg(wchar_t* wxid, wchar_t* appletid);
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -195,6 +195,16 @@
|
||||
#define FREE_MM_READ_ITEM_2_OFFSET 0x76edf0
|
||||
#define FORWARD_PUBLIC_MSG_OFFSET 0xb73de0
|
||||
|
||||
|
||||
// send app msg
|
||||
#define NEW_SHARE_APP_MSG_REQ_OFFSET 0xfbae50
|
||||
#define FREE_SHARE_APP_MSG_REQ_OFFSET 0xfbc0d0
|
||||
#define NEW_WA_UPDATABLE_MSG_INFO_OFFSET 0x7b3d30
|
||||
#define FREE_WA_UPDATABLE_MSG_INFO_OFFSET 0x79d4c0
|
||||
#define SEND_APP_MSG_OFFSET 0xfe8e40
|
||||
|
||||
|
||||
|
||||
/*******************hook*********************************************/
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user