# wechat-js-sdk **Repository Path**: truexinology/wechat-js-sdk ## Basic Information - **Project Name**: wechat-js-sdk - **Description**: wechat-js-sdk - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2018-06-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # wechat-js-sdk #### 安装 1. git clone https://gitee.com/truexinology/wechat-js-sdk.git sdk 2. cd sdk 3. yarn 4. yarn start ### 1.安全域名配置 `static = 》 public 为项目的根目录, 所以MP_verify_EQTTWNpnEwzzZ8gD.txt文件应该放在这里。 同理,图片和链接访问地址也是放在这里。` ![](.README_images/62077bc2.png) ### 2.白名单设置 ```nodemon // 腾讯云服务器公网地址 140.143.186.126 ``` ![](.README_images/0d69aae6.png) ### 3.nginx配置 修改 nginx.conf文件: 提交以下内容 ```md server { listen 80; server_name sdk.truexin.club; location / { root www; proxy_pass http://localhost:3008; proxy_read_timeout 90; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_redirect off; } } ``` ### 4.ngrok内网映射测试: ```nodemon ngrok http 3008 ``` ```nodemon 0a52e825.ngrok.io // ngrok内网映射测试安全域名配置 sdk.truexin.club // 腾讯云服务器安全域名配置 ``` ### 5.微信 JS 接口签名校验工具 https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign https://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index ### 注意: // 使用ajax获取进行分享的url var url = req.query ? req.query.url : req.protocol + '://' + req.hostname + req.path; 签名必须使用当前访问页面路径的url的href值,就是除了hash以外的。 // client 形式获取其实就是当前url,所以不需要修改; ![](.README_images/075d3bca.png) ```json true小吧的测试号 { "appId": "wx84b39c56cf4cf5e5", "appSecret": "48d483217032ea5782a8d77ce2c11a2c" } 蜂巢里服务号: wechat.mp.appId=wxea91f3d6be5bb758 wechat.mp.secret=28207bd80972ca7eedcf8f275cf542ab ``` ```md 查看项目远程地址: git remote -v origin https://gitee.com/truexinology/wechat-js-sdk.git (fetch) origin https://gitee.com/truexinology/wechat-js-sdk.git (push) ``` https://segmentfault.com/q/1010000002520634 https://wohugb.gitbooks.io/webot/content/js-sdk/error.html https://www.cnblogs.com/xjbBill/p/7868095.html java: https://blog.csdn.net/tidd_yan/article/details/86655505 https://blog.csdn.net/ruihaol/article/details/79184373 php: https://blog.csdn.net/running8/article/details/77017924 https://segmentfault.com/a/1190000004004709