From e7a460ad25ebdd96cdf6ab85005450578f02908d Mon Sep 17 00:00:00 2001 From: hugy <504650082@qq.com> Date: Mon, 6 Feb 2023 17:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=A1=AE=E8=AE=A4=E6=94=B6?= =?UTF-8?q?=E6=AC=BE=20=20close=20#12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 45 ++++++++++++++++++++++++++++++++++++++++++++- src/api.cc | 7 +++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c162aa1..841769f 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,10 @@ vcpkg 2023-02-01 : 新增拍一拍(仅支持3.8.1.26)。 -2023-02-04 : 新增群消息置顶和取消置顶。 +2023-02-04 : 新增群消息置顶和取消置顶。 + +2023-02-04 : 新增确认收款。 + #### 功能预览: 0.检查是否登录 1.获取登录微信信息 @@ -111,6 +114,7 @@ vcpkg 34.查询数据库 40.转发消息 44.退出登录 +45.确认收款 46.联系人列表 47.获取群详情 48.获取解密图片 @@ -822,6 +826,45 @@ vcpkg ``` +#### 45.确认收款** +###### 接口功能 +> 收到转账消息后,自动收款确认。type=49 即是转账消息。 + +###### 接口地址 +> [/api/?type=45](/api/?type=45) + +###### HTTP请求方式 +> POST JSON + +###### 请求参数 +|参数|必选|类型|说明| +|---|---|---|---| +|wxid|string|转账人微信id,从hook的消息中获取| +|transcationId|string|从hook的消息中获取对应的字段内容。| +|transferId|string|从hook的消息中获取对应的字段内容。| + +###### 返回字段 +|返回字段|字段类型|说明 | +|---|---|---| +|code|int|返回状态,1成功| +|result|string|成功提示| + + + + +###### 接口示例 +入参: +``` javascript +{ + "wxid":"wxid_agz5q76f11112", + "transcationId":"10000500012302060002831233124719620", + "transferId":"10000500012023020619112332136412" +} +``` +响应: +``` javascript +{"code":1,"result":"OK"} +``` #### 46.联系人列表** ###### 接口功能 diff --git a/src/api.cc b/src/api.cc index 7751bf7..4882982 100644 --- a/src/api.cc +++ b/src/api.cc @@ -20,6 +20,7 @@ #include "hook_img.h" #include "ocr.h" #include "pat.h" +#include "confirm_receipt.h" #pragma comment(lib, "ws2_32.lib") using namespace std; @@ -478,6 +479,12 @@ void api_handle(mg_http_message *hm, struct mg_connection *c, string &ret) { break; } case WECHAT_GET_TRANSFER: { + wstring wxid = get_http_req_param(hm, j_param, "wxid", is_post); + wstring transcationid = get_http_req_param(hm, j_param, "transcationId", is_post); + wstring transferid = get_http_req_param(hm, j_param, "transferId", is_post); + BOOL response = DoConfirmReceipt(WS2LW(wxid), WS2LW(transcationid), WS2LW(transferid)); + json ret_data = {{"msg", response}, {"result", "OK"}}; + ret = ret_data.dump(); break; } case WECHAT_GET_CONTACT_ALL: {