mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-24 11:19:24 +08:00
Merge pull request #378 from atorber/dev-3.9.5.81
增加 3.9.5.81 的ts/js sdk及优化python示例
This commit is contained in:
commit
d7b981c9a2
5
.gitignore
vendored
5
.gitignore
vendored
@ -32,4 +32,7 @@
|
||||
*.app
|
||||
CMakePresets.json
|
||||
.vscode
|
||||
out
|
||||
out
|
||||
nodejs_client_ts/node_modules
|
||||
nodejs_client_ts/msgStore.json
|
||||
nodejs_client_ts/dist
|
||||
|
11
go_client/main.go
Normal file
11
go_client/main.go
Normal file
@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"go_client/tcpserver"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||
tcpserver.Listen(19099)
|
||||
}
|
44
go_client/tcpserver/tcpserver.go
Normal file
44
go_client/tcpserver/tcpserver.go
Normal file
@ -0,0 +1,44 @@
|
||||
package tcpserver
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"log"
|
||||
"net"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Listen(port int) {
|
||||
p := strconv.Itoa(port)
|
||||
adress := "127.0.0.1:" + p
|
||||
ln, err := net.Listen("tcp", adress)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer ln.Close()
|
||||
log.Println("tcp server started")
|
||||
for {
|
||||
conn, err := ln.Accept()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
continue
|
||||
}
|
||||
go handle(conn)
|
||||
}
|
||||
}
|
||||
|
||||
func handle(conn net.Conn) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
log.Println("发生了未处理的异常", err)
|
||||
}
|
||||
}()
|
||||
defer conn.Close()
|
||||
scanner := bufio.NewScanner(conn)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Bytes()
|
||||
log.Println("收到消息:", string(line))
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
log.Println("错误:", err)
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.2.2</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
@ -14,7 +14,8 @@
|
||||
<name>wxhk</name>
|
||||
<description>wxhk</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<java.version>21</java.version>
|
||||
<vertx-web-client.version>4.5.3</vertx-web-client.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -39,7 +40,7 @@
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.1.92.Final</version>
|
||||
<version>4.1.105.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
@ -50,22 +51,22 @@
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-core</artifactId>
|
||||
<version>4.4.2</version>
|
||||
<version>${vertx-web-client.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-web</artifactId>
|
||||
<version>4.4.2</version>
|
||||
<version>${vertx-web-client.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-web-client</artifactId>
|
||||
<version>4.4.2</version>
|
||||
<version>${vertx-web-client.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-mysql-client</artifactId>
|
||||
<version>4.4.2</version>
|
||||
<version>${vertx-web-client.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -42,6 +42,11 @@ public class PrivateChatMsg implements Serializable {
|
||||
private String signature;
|
||||
private String time;
|
||||
private Integer timestamp;
|
||||
|
||||
/**
|
||||
* 对用户,如果是文件助手是filehelper
|
||||
*/
|
||||
private String toUser;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
|
@ -15,4 +15,17 @@ import lombok.experimental.Accessors;
|
||||
public class OpenHook implements SendMsg<OpenHook> {
|
||||
String port;
|
||||
String ip;
|
||||
/**
|
||||
* 0/1 :1.启用http 0.不启用http
|
||||
*/
|
||||
boolean enableHttp;
|
||||
/**
|
||||
* 超时时间,单位ms
|
||||
*/
|
||||
String timeout;
|
||||
|
||||
/**
|
||||
* http的请求地址,enableHttp=1时,不能为空
|
||||
*/
|
||||
String url;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.w3c.dom.NodeList;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
@ -50,7 +51,12 @@ public class WxMsgHandle {
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
add(chatMsg -> {
|
||||
wxSmgServer.私聊(chatMsg);
|
||||
if(Objects.equals(chatMsg.getToUser(), FILEHELPER)){
|
||||
wxSmgServer.文件助手(chatMsg);
|
||||
}else{
|
||||
wxSmgServer.私聊(chatMsg);
|
||||
}
|
||||
|
||||
return null;
|
||||
}, WxMsgType.私聊信息);
|
||||
add(chatMsg -> {
|
||||
@ -174,8 +180,8 @@ public class WxMsgHandle {
|
||||
if (monery.startsWith("¥")) {
|
||||
String substring = monery.substring(1);
|
||||
BigDecimal decimal = new BigDecimal(substring);
|
||||
log.info("收款:{},付款人:{},付款备注:{}", decimal.stripTrailingZeros().toPlainString(), chatMsg.getFromUser(), remark);
|
||||
wxSmgServer.收款之后(new PayoutInformation(chatMsg.getFromUser(), decimal, remark));
|
||||
log.info("收款:{},付款人:{},付款备注:{}", decimal.stripTrailingZeros().toPlainString(), receiver_username, remark);
|
||||
wxSmgServer.收款之后(new PayoutInformation(receiver_username, decimal, remark));
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -32,12 +32,14 @@ public class WxSmgServerImpl implements com.example.wxhk.server.WxSmgServer {
|
||||
public void 私聊(PrivateChatMsg chatMsg) {
|
||||
if (Objects.equals(chatMsg.getIsSendMsg(), 1) && Objects.equals(chatMsg.getIsSendByPhone(), 1)) {
|
||||
log.info("手机端对:{}发出:{}", chatMsg.getFromUser(), chatMsg.getContent());
|
||||
}else{
|
||||
log.info("收到私聊{}",chatMsg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void 文件助手(PrivateChatMsg chatMsg) {
|
||||
|
||||
log.info("文件助手:{}",chatMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,7 +2,8 @@ package com.example.wxhk.tcp.vertx;
|
||||
|
||||
import com.example.wxhk.WxhkApplication;
|
||||
import com.example.wxhk.constant.WxMsgType;
|
||||
import com.example.wxhk.util.HttpAsyncUtil;
|
||||
import com.example.wxhk.model.request.OpenHook;
|
||||
import com.example.wxhk.util.HttpSendUtil;
|
||||
import io.vertx.core.AbstractVerticle;
|
||||
import io.vertx.core.DeploymentOptions;
|
||||
import io.vertx.core.Future;
|
||||
@ -75,7 +76,10 @@ public class VertxTcp extends AbstractVerticle implements CommandLineRunner {
|
||||
listen.onComplete(event -> {
|
||||
boolean succeeded = event.succeeded();
|
||||
if (succeeded) {
|
||||
HttpAsyncUtil.exec(HttpAsyncUtil.Type.开启hook, new JsonObject().put("port", InitWeChat.getVertxPort().toString()).put("ip", "127.0.0.1"));
|
||||
HttpSendUtil.开启hook(new OpenHook().setPort(InitWeChat.getVertxPort().toString()).setIp("127.0.0.1")
|
||||
.setEnableHttp(false)
|
||||
.setTimeout("5000"));
|
||||
// HttpAsyncUtil.exec(HttpAsyncUtil.Type.开启hook, new JsonObject().put("port", InitWeChat.getVertxPort().toString()).put("ip", "127.0.0.1"));
|
||||
startPromise.complete();
|
||||
} else {
|
||||
startPromise.fail(event.cause());
|
||||
|
@ -24,7 +24,7 @@ public class HttpAsyncUtil {
|
||||
protected static final Log log = Log.get();
|
||||
|
||||
public static Future<HttpResponse<Buffer>> exec(Type type, JsonObject object) {
|
||||
return client.post(InitWeChat.wxPort, "localhost", "/api/?type=" + type.getType())
|
||||
return client.post(InitWeChat.wxPort, "localhost", "/api/" + type.getType())
|
||||
.sendJsonObject(object)
|
||||
.onSuccess(event ->
|
||||
{
|
||||
@ -36,7 +36,7 @@ public class HttpAsyncUtil {
|
||||
}
|
||||
|
||||
public static Future<HttpResponse<Buffer>> exec(Type type, JsonObject object, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
|
||||
return client.post(InitWeChat.wxPort, "localhost", "/api/?type=" + type.getType())
|
||||
return client.post(InitWeChat.wxPort, "localhost", "/api/" + type.getType())
|
||||
.sendJsonObject(object)
|
||||
.onComplete(handler)
|
||||
;
|
||||
@ -45,22 +45,31 @@ public class HttpAsyncUtil {
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
检查微信登陆("0"),
|
||||
获取登录信息("1"),
|
||||
发送文本("2"),
|
||||
发送at文本("3"),
|
||||
检查微信登陆("checkLogin"),
|
||||
获取登录信息("userInfo"),
|
||||
发送文本("sendTextMsg"),
|
||||
转发消息("forwardMsg"),
|
||||
发送at文本("sendAtText"),
|
||||
发送图片("5"),
|
||||
发送文件("6"),
|
||||
开启hook("9"),
|
||||
关闭hook("10"),
|
||||
发送文件("sendFileMsg"),
|
||||
开启hook("hookSyncMsg"),
|
||||
关闭hook("unhookSyncMsg"),
|
||||
添加好友("20"),
|
||||
通过好友申请("23"),
|
||||
获取群成员("25"),
|
||||
获取群成员昵称("26"),
|
||||
删除群成员("27"),
|
||||
获取群成员("getMemberFromChatRoom"),
|
||||
获取群成员基础信息("getContactProfile"),
|
||||
获取群详情("getChatRoomDetailInfo"),
|
||||
添加群成员("addMemberToChatRoom"),
|
||||
修改群昵称("modifyNickname"),
|
||||
删除群成员("delMemberFromChatRoom"),
|
||||
置顶群消息("topMsg"),
|
||||
取消置顶群消息("removeTopMsg"),
|
||||
邀请入群("InviteMemberToChatRoom"),
|
||||
确认收款("45"),
|
||||
联系人列表("46"),
|
||||
联系人列表("getContactList"),
|
||||
查询微信信息("55"),
|
||||
下载附件("downloadAttach"),
|
||||
解码("decodeImage"),
|
||||
|
||||
|
||||
;
|
||||
|
@ -27,7 +27,7 @@ public class HttpSyncUtil {
|
||||
}
|
||||
|
||||
public static JsonObject exec(HttpAsyncUtil.Type type, JsonObject obj) {
|
||||
String post = engine.send(Request.of("http://localhost:" + InitWeChat.wxPort + "/api/?type=" + type.getType()).method(Method.POST).body(obj.encode())).bodyStr();
|
||||
String post = engine.send(Request.of("http://localhost:" + InitWeChat.wxPort + "/api/" + type.getType()).method(Method.POST).body(obj.encode())).bodyStr();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("type:{},{}", type.getType(), post);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
wx.path=D:\\Program Files (x86)\\Tencent\\WeChat\\[3.9.2.23]\\WeChat.exe
|
||||
wx.path=D:\\Program Files (x86)\\Tencent\\WeChat\\WeChat.exe
|
||||
wx.port=19088
|
||||
spring.profiles.active=local
|
||||
vertx.port=8080
|
Binary file not shown.
Binary file not shown.
@ -7,6 +7,8 @@ import org.dromara.hutool.core.lang.Console;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
@ -41,5 +43,7 @@ class HttpSendUtilTest {
|
||||
void 获取群成员() {
|
||||
GroupMembers 获取群成员 = HttpSendUtil.获取群成员(new GetGroupMembers().setChatRoomId("24964676359@chatroom"));
|
||||
Console.log(获取群成员);
|
||||
|
||||
Duration between = Duration.between(LocalDateTime.now(), LocalDateTime.now());
|
||||
}
|
||||
}
|
26
nodejs_client/tcp_server.js
Normal file
26
nodejs_client/tcp_server.js
Normal file
@ -0,0 +1,26 @@
|
||||
const net = require('net')
|
||||
|
||||
const server = net.createServer(socket => {
|
||||
console.log('New client connected')
|
||||
|
||||
let data = Buffer.from('')
|
||||
|
||||
socket.on('data', data => {
|
||||
data = Buffer.concat([data, chunk])
|
||||
console.log(`Received data: ${data}`)
|
||||
})
|
||||
|
||||
socket.on('end', () => {
|
||||
const decodedData = data.toString('utf8')
|
||||
console.log(`Received data: ${decodedData}`)
|
||||
})
|
||||
|
||||
socket.on('close', () => {
|
||||
console.log('Client disconnected')
|
||||
})
|
||||
})
|
||||
|
||||
const port = 19099
|
||||
server.listen(port, () => {
|
||||
console.log(`Server listening on port ${port}`)
|
||||
})
|
23
nodejs_client_ts/README.md
Normal file
23
nodejs_client_ts/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# TypeScript Client
|
||||
|
||||
## 快速开始
|
||||
|
||||
1. 启动WebSoket服务用语接收消息
|
||||
|
||||
```shell
|
||||
npm run ws_server
|
||||
```
|
||||
|
||||
2. 运行测试demo
|
||||
|
||||
```
|
||||
npm run start
|
||||
```
|
||||
|
||||
## 说明
|
||||
|
||||
./src/index.ts 包含3.9.5.81支持的所有接口封装
|
||||
|
||||
./tcp_server.ts 接收消息的服务端代码
|
||||
|
||||
./example/ding-dong-bot.ts SDK使用示例
|
137
nodejs_client_ts/example/ding-dong-bot.ts
Normal file
137
nodejs_client_ts/example/ding-dong-bot.ts
Normal file
@ -0,0 +1,137 @@
|
||||
import * as wxhelper from '../src/index'
|
||||
import net from 'net'
|
||||
import {
|
||||
writeMsgStore,
|
||||
readMsgStore
|
||||
} from '../src/utils/messageStore'
|
||||
|
||||
// 启动一个TCP服务,接收hook消息
|
||||
const server = net.createServer((socket: any) => {
|
||||
console.log('New client connected')
|
||||
let messageStore = readMsgStore()
|
||||
|
||||
let data = Buffer.from('')
|
||||
|
||||
socket.on('data', (data: any, chunk: any) => {
|
||||
console.log(`Received data: ${data}`)
|
||||
const dataJson = JSON.parse(data)
|
||||
messageStore = writeMsgStore(messageStore, dataJson)
|
||||
// data = Buffer.concat([data, chunk])
|
||||
// console.log(`Received data: ${data}`)
|
||||
})
|
||||
|
||||
socket.on('end', () => {
|
||||
const decodedData = data.toString('utf8')
|
||||
console.log(`Received data: ${decodedData}`)
|
||||
})
|
||||
|
||||
socket.on('close', () => {
|
||||
console.log('Client disconnected')
|
||||
})
|
||||
})
|
||||
|
||||
const wsPort = 19099
|
||||
|
||||
const main = async () => {
|
||||
// server.listen(wsPort, () => {
|
||||
// console.log(`Server listening on port ${wsPort}`)
|
||||
// })
|
||||
const testContact0 = 'filehelper'
|
||||
const testContact1 = 'ledongmao'
|
||||
const testRoom = '1234@chatroom'
|
||||
const testRoom1 = '5678@chatroom'
|
||||
|
||||
const checkLoginRes = await wxhelper.checkLogin()
|
||||
console.log('登录状态:', checkLoginRes.data)
|
||||
if (checkLoginRes.data.msg !== 'success') {
|
||||
console.log('请先登录')
|
||||
return
|
||||
} else {
|
||||
const port = String(wsPort)
|
||||
const ip = '127.0.0.1'
|
||||
const url = ''
|
||||
const timeout = '3000'
|
||||
const enableHttp = '0'
|
||||
const hookSyncMsgRes = await wxhelper.hookSyncMsg(port, ip, url, timeout, enableHttp)
|
||||
console.log('开启hook:', hookSyncMsgRes.data)
|
||||
}
|
||||
const userInfoRes = await wxhelper.userInfo()
|
||||
console.log('当前账号信息:', userInfoRes.data)
|
||||
const selfWxid = userInfoRes.data.data.wxid
|
||||
console.log('当前账号wxid:', selfWxid)
|
||||
// const sendTextMsgRes = await wxhelper.sendTextMsg('filehelper', new Date().toLocaleString() + ':你好,我是机器人')
|
||||
// console.log('发送文本消息:', sendTextMsgRes.data)
|
||||
|
||||
// const getContactListRes = await wxhelper.getContactList()
|
||||
// console.log('获取联系人列表:', getContactListRes.data.data.length)
|
||||
|
||||
// const getDBInfo = await wxhelper.getDBInfo()
|
||||
// console.log('获取数据库信息:', getDBInfo.data)
|
||||
|
||||
// const sqliteDB = await wxhelper.execSql(2737761293968, 'select * from MSG where localId =301;')
|
||||
// console.log('查询数据库:', sqliteDB.data)
|
||||
|
||||
// const roomInfoRes = await wxhelper.getChatRoomDetailInfo(testRoom1)
|
||||
// console.log('获取群聊详情:', roomInfoRes.data)
|
||||
|
||||
// const addMemberToChatRoomRes = await wxhelper.addMemberToChatRoom(testRoom, testContact1)
|
||||
// console.log('添加群成员:', addMemberToChatRoomRes.data)
|
||||
|
||||
// const modifyChatRoomNameRes = await wxhelper.modifyNickname(testRoom, selfWxid, '大师')
|
||||
// console.log('修改自己的群名片:', modifyChatRoomNameRes.data)
|
||||
|
||||
// const delMemberFromChatRoomRes = await wxhelper.delMemberFromChatRoom(testRoom, testContact1)
|
||||
// console.log('删除群成员:', delMemberFromChatRoomRes.data)
|
||||
|
||||
// const getChatRoomMembersRes = await wxhelper.getMemberFromChatRoom(testRoom)
|
||||
// console.log('获取群成员:', getChatRoomMembersRes.data)
|
||||
|
||||
// const quitChatRoomRes = await wxhelper.quitChatRoom(testRoom1)
|
||||
// console.log('退出群聊:', quitChatRoomRes.data)
|
||||
|
||||
// const getSNSFirstPage = await wxhelper.getSNSFirstPage()
|
||||
// console.log('获取朋友圈:', getSNSFirstPage.data)
|
||||
|
||||
// const getSNSNextPage = await wxhelper.getSNSNextPage()
|
||||
// console.log('获取朋友圈下一页:', getSNSNextPage.data)
|
||||
|
||||
// const sendAtTextMsgRes = await wxhelper.sendAtText(testContact1, testRoom, '你好,我是机器人')
|
||||
// console.log('发送@消息:', sendAtTextMsgRes.data)
|
||||
|
||||
// const getContactProfileRes = await wxhelper.getContactProfile(testContact1)
|
||||
// console.log('获取联系人详情:', getContactProfileRes.data)
|
||||
|
||||
// const param = {
|
||||
// appName: '123',
|
||||
// userName: '超哥',
|
||||
// title: '测试转发公众号消息',
|
||||
// url: 'https://mp.weixin.qq.com/s?__biz=MzIwMzYwMTk1NA==&mid=2247483663&idx=1&sn=',
|
||||
// thumbUrl: 'https://mmbiz.qpic.cn/mmbiz_jpg/3ic3Zz3',
|
||||
// digest: '测试',
|
||||
// wxid: testContact1,
|
||||
// }
|
||||
|
||||
// const forwardPublicMsgRes = await wxhelper.forwardPublicMsg(param)
|
||||
// console.log('转发公众号消息:', forwardPublicMsgRes.data)
|
||||
|
||||
// const payload = {
|
||||
// "wxid": testContact1,
|
||||
// "waidConcat": "wxaf35009675aa0b2a_118",
|
||||
// "waid": "wxaf35009675aa0b2a",
|
||||
// "appletWxid": "gh_7a5c4141778f@app",
|
||||
// "jsonParam": "{\"current_path\":\"home/pages/index.html\",\"current_title\":\"\",\"image_url\":\"https://ut-static.udache.com/webx/mini-pics/U7mDFxU2yh-2-r1BJ-J0X.png\",\"scene\":1001,\"scene_note\":\"\",\"sessionId\":\"SessionId@1672284921_1#1692848476899\"}",
|
||||
// "headImgUrl": "http://mmbiz.qpic.cn/sz_mmbiz_png/9n47wQlh4dH8afD9dQ9uQicibRm5mYz3lawXCLMjmnzFicribH51qsFYxjzPEcTGHGmgX4lkAkQ3jznia8UDEtqsX1w/640?wx_fmt=png&wxfrom=200",
|
||||
// "mainImg": "C:\\wxid_123123\\Applet\\wxaf35009675aa0b2a\\temp\\2.png",
|
||||
// "indexPage": "pages/index/index.html"
|
||||
// }
|
||||
// const sendAppMsgRes = await wxhelper.sendApplet(payload)
|
||||
// console.log('发送小程序消息:', sendAppMsgRes.data)
|
||||
|
||||
// const sendPatMsgRes = await wxhelper.sendPatMsg(testRoom1, testContact1)
|
||||
// console.log('拍一拍:', sendPatMsgRes.data)
|
||||
|
||||
// const ocrRes = await wxhelper.ocr('https://ut-static.udache.com/webx/mini-pics/U7mDFxU2yh-2-r1BJ-J0X.png')
|
||||
// console.log('OCR识别:', ocrRes.data)
|
||||
}
|
||||
|
||||
void main()
|
307
nodejs_client_ts/package-lock.json
generated
Normal file
307
nodejs_client_ts/package-lock.json
generated
Normal file
@ -0,0 +1,307 @@
|
||||
{
|
||||
"name": "nodejs_client_ts",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nodejs_client_ts",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"axios": "^1.6.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.4.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
||||
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
||||
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/node10": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
||||
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@tsconfig/node12": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@tsconfig/node14": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@tsconfig/node16": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
|
||||
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.11.30",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz",
|
||||
"integrity": "sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.11.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
|
||||
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-walk": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz",
|
||||
"integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/arg": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.6.8",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
|
||||
"integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/diff": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.6",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/make-error": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||
},
|
||||
"node_modules/ts-node": {
|
||||
"version": "10.9.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
|
||||
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
"@tsconfig/node12": "^1.0.7",
|
||||
"@tsconfig/node14": "^1.0.0",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-walk": "^8.1.1",
|
||||
"arg": "^4.1.0",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"yn": "3.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"ts-node": "dist/bin.js",
|
||||
"ts-node-cwd": "dist/bin-cwd.js",
|
||||
"ts-node-esm": "dist/bin-esm.js",
|
||||
"ts-node-script": "dist/bin-script.js",
|
||||
"ts-node-transpile-only": "dist/bin-transpile.js",
|
||||
"ts-script": "dist/bin-script-deprecated.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/core": ">=1.2.50",
|
||||
"@swc/wasm": ">=1.2.50",
|
||||
"@types/node": "*",
|
||||
"typescript": ">=2.7"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/core": {
|
||||
"optional": true
|
||||
},
|
||||
"@swc/wasm": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.4.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
|
||||
"integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/v8-compile-cache-lib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/yn": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
nodejs_client_ts/package.json
Normal file
22
nodejs_client_ts/package.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "nodejs_client_ts",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "ts-node ./example/ding-dong-bot.ts",
|
||||
"ws-server": "ts-node ./src/tcp_server.ts",
|
||||
"build": "tsc",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.6.8"
|
||||
}
|
||||
}
|
617
nodejs_client_ts/src/index.ts
Normal file
617
nodejs_client_ts/src/index.ts
Normal file
@ -0,0 +1,617 @@
|
||||
import { get, post } from './utils/mod'
|
||||
|
||||
// def checkLogin():
|
||||
// url = "127.0.0.1:19088/api/checkLogin"
|
||||
// payload = {}
|
||||
// headers = {}
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const checkLogin = () => {
|
||||
return post('/api/checkLogin')
|
||||
}
|
||||
|
||||
// def userInfo():
|
||||
// url = "127.0.0.1:19088/api/userInfo"
|
||||
// payload = {}
|
||||
// headers = {}
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const userInfo = () => {
|
||||
return post('/api/userInfo')
|
||||
}
|
||||
|
||||
// def sendTextMsg():
|
||||
// url = "127.0.0.1:19088/api/sendTextMsg"
|
||||
// payload = json.dumps({
|
||||
// "wxid": "filehelper",
|
||||
// "msg": "12www"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const sendTextMsg = (wxid: string, msg: string) => {
|
||||
return post('/api/sendTextMsg', { wxid, msg })
|
||||
}
|
||||
|
||||
// def sendImagesMsg():
|
||||
// url = "127.0.0.1:19088/api/sendImagesMsg"
|
||||
// print("modify imagePath")
|
||||
// raise RuntimeError("modify imagePath then deleted me")
|
||||
// payload = json.dumps({
|
||||
// "wxid": "filehelper",
|
||||
// "imagePath": "C:\\pic.png"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
|
||||
export const sendImagesMsg = (wxid: string, imagePath: string) => {
|
||||
return post('/api/sendImagesMsg', { wxid, imagePath })
|
||||
}
|
||||
|
||||
// def sendFileMsg():
|
||||
// url = "127.0.0.1:19088/api/sendFileMsg"
|
||||
// print("modify filePath")
|
||||
// raise RuntimeError("modify filePath then deleted me")
|
||||
// payload = json.dumps({
|
||||
// "wxid": "filehelper",
|
||||
// "filePath": "C:\\test.zip"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
|
||||
export const sendFileMsg = (wxid: string, filePath: string) => {
|
||||
return post('/api/sendFileMsg', { wxid, filePath })
|
||||
}
|
||||
|
||||
// def hookSyncMsg():
|
||||
// url = "127.0.0.1:19088/api/hookSyncMsg"
|
||||
// print("modify ip port url ")
|
||||
// raise RuntimeError("modify ip port url then deleted me")
|
||||
// payload = json.dumps({
|
||||
// "port": "19099",
|
||||
// "ip": "127.0.0.1",
|
||||
// "url": "http://localhost:8080",
|
||||
// "timeout": "3000",
|
||||
// "enableHttp": "0"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const hookSyncMsg = (port: string, ip: string, url: string, timeout: string, enableHttp: string) => {
|
||||
return post('/api/hookSyncMsg', { port, ip, url, timeout, enableHttp })
|
||||
}
|
||||
|
||||
|
||||
// def unhookSyncMsg():
|
||||
// url = host + "/api/unhookSyncMsg"
|
||||
// payload = {}
|
||||
// headers = {}
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const unhookSyncMsg = () => {
|
||||
return post('/api/unhookSyncMsg')
|
||||
}
|
||||
|
||||
|
||||
// def getContactList():
|
||||
// url = host + "/api/getContactList"
|
||||
// payload = {}
|
||||
// headers = {}
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const getContactList = () => {
|
||||
return post('/api/getContactList')
|
||||
}
|
||||
|
||||
|
||||
// def getDBInfo():
|
||||
// url = host + "/api/getDBInfo"
|
||||
// payload = {}
|
||||
// headers = {}
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const getDBInfo = () => {
|
||||
return post('/api/getDBInfo')
|
||||
}
|
||||
|
||||
|
||||
// def execSql():
|
||||
// url = host + "/api/execSql"
|
||||
// print("modify dbHandle ")
|
||||
// raise RuntimeError("modify dbHandle then deleted me")
|
||||
// payload = json.dumps({
|
||||
// "dbHandle": 1713425147584,
|
||||
// "sql": "select * from MSG where localId =100;"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const execSql = (dbHandle: number, sql: string) => {
|
||||
return post('/api/execSql', { dbHandle, sql })
|
||||
}
|
||||
|
||||
|
||||
// def getChatRoomDetailInfo():
|
||||
// url = host + "/api/getChatRoomDetailInfo"
|
||||
// print("modify chatRoomId ")
|
||||
// raise RuntimeError("modify chatRoomId then deleted me")
|
||||
// payload = json.dumps({
|
||||
// "chatRoomId": "123333@chatroom"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const getChatRoomDetailInfo = (chatRoomId: string) => {
|
||||
return post('/api/getChatRoomDetailInfo', { chatRoomId })
|
||||
}
|
||||
|
||||
// def addMemberToChatRoom():
|
||||
// url = host + "/api/addMemberToChatRoom"
|
||||
// print("modify chatRoomId memberIds ")
|
||||
// raise RuntimeError("modify chatRoomId memberIds then deleted me")
|
||||
// payload = json.dumps({
|
||||
// "chatRoomId": "123@chatroom",
|
||||
// "memberIds": "wxid_123"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const addMemberToChatRoom = (chatRoomId: string, memberIds: string) => {
|
||||
return post('/api/addMemberToChatRoom', { chatRoomId, memberIds })
|
||||
}
|
||||
|
||||
|
||||
// def delMemberFromChatRoom():
|
||||
// url = host + "/api/delMemberFromChatRoom"
|
||||
// print("modify chatRoomId memberIds ")
|
||||
// raise RuntimeError("modify chatRoomId memberIds then deleted me")
|
||||
// payload = json.dumps({
|
||||
// "chatRoomId": "21363231004@chatroom",
|
||||
// "memberIds": "wxid_123"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const delMemberFromChatRoom = (chatRoomId: string, memberIds: string) => {
|
||||
return post('/api/delMemberFromChatRoom', { chatRoomId, memberIds })
|
||||
}
|
||||
|
||||
|
||||
// def modifyNickname():
|
||||
// url = host + "/api/modifyNickname"
|
||||
// print("modify chatRoomId wxid nickName")
|
||||
// raise RuntimeError("modify chatRoomId wxid nickName then deleted me")
|
||||
// payload = json.dumps({
|
||||
// "chatRoomId": "123@chatroom",
|
||||
// "wxid": "wxid_123",
|
||||
// "nickName": "test"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const modifyNickname = (chatRoomId: string, wxid: string, nickName: string) => {
|
||||
return post('/api/modifyNickname', { chatRoomId, wxid, nickName })
|
||||
}
|
||||
|
||||
|
||||
// def getMemberFromChatRoom():
|
||||
// print("modify chatRoomId ")
|
||||
// raise RuntimeError("modify chatRoomId then deleted me")
|
||||
// url = host + "/api/getMemberFromChatRoom"
|
||||
// payload = json.dumps({
|
||||
// "chatRoomId": "123@chatroom"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const getMemberFromChatRoom = (chatRoomId: string) => {
|
||||
return post('/api/getMemberFromChatRoom', { chatRoomId })
|
||||
}
|
||||
|
||||
|
||||
// def topMsg():
|
||||
// print("modify msgId ")
|
||||
// raise RuntimeError("modify msgId then deleted me")
|
||||
// url = host + "/api/topMsg"
|
||||
// payload = json.dumps({
|
||||
// "msgId": 1222222
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const topMsg = (msgId: number) => {
|
||||
return post('/api/topMsg', { msgId })
|
||||
}
|
||||
|
||||
|
||||
// def removeTopMsg():
|
||||
// print("modify msgId chatRoomId ")
|
||||
// raise RuntimeError("modify msgId chatRoomId then deleted me")
|
||||
|
||||
// url = host + "/api/removeTopMsg"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "chatRoomId": "123@chatroom",
|
||||
// "msgId": 123
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const removeTopMsg = (chatRoomId: string, msgId: number) => {
|
||||
return post('/api/removeTopMsg', { chatRoomId, msgId })
|
||||
}
|
||||
|
||||
|
||||
// def InviteMemberToChatRoom():
|
||||
// print("modify memberIds chatRoomId ")
|
||||
// raise RuntimeError("modify memberIds chatRoomId then deleted me")
|
||||
|
||||
// url = host + "/api/InviteMemberToChatRoom"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "chatRoomId": "123@chatroom",
|
||||
// "memberIds": "wxid_123"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const InviteMemberToChatRoom = (chatRoomId: string, memberIds: string) => {
|
||||
return post('/api/InviteMemberToChatRoom', { chatRoomId, memberIds })
|
||||
}
|
||||
|
||||
|
||||
// def hookLog():
|
||||
// url = host + "/api/hookLog"
|
||||
// payload = {}
|
||||
// headers = {}
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const hookLog = () => {
|
||||
return post('/api/hookLog')
|
||||
}
|
||||
|
||||
|
||||
// def unhookLog():
|
||||
// url = host + "/api/unhookLog"
|
||||
// payload = {}
|
||||
// headers = {}
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const unhookLog = () => {
|
||||
return post('/api/unhookLog')
|
||||
}
|
||||
|
||||
|
||||
// def createChatRoom():
|
||||
// print("modify memberIds ")
|
||||
// raise RuntimeError("modify memberIds then deleted me")
|
||||
// url = host + "/api/createChatRoom"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "memberIds": "wxid_8yn4k908tdqp22,wxid_oyb662qhop4422"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const createChatRoom = (memberIds: string) => {
|
||||
return post('/api/createChatRoom', { memberIds })
|
||||
}
|
||||
|
||||
// def quitChatRoom():
|
||||
// print("modify chatRoomId ")
|
||||
// raise RuntimeError("modify chatRoomId then deleted me")
|
||||
// url = host + "/api/quitChatRoom"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "chatRoomId": "123@chatroom"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const quitChatRoom = (chatRoomId: string) => {
|
||||
return post('/api/quitChatRoom', { chatRoomId })
|
||||
}
|
||||
|
||||
// def forwardMsg():
|
||||
// print("modify msgId ")
|
||||
// raise RuntimeError("modify msgId then deleted me")
|
||||
// url = host + "/api/forwardMsg"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "wxid": "filehelper",
|
||||
// "msgId": "12331"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const forwardMsg = (wxid: string, msgId: string) => {
|
||||
return post('/api/forwardMsg', { wxid, msgId })
|
||||
}
|
||||
|
||||
// def getSNSFirstPage():
|
||||
// url = host + "/api/getSNSFirstPage"
|
||||
|
||||
// payload = {}
|
||||
// headers = {}
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const getSNSFirstPage = () => {
|
||||
return post('/api/getSNSFirstPage')
|
||||
}
|
||||
|
||||
// def getSNSNextPage():
|
||||
// print("modify snsId ")
|
||||
// raise RuntimeError("modify snsId then deleted me")
|
||||
// url = host + "/api/getSNSNextPage"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "snsId": ""
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const getSNSNextPage = (snsId: string) => {
|
||||
return post('/api/getSNSNextPage', { snsId })
|
||||
}
|
||||
|
||||
// def addFavFromMsg():
|
||||
// print("modify msgId ")
|
||||
// raise RuntimeError("modify msgId then deleted me")
|
||||
// url = host + "/api/addFavFromMsg"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "msgId": "1222222"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const addFavFromMsg = (msgId: string) => {
|
||||
return post('/api/addFavFromMsg', { msgId })
|
||||
}
|
||||
|
||||
// def addFavFromImage():
|
||||
// print("modify wxid imagePath ")
|
||||
// raise RuntimeError("modify wxid imagePath then deleted me")
|
||||
// url = host + "/api/addFavFromImage"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "wxid": "",
|
||||
// "imagePath": ""
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const addFavFromImage = (wxid: string, imagePath: string) => {
|
||||
return post('/api/addFavFromImage', { wxid, imagePath })
|
||||
}
|
||||
|
||||
// def getContactProfile():
|
||||
// print("modify wxid ")
|
||||
// raise RuntimeError("modify wxid then deleted me")
|
||||
// url = host + "/api/getContactProfile"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "wxid": ""
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
// print(response.text)
|
||||
export const getContactProfile = (wxid: string) => {
|
||||
return post('/api/getContactProfile', { wxid })
|
||||
}
|
||||
|
||||
|
||||
// def sendAtText():
|
||||
// print("modify wxids chatRoomId")
|
||||
// raise RuntimeError("modify wxids chatRoomId then deleted me")
|
||||
// url = host + "/api/sendAtText"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "wxids": "notify@all",
|
||||
// "chatRoomId": "123@chatroom",
|
||||
// "msg": "你好啊"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const sendAtText = (wxids: string, chatRoomId: string, msg: string) => {
|
||||
return post('/api/sendAtText', { wxids, chatRoomId, msg })
|
||||
}
|
||||
|
||||
// def forwardPublicMsg():
|
||||
// print("modify param ")
|
||||
// raise RuntimeError("modify param then deleted me")
|
||||
// url = host + "/api/forwardPublicMsg"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "appName": "",
|
||||
// "userName": "",
|
||||
// "title": "",
|
||||
// "url": "",
|
||||
// "thumbUrl": "",
|
||||
// "digest": "",
|
||||
// "wxid": "filehelper"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const forwardPublicMsg = (param: {
|
||||
appName: string;
|
||||
userName: string;
|
||||
title: string;
|
||||
url: string;
|
||||
thumbUrl: string;
|
||||
digest: string;
|
||||
wxid: string
|
||||
}) => {
|
||||
return post('/api/forwardPublicMsg', param)
|
||||
}
|
||||
|
||||
// def forwardPublicMsgByMsgId():
|
||||
// print("modify param ")
|
||||
// raise RuntimeError("modify param then deleted me")
|
||||
// url = host + "/api/forwardPublicMsgByMsgId"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "msgId": 123,
|
||||
// "wxid": "filehelper"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const forwardPublicMsgByMsgId = (msgId: number, wxid: string) => {
|
||||
return post('/api/forwardPublicMsgByMsgId', { msgId, wxid })
|
||||
}
|
||||
|
||||
// def downloadAttach():
|
||||
// print("modify param ")
|
||||
// raise RuntimeError("modify param then deleted me")
|
||||
// url = host + "/api/downloadAttach"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "msgId": 123
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const downloadAttach = (msgId: number) => {
|
||||
return post('/api/downloadAttach', { msgId })
|
||||
}
|
||||
|
||||
|
||||
// def decodeImage():
|
||||
// print("modify param ")
|
||||
// raise RuntimeError("modify param then deleted me")
|
||||
// url = host + "/api/decodeImage"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "filePath": "C:\\66664816980131.dat",
|
||||
// "storeDir": "C:\\test"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const decodeImage = (filePath: string, storeDir: string) => {
|
||||
return post('/api/decodeImage', { filePath, storeDir })
|
||||
}
|
||||
|
||||
|
||||
// def getVoiceByMsgId():
|
||||
// print("modify param ")
|
||||
// raise RuntimeError("modify param then deleted me")
|
||||
// url = host + "/api/getVoiceByMsgId"
|
||||
|
||||
// payload = json.dumps({
|
||||
// "msgId": 7880439644200,
|
||||
// "storeDir": "c:\\test"
|
||||
// })
|
||||
// headers = {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
|
||||
// response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
// print(response.text)
|
||||
export const getVoiceByMsgId = (msgId: number, storeDir: string) => {
|
||||
return post('/api/getVoiceByMsgId', { msgId, storeDir })
|
||||
}
|
||||
|
||||
// /api/sendApplet
|
||||
export const sendApplet = (param: {
|
||||
wxid: string
|
||||
waidConcat: string
|
||||
appletWxid: string
|
||||
jsonParam: string
|
||||
headImgUrl: string
|
||||
mainImg: string
|
||||
indexPage: string
|
||||
}) => {
|
||||
return post('/api/sendApplet', param)
|
||||
}
|
||||
|
||||
// /api/sendPatMsg
|
||||
export const sendPatMsg = (receiver: string,
|
||||
wxid: string) => {
|
||||
return post('/api/sendPatMsg', { wxid, receiver })
|
||||
}
|
||||
|
||||
// /api/ocr
|
||||
export const ocr = (
|
||||
imagePath: string
|
||||
) => {
|
||||
return post('/api/ocr', { imagePath })
|
||||
}
|
33
nodejs_client_ts/src/tcp_server.ts
Normal file
33
nodejs_client_ts/src/tcp_server.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import net from 'net'
|
||||
import {
|
||||
readMsgStore,
|
||||
writeMsgStore,
|
||||
} from './utils/messageStore'
|
||||
export const server = net.createServer((socket:any) => {
|
||||
console.log('New client connected')
|
||||
let messageStore = readMsgStore()
|
||||
let data = Buffer.from('')
|
||||
|
||||
socket.on('data', (data:any, chunk:any) => {
|
||||
console.log(`Received data: ${data}`)
|
||||
const dataJson = JSON.parse(data)
|
||||
messageStore = writeMsgStore(messageStore, dataJson)
|
||||
// data = Buffer.concat([data, chunk])
|
||||
// console.log(`Received data: ${data}`)
|
||||
})
|
||||
|
||||
socket.on('end', () => {
|
||||
const decodedData = data.toString('utf8')
|
||||
console.log(`Received data: ${decodedData}`)
|
||||
})
|
||||
|
||||
socket.on('close', () => {
|
||||
console.log('Client disconnected')
|
||||
})
|
||||
})
|
||||
|
||||
const port = 19099
|
||||
|
||||
server.listen(port, () => {
|
||||
console.log(`Server listening on port ${port}`)
|
||||
})
|
50
nodejs_client_ts/src/utils/messageStore.ts
Normal file
50
nodejs_client_ts/src/utils/messageStore.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import fs from 'fs'
|
||||
|
||||
export const writeMsgStore = (messageStore: { [key: string]: any }, msg: { type: number, content?:any }) => {
|
||||
// 检测根目录下是否有msgStore.json文件,如果没有,则创建一个,内容为{}
|
||||
if (!fs.existsSync('msgStore.json')) {
|
||||
console.log('msgStore.json not exist')
|
||||
fs.writeFileSync('msgStore.json', '{}')
|
||||
}
|
||||
let type = String(msg.type)
|
||||
console.info('ws message hook:', type)
|
||||
// log.info(JSON.stringify(j, undefined, 2))
|
||||
|
||||
if (msg.content) {
|
||||
try {
|
||||
const content = msg.content
|
||||
// 从content中判断是否存在类似<type>6</type>的格式,并从其中取出type的值
|
||||
const m = content.match(/<type>(\d+)<\/type>/)
|
||||
if (m != null) {
|
||||
type = type + '_' + m[1]
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('ws message hook error:', e)
|
||||
}
|
||||
}
|
||||
|
||||
if (type === '10000') {
|
||||
const list10000 = messageStore['10000'] || []
|
||||
list10000.push(msg)
|
||||
messageStore[type] = list10000
|
||||
} else {
|
||||
messageStore[type] = msg
|
||||
}
|
||||
|
||||
// 将that.messageTypeTest保存到文件'/msgStore.json'
|
||||
fs.writeFileSync('msgStore.json', JSON.stringify(messageStore, undefined, 2))
|
||||
return messageStore
|
||||
}
|
||||
|
||||
export const readMsgStore = () => {
|
||||
// 读取'/msgStore.json'文件
|
||||
// 检测根目录下是否有msgStore.json文件,如果没有,则创建一个,内容为{}
|
||||
if (!fs.existsSync('msgStore.json')) {
|
||||
console.log('msgStore.json not exist')
|
||||
fs.writeFileSync('msgStore.json', '{}')
|
||||
return {}
|
||||
}
|
||||
const data = fs.readFileSync('msgStore.json', 'utf8')
|
||||
const json = JSON.parse(data)
|
||||
return json
|
||||
}
|
63
nodejs_client_ts/src/utils/mod.ts
Normal file
63
nodejs_client_ts/src/utils/mod.ts
Normal file
@ -0,0 +1,63 @@
|
||||
// 封装get和post请求
|
||||
import axios from 'axios'
|
||||
|
||||
// 创建 axios 实例
|
||||
const request = axios.create({
|
||||
// API 请求的默认前缀
|
||||
baseURL: 'http://127.0.0.1:19088',
|
||||
|
||||
// 请求超时时间
|
||||
timeout: 120000,
|
||||
})
|
||||
|
||||
/**
|
||||
* 异常拦截处理器
|
||||
*
|
||||
* @param {*} error
|
||||
*/
|
||||
const errorHandler = (error: { response?: { status: number, config: any } }) => {
|
||||
// 判断是否是响应错误信息
|
||||
if (error.response) {
|
||||
if (error.response.status === 401) {
|
||||
return request(error.response.config)
|
||||
}
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
/**
|
||||
* GET 请求
|
||||
*
|
||||
* @param {String} url
|
||||
* @param {Object} data
|
||||
* @param {Object} options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export const get = (url: string, data = {}, options = {}) => {
|
||||
|
||||
// request.interceptors.response.use((response) => response.data, errorHandler)
|
||||
return request({
|
||||
url,
|
||||
params: data,
|
||||
method: 'get',
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* POST 请求
|
||||
*
|
||||
* @param {String} url
|
||||
* @param {Object} data
|
||||
* @param {Object} options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export const post = (url: string, data = {}, options = {}) => {
|
||||
// request.interceptors.response.use((response) => response.data, errorHandler)
|
||||
return request({
|
||||
url,
|
||||
method: 'post',
|
||||
data,
|
||||
...options,
|
||||
})
|
||||
}
|
14
nodejs_client_ts/tsconfig.json
Normal file
14
nodejs_client_ts/tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"strict": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./",
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": [
|
||||
"./src",
|
||||
"./example/ding-dong-bot.ts"
|
||||
]
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
host = "http://127.0.0.1:19088"
|
||||
|
||||
def checkLogin():
|
||||
url = "127.0.0.1:19088/api/checkLogin"
|
||||
url = host + "/api/checkLogin"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -11,7 +12,7 @@ def checkLogin():
|
||||
|
||||
|
||||
def userInfo():
|
||||
url = "127.0.0.1:19088/api/userInfo"
|
||||
url = host + "/api/userInfo"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -19,7 +20,7 @@ def userInfo():
|
||||
|
||||
|
||||
def sendTextMsg():
|
||||
url = "127.0.0.1:19088/api/sendTextMsg"
|
||||
url = host + "/api/sendTextMsg"
|
||||
payload = json.dumps({
|
||||
"wxid": "filehelper",
|
||||
"msg": "12www"
|
||||
@ -32,7 +33,7 @@ def sendTextMsg():
|
||||
|
||||
|
||||
def sendImagesMsg():
|
||||
url = "127.0.0.1:19088/api/sendImagesMsg"
|
||||
url = host + "/api/sendImagesMsg"
|
||||
print("modify imagePath")
|
||||
raise RuntimeError("modify imagePath then deleted me")
|
||||
payload = json.dumps({
|
||||
@ -49,7 +50,7 @@ def sendImagesMsg():
|
||||
|
||||
|
||||
def sendFileMsg():
|
||||
url = "127.0.0.1:19088/api/sendFileMsg"
|
||||
url = host + "/api/sendFileMsg"
|
||||
print("modify filePath")
|
||||
raise RuntimeError("modify filePath then deleted me")
|
||||
payload = json.dumps({
|
||||
@ -64,7 +65,7 @@ def sendFileMsg():
|
||||
|
||||
|
||||
def hookSyncMsg():
|
||||
url = "127.0.0.1:19088/api/hookSyncMsg"
|
||||
url = host + "/api/hookSyncMsg"
|
||||
print("modify ip port url ")
|
||||
raise RuntimeError("modify ip port url then deleted me")
|
||||
payload = json.dumps({
|
||||
@ -82,7 +83,7 @@ def hookSyncMsg():
|
||||
|
||||
|
||||
def unhookSyncMsg():
|
||||
url = "127.0.0.1:19088/api/unhookSyncMsg"
|
||||
url = host + "/api/unhookSyncMsg"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -90,7 +91,7 @@ def unhookSyncMsg():
|
||||
|
||||
|
||||
def getContactList():
|
||||
url = "127.0.0.1:19088/api/getContactList"
|
||||
url = host + "/api/getContactList"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -98,7 +99,7 @@ def getContactList():
|
||||
|
||||
|
||||
def getDBInfo():
|
||||
url = "127.0.0.1:19088/api/getDBInfo"
|
||||
url = host + "/api/getDBInfo"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -106,7 +107,7 @@ def getDBInfo():
|
||||
|
||||
|
||||
def execSql():
|
||||
url = "127.0.0.1:19088/api/execSql"
|
||||
url = host + "/api/execSql"
|
||||
print("modify dbHandle ")
|
||||
raise RuntimeError("modify dbHandle then deleted me")
|
||||
payload = json.dumps({
|
||||
@ -121,7 +122,7 @@ def execSql():
|
||||
|
||||
|
||||
def getChatRoomDetailInfo():
|
||||
url = "127.0.0.1:19088/api/getChatRoomDetailInfo"
|
||||
url = host + "/api/getChatRoomDetailInfo"
|
||||
print("modify chatRoomId ")
|
||||
raise RuntimeError("modify chatRoomId then deleted me")
|
||||
payload = json.dumps({
|
||||
@ -135,7 +136,7 @@ def getChatRoomDetailInfo():
|
||||
|
||||
|
||||
def addMemberToChatRoom():
|
||||
url = "127.0.0.1:19088/api/addMemberToChatRoom"
|
||||
url = host + "/api/addMemberToChatRoom"
|
||||
print("modify chatRoomId memberIds ")
|
||||
raise RuntimeError("modify chatRoomId memberIds then deleted me")
|
||||
payload = json.dumps({
|
||||
@ -152,7 +153,7 @@ def addMemberToChatRoom():
|
||||
|
||||
|
||||
def delMemberFromChatRoom():
|
||||
url = "127.0.0.1:19088/api/delMemberFromChatRoom"
|
||||
url = host + "/api/delMemberFromChatRoom"
|
||||
print("modify chatRoomId memberIds ")
|
||||
raise RuntimeError("modify chatRoomId memberIds then deleted me")
|
||||
payload = json.dumps({
|
||||
@ -167,7 +168,7 @@ def delMemberFromChatRoom():
|
||||
|
||||
|
||||
def modifyNickname():
|
||||
url = "127.0.0.1:19088/api/modifyNickname"
|
||||
url = host + "/api/modifyNickname"
|
||||
print("modify chatRoomId wxid nickName")
|
||||
raise RuntimeError("modify chatRoomId wxid nickName then deleted me")
|
||||
payload = json.dumps({
|
||||
@ -185,7 +186,7 @@ def modifyNickname():
|
||||
def getMemberFromChatRoom():
|
||||
print("modify chatRoomId ")
|
||||
raise RuntimeError("modify chatRoomId then deleted me")
|
||||
url = "127.0.0.1:19088/api/getMemberFromChatRoom"
|
||||
url = host + "/api/getMemberFromChatRoom"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "123@chatroom"
|
||||
})
|
||||
@ -199,7 +200,7 @@ def getMemberFromChatRoom():
|
||||
def topMsg():
|
||||
print("modify msgId ")
|
||||
raise RuntimeError("modify msgId then deleted me")
|
||||
url = "127.0.0.1:19088/api/topMsg"
|
||||
url = host + "/api/topMsg"
|
||||
payload = json.dumps({
|
||||
"msgId": 1222222
|
||||
})
|
||||
@ -214,7 +215,7 @@ def removeTopMsg():
|
||||
print("modify msgId chatRoomId ")
|
||||
raise RuntimeError("modify msgId chatRoomId then deleted me")
|
||||
|
||||
url = "127.0.0.1:19088/api/removeTopMsg"
|
||||
url = host + "/api/removeTopMsg"
|
||||
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "123@chatroom",
|
||||
@ -231,7 +232,7 @@ def InviteMemberToChatRoom():
|
||||
print("modify memberIds chatRoomId ")
|
||||
raise RuntimeError("modify memberIds chatRoomId then deleted me")
|
||||
|
||||
url = "127.0.0.1:19088/api/InviteMemberToChatRoom"
|
||||
url = host + "/api/InviteMemberToChatRoom"
|
||||
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "123@chatroom",
|
||||
@ -245,7 +246,7 @@ def InviteMemberToChatRoom():
|
||||
|
||||
|
||||
def hookLog():
|
||||
url = "127.0.0.1:19088/api/hookLog"
|
||||
url = host + "/api/hookLog"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -253,7 +254,7 @@ def hookLog():
|
||||
|
||||
|
||||
def unhookLog():
|
||||
url = "127.0.0.1:19088/api/unhookLog"
|
||||
url = host + "/api/unhookLog"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -263,7 +264,7 @@ def unhookLog():
|
||||
def createChatRoom():
|
||||
print("modify memberIds ")
|
||||
raise RuntimeError("modify memberIds then deleted me")
|
||||
url = "127.0.0.1:19088/api/createChatRoom"
|
||||
url = host + "/api/createChatRoom"
|
||||
|
||||
payload = json.dumps({
|
||||
"memberIds": "wxid_8yn4k908tdqp22,wxid_oyb662qhop4422"
|
||||
@ -277,7 +278,7 @@ def createChatRoom():
|
||||
def quitChatRoom():
|
||||
print("modify chatRoomId ")
|
||||
raise RuntimeError("modify chatRoomId then deleted me")
|
||||
url = "127.0.0.1:19088/api/quitChatRoom"
|
||||
url = host + "/api/quitChatRoom"
|
||||
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "123@chatroom"
|
||||
@ -292,7 +293,7 @@ def quitChatRoom():
|
||||
def forwardMsg():
|
||||
print("modify msgId ")
|
||||
raise RuntimeError("modify msgId then deleted me")
|
||||
url = "127.0.0.1:19088/api/forwardMsg"
|
||||
url = host + "/api/forwardMsg"
|
||||
|
||||
payload = json.dumps({
|
||||
"wxid": "filehelper",
|
||||
@ -305,7 +306,7 @@ def forwardMsg():
|
||||
print(response.text)
|
||||
|
||||
def getSNSFirstPage():
|
||||
url = "127.0.0.1:19088/api/getSNSFirstPage"
|
||||
url = host + "/api/getSNSFirstPage"
|
||||
|
||||
payload = {}
|
||||
headers = {}
|
||||
@ -315,7 +316,7 @@ def getSNSFirstPage():
|
||||
def getSNSNextPage():
|
||||
print("modify snsId ")
|
||||
raise RuntimeError("modify snsId then deleted me")
|
||||
url = "127.0.0.1:19088/api/getSNSNextPage"
|
||||
url = host + "/api/getSNSNextPage"
|
||||
|
||||
payload = json.dumps({
|
||||
"snsId": ""
|
||||
@ -331,7 +332,7 @@ def getSNSNextPage():
|
||||
def addFavFromMsg():
|
||||
print("modify msgId ")
|
||||
raise RuntimeError("modify msgId then deleted me")
|
||||
url = "127.0.0.1:19088/api/addFavFromMsg"
|
||||
url = host + "/api/addFavFromMsg"
|
||||
|
||||
payload = json.dumps({
|
||||
"msgId": "1222222"
|
||||
@ -347,7 +348,7 @@ def addFavFromMsg():
|
||||
def addFavFromImage():
|
||||
print("modify wxid imagePath ")
|
||||
raise RuntimeError("modify wxid imagePath then deleted me")
|
||||
url = "127.0.0.1:19088/api/addFavFromImage"
|
||||
url = host + "/api/addFavFromImage"
|
||||
|
||||
payload = json.dumps({
|
||||
"wxid": "",
|
||||
@ -364,7 +365,7 @@ def addFavFromImage():
|
||||
def getContactProfile():
|
||||
print("modify wxid ")
|
||||
raise RuntimeError("modify wxid then deleted me")
|
||||
url = "127.0.0.1:19088/api/getContactProfile"
|
||||
url = host + "/api/getContactProfile"
|
||||
|
||||
payload = json.dumps({
|
||||
"wxid": ""
|
||||
@ -380,7 +381,7 @@ def getContactProfile():
|
||||
def sendAtText():
|
||||
print("modify wxids chatRoomId")
|
||||
raise RuntimeError("modify wxids chatRoomId then deleted me")
|
||||
url = "127.0.0.1:19088/api/sendAtText"
|
||||
url = host + "/api/sendAtText"
|
||||
|
||||
payload = json.dumps({
|
||||
"wxids": "notify@all",
|
||||
@ -398,7 +399,7 @@ def sendAtText():
|
||||
def forwardPublicMsg():
|
||||
print("modify param ")
|
||||
raise RuntimeError("modify param then deleted me")
|
||||
url = "127.0.0.1:19088/api/forwardPublicMsg"
|
||||
url = host + "/api/forwardPublicMsg"
|
||||
|
||||
payload = json.dumps({
|
||||
"appName": "",
|
||||
@ -420,7 +421,7 @@ def forwardPublicMsg():
|
||||
def forwardPublicMsgByMsgId():
|
||||
print("modify param ")
|
||||
raise RuntimeError("modify param then deleted me")
|
||||
url = "127.0.0.1:19088/api/forwardPublicMsgByMsgId"
|
||||
url = host + "/api/forwardPublicMsgByMsgId"
|
||||
|
||||
payload = json.dumps({
|
||||
"msgId": 123,
|
||||
@ -437,7 +438,7 @@ def forwardPublicMsgByMsgId():
|
||||
def downloadAttach():
|
||||
print("modify param ")
|
||||
raise RuntimeError("modify param then deleted me")
|
||||
url = "127.0.0.1:19088/api/downloadAttach"
|
||||
url = host + "/api/downloadAttach"
|
||||
|
||||
payload = json.dumps({
|
||||
"msgId": 123
|
||||
@ -454,7 +455,7 @@ def downloadAttach():
|
||||
def decodeImage():
|
||||
print("modify param ")
|
||||
raise RuntimeError("modify param then deleted me")
|
||||
url = "127.0.0.1:19088/api/decodeImage"
|
||||
url = host + "/api/decodeImage"
|
||||
|
||||
payload = json.dumps({
|
||||
"filePath": "C:\\66664816980131.dat",
|
||||
@ -472,7 +473,7 @@ def decodeImage():
|
||||
def getVoiceByMsgId():
|
||||
print("modify param ")
|
||||
raise RuntimeError("modify param then deleted me")
|
||||
url = "127.0.0.1:19088/api/getVoiceByMsgId"
|
||||
url = host + "/api/getVoiceByMsgId"
|
||||
|
||||
payload = json.dumps({
|
||||
"msgId": 7880439644200,
|
||||
@ -490,4 +491,5 @@ def getVoiceByMsgId():
|
||||
|
||||
if __name__ == '__main__':
|
||||
checkLogin()
|
||||
# userInfo()
|
||||
userInfo()
|
||||
sendTextMsg()
|
||||
|
103
python/client.py
103
python/client.py
@ -1,13 +1,14 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
host = "http://127.0.0.1:19088"
|
||||
|
||||
def check_login():
|
||||
"""
|
||||
0.检查是否登录
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=0"
|
||||
url = host + "/api/?type=0"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -19,22 +20,22 @@ def user_info():
|
||||
登录用户信息
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=8"
|
||||
url = host + "/api/?type=8"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
print(response.text)
|
||||
|
||||
|
||||
def send_text():
|
||||
def send_text(wxid, msg):
|
||||
"""
|
||||
发送文本
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=2"
|
||||
url = host + "/api/?type=2"
|
||||
payload = json.dumps({
|
||||
"wxid": "filehelper",
|
||||
"msg": "123"
|
||||
"wxid": wxid,
|
||||
"msg": msg
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
@ -43,16 +44,16 @@ def send_text():
|
||||
print(response.text)
|
||||
|
||||
|
||||
def send_at():
|
||||
def send_at(chatRoomId, wxids, msg):
|
||||
"""
|
||||
发送@消息
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=3"
|
||||
url = host + "/api/?type=3"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "12333@chatroom",
|
||||
"wxids": "notify@all",
|
||||
"msg": "12333"
|
||||
"chatRoomId": chatRoomId,
|
||||
"wxids": wxids, # "notify@all"
|
||||
"msg": msg
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
@ -61,15 +62,19 @@ def send_at():
|
||||
print(response.text)
|
||||
|
||||
|
||||
def send_img():
|
||||
def send_img(wxid, imgPath):
|
||||
# {
|
||||
# "wxid": "filehelper",
|
||||
# "imagePath": "C:/123.png"
|
||||
# }
|
||||
"""
|
||||
发送图片
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=5"
|
||||
url = host + "/api/?type=5"
|
||||
payload = json.dumps({
|
||||
"wxid": "filehelper",
|
||||
"imagePath": "C:/123.png"
|
||||
"wxid": wxid,
|
||||
"imagePath": imgPath
|
||||
})
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
@ -83,7 +88,7 @@ def send_file():
|
||||
发送文件
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=6"
|
||||
url = host + "/api/?type=6"
|
||||
payload = json.dumps({
|
||||
"wxid": "filehelper",
|
||||
"filePath": "C:/test.txt"
|
||||
@ -100,7 +105,7 @@ def hook_msg():
|
||||
hook 消息
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=9"
|
||||
url = host + "/api/?type=9"
|
||||
payload = json.dumps({
|
||||
"port": "19099",
|
||||
"ip": "127.0.0.1"
|
||||
@ -117,7 +122,7 @@ def unhook_msg():
|
||||
取消消息hook
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=10"
|
||||
url = host + "/api/?type=10"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -129,7 +134,7 @@ def hook_img():
|
||||
hook 图片
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=11"
|
||||
url = host + "/api/?type=11"
|
||||
payload = json.dumps({
|
||||
"imgDir": "C:\\img"
|
||||
})
|
||||
@ -145,7 +150,7 @@ def unhook_img():
|
||||
取消hook 图片
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=12"
|
||||
url = host + "/api/?type=12"
|
||||
payload = json.dumps({
|
||||
"imgDir": "C:\\img"
|
||||
})
|
||||
@ -161,7 +166,7 @@ def hook_voice():
|
||||
hook 语音
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=56"
|
||||
url = host + "/api/?type=56"
|
||||
payload = json.dumps({
|
||||
"msgId": 322456091115784000
|
||||
})
|
||||
@ -177,7 +182,7 @@ def unhook_voice():
|
||||
取消hook 语音
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=14"
|
||||
url = host + "/api/?type=14"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -189,7 +194,7 @@ def del_friend():
|
||||
删除好友
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=17"
|
||||
url = host + "/api/?type=17"
|
||||
payload = json.dumps({
|
||||
"wxid": "wxid_1124423322"
|
||||
})
|
||||
@ -205,7 +210,7 @@ def search_friend():
|
||||
网络搜素用户
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=19"
|
||||
url = host + "/api/?type=19"
|
||||
payload = json.dumps({
|
||||
"keyword": "13812345678"
|
||||
})
|
||||
@ -221,7 +226,7 @@ def add_friend():
|
||||
添加好友
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=20"
|
||||
url = host + "/api/?type=20"
|
||||
payload = json.dumps({
|
||||
"wxid": "wxid_o11222334422"
|
||||
})
|
||||
@ -237,7 +242,7 @@ def fetch_chat_room_members():
|
||||
群成员
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=25"
|
||||
url = host + "/api/?type=25"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "2112222004@chatroom"
|
||||
})
|
||||
@ -253,7 +258,7 @@ def get_member_nickname():
|
||||
群成员昵称
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=26"
|
||||
url = host + "/api/?type=26"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "322333384@chatroom",
|
||||
"memberId": "wxid_4m1112222u22"
|
||||
@ -270,7 +275,7 @@ def del_member():
|
||||
删除群成员
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=27"
|
||||
url = host + "/api/?type=27"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "31122263384@chatroom",
|
||||
"memberIds": "wxid_12223334422"
|
||||
@ -287,7 +292,7 @@ def add_member():
|
||||
增加群成员
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=28"
|
||||
url = host + "/api/?type=28"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "1111163384@chatroom",
|
||||
"memberIds": "wxid_o12222222"
|
||||
@ -304,7 +309,7 @@ def modify_room_name():
|
||||
修改群昵称
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=31"
|
||||
url = host + "/api/?type=31"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "222285428@chatroom",
|
||||
"wxid": "wxid_222222512",
|
||||
@ -322,7 +327,7 @@ def get_db_handlers():
|
||||
获取sqlite3的操作句柄
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=32"
|
||||
url = host + "/api/?type=32"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -334,7 +339,7 @@ def query_db_by_sql():
|
||||
查询数据库
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=34"
|
||||
url = host + "/api/?type=34"
|
||||
payload = json.dumps({
|
||||
"dbHandle": 116201928,
|
||||
"sql": "select localId from MSG where MsgSvrID= 7533111101686156"
|
||||
@ -351,7 +356,7 @@ def hook_log():
|
||||
hook 日志
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=36"
|
||||
url = host + "/api/?type=36"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -363,7 +368,7 @@ def unhook_log():
|
||||
取消hook日志
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=37"
|
||||
url = host + "/api/?type=37"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -375,7 +380,7 @@ def forward():
|
||||
转发消息
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=40"
|
||||
url = host + "/api/?type=40"
|
||||
payload = json.dumps({
|
||||
"wxid": "filehelper",
|
||||
"msgid": "705117679011122708"
|
||||
@ -392,7 +397,7 @@ def logout():
|
||||
退出登录
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=44"
|
||||
url = host + "/api/?type=44"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -404,7 +409,7 @@ def confirm_receipt():
|
||||
确认收款
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=45"
|
||||
url = host + "/api/?type=45"
|
||||
payload = json.dumps({
|
||||
"wxid": "wxid_1111112622",
|
||||
"transcationId": "10000500012312222212243388865912",
|
||||
@ -422,7 +427,7 @@ def contact_list():
|
||||
好友列表
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=46"
|
||||
url = host + "/api/?type=46"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -434,7 +439,7 @@ def room_detail():
|
||||
群详情
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=47"
|
||||
url = host + "/api/?type=47"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "199134446111@chatroom"
|
||||
})
|
||||
@ -450,7 +455,7 @@ def ocr():
|
||||
ocr提取文字
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=49"
|
||||
url = host + "/api/?type=49"
|
||||
payload = json.dumps({
|
||||
"imagePath": "C:\\WeChat Files\\b23e84997144dd12f21554b0.dat"
|
||||
})
|
||||
@ -466,7 +471,7 @@ def pat():
|
||||
拍一拍
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=50"
|
||||
url = host + "/api/?type=50"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "211111121004@chatroom",
|
||||
"wxid": "wxid_111111111422"
|
||||
@ -483,7 +488,7 @@ def top_msg():
|
||||
消息置顶
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=51"
|
||||
url = host + "/api/?type=51"
|
||||
payload = json.dumps({
|
||||
"wxid": "wxid_o11114422",
|
||||
"msgid": 3728307145189195000
|
||||
@ -500,7 +505,7 @@ def close_top_msg():
|
||||
取消置顶
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=52"
|
||||
url = host + "/api/?type=52"
|
||||
payload = json.dumps({
|
||||
"chatRoomId": "213222231004@chatroom",
|
||||
"msgid": 3728307145189195000
|
||||
@ -517,7 +522,7 @@ def sns_first():
|
||||
朋友圈首页
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=53"
|
||||
url = host + "/api/?type=53"
|
||||
payload = {}
|
||||
headers = {}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
@ -529,7 +534,7 @@ def sns_next():
|
||||
朋友圈下一页
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=54"
|
||||
url = host + "/api/?type=54"
|
||||
payload = json.dumps({
|
||||
"snsId": "14091988153735844377"
|
||||
})
|
||||
@ -545,7 +550,7 @@ def query_nickname():
|
||||
查询联系人或群名称
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=55"
|
||||
url = host + "/api/?type=55"
|
||||
|
||||
payload = json.dumps({
|
||||
"id": "wxid_1112p4422"
|
||||
@ -562,7 +567,7 @@ def download_msg_attach():
|
||||
下载消息附件
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=56"
|
||||
url = host + "/api/?type=56"
|
||||
payload = json.dumps({
|
||||
"msgId": 6080100336053626000
|
||||
})
|
||||
@ -578,7 +583,7 @@ def get_member_info():
|
||||
获取群/群成员信息
|
||||
:return:
|
||||
"""
|
||||
url = "127.0.0.1:19088/api/?type=57"
|
||||
url = host + "/api/?type=57"
|
||||
payload = json.dumps({
|
||||
"wxid": "wxid_tx8k6tu21112"
|
||||
})
|
||||
@ -592,4 +597,4 @@ def get_member_info():
|
||||
if __name__ == '__main__':
|
||||
check_login()
|
||||
user_info()
|
||||
send_text()
|
||||
send_text("filehelper","123")
|
Loading…
Reference in New Issue
Block a user