From 8bd784adf02f3de52fd8026248b9b79f4df29f39 Mon Sep 17 00:00:00 2001 From: fdc310 <82008029+fdc310@users.noreply.github.com> Date: Wed, 14 May 2025 21:19:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86wechatpad=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E6=96=87=E6=A1=A3=20(#50)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 添加了wechatpad的部署文档 * doc: add wechatpad doc --------- Co-authored-by: fdc Co-authored-by: Junyan Qin --- docs/.vitepress/config.mts | 4 + docs/zh/deploy/platforms/wechat/wechatpad.md | 167 +++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 docs/zh/deploy/platforms/wechat/wechatpad.md diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index b6c5fe974..e821749a6 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -95,6 +95,10 @@ export default defineConfig({ text: "个人微信", collapsed: true, items: [ + { + text: "WeChatPad", + link: "/zh/deploy/platforms/wechat/wechatpad", + }, { text: "Gewechat", link: "/zh/deploy/platforms/wechat/gewechat", diff --git a/docs/zh/deploy/platforms/wechat/wechatpad.md b/docs/zh/deploy/platforms/wechat/wechatpad.md new file mode 100644 index 000000000..e9817223c --- /dev/null +++ b/docs/zh/deploy/platforms/wechat/wechatpad.md @@ -0,0 +1,167 @@ +# 通过wechatpadpro 接入个人微信 + +**本教程仅说明docker部署教程,如果可以尽量将wechatpadpro部署到同一网络** + + +## 拉取wechatpad-docker + +```bash +git clone https://github.com/fdc310/WeChatPad-Docker.git +``` + +### 一、如果不更改redis,mysql,adminkey和相关端口及其网络的情况下可以直接运行 + +```bash +docker compose up -d + +``` +* 查看日志是否启动成功 +```bash +docker logs wechatpad +``` +启动成功实例如下输出 +```bash +版本号: v20240818.00 +======== ADMIN_KEY === adminKey ======== +connect MySQL success +auto create MySQL tables success +connect Redis success +GET Connection locfree Failed by ee4c9a06-cf5e-4451-9e81-5290d0217625 abandon the conntection get ! +updateApiVersion success + +启动GIN服务成功! http://0.0.0.0:8849 + +``` + +* 然后在本机或者局域网下访问http://serveip:9090进入swagger即可。 + +### 二、如果要更改网络与langbot在同一个Docker网络中,以及数据库密码和端口更改。 + +那就修改yaml文件,以下是 WeChatPad 的 yaml 文件,容器连接方式可以参考[文档](/zh/workshop/network-details.html)。 + +```yaml +version: "3.3" +services: + mysql_wx: + # 指定容器的名称 + container_name: mysql_wxpad + # 指定镜像和版本 + image: mysql:8.0 + ports: + - "3306:3306" + restart: always + # 容器日志大小配置 + logging: + driver: "json-file" + options: + max-size: "5g" + environment: + # 配置root密码 + MYSQL_ROOT_PASSWORD: test_mysql + MYSQL_ROOT_HOST: '%' + MYSQL_DATABASE: wechatpadpro + volumes: + # 挂载数据目录 + - "./mysql/data:/var/lib/mysql" + # 挂载配置文件目录 + - "./mysql/config:/etc/mysql/conf.d" + networks: + - langbot-network + healthcheck: + # 可选:健康检查确保MySQL就绪 + test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ] + interval: 5s + timeout: 3s + retries: 5 + + #redis: + redis_wx: + # 指定容器的名称 + image: redis:alpine + container_name: redis_wxpad + restart: unless-stopped + command: redis-server --requirepass testredis + environment: + - REDIS_PASSWORD=testredis + volumes: + - ./redis/data:/data + ports: + - "6381:6379" + networks: + - langbot-network + healthcheck: + test: ["CMD", "redis-cli", "-a", "testredis", "ping"] + interval: 5s + timeout: 3s + retries: 5 + + wechatpad: + # 指定容器的名称 + container_name: wechatpad + # 指定镜像和版本 + image: alpine:latest + ports: + - "9090:8849" + restart: always + depends_on: + mysql_wx: + condition: service_healthy + redis_wx: + condition: service_healthy + links: + - mysql_wx + - redis_wx + volumes: + - ./app:/app # 映射数据目录,宿主机:容器 + # 指定工作目录 + working_dir: /app + # 指定容器启动命令,执行./stay + command: [ "/bin/sh", "-c", "chmod +x ./stay && ./stay" ] + # 容器日志大小配置 + logging: + driver: "json-file" + options: + max-size: "5g" + # 设置时区 + environment: + - TZ=Asia/Shanghai + # 设置语言 + - LANG=zh_CN.UTF-8 + # 设置编码 + - LC_ALL=zh_CN.UTF-8 + networks: + - langbot-network +networks: + langbot-network: + external: true + +``` + +## 如果要手动部署 + +请查看[wechatpadpro文档](https://github.com/luolin-ai/WeChatPadPro) + + +## 登录微信 +1. 成功启动wechatpadpro后根据你的serverip:port访问wechatpadpro的swagger +2. 填入adminKey +3. 获取token +** try it out /admin/GanAuthKey1接口bady中的days改为365即可 +等待返回拿到里面的token回填入上面的token +5. 登录微信 +** try it out /login/GetLoginQrCodeNew接口即可(和服务器是同市或者同省) +** 如果市云服务器,需要填入Proxy +** 返回的参数中有登录二维码链接,打开扫码登录即可 + +6. 记录你的adminkey,token,wx地址和访问地址(wxid可以不管) + + +## 在langbot的创建机器人中填写信息 + +- wechatpad_key 填写adminKey +- wechatpad_url 填写wechatpadpro的地址 +- wechatpad_ws 填写wechatpadpro的ws地址 +- wxid 填写该登录账号的的wxid +- wechatpad_token 填写wechatpadpro的token + +