Update wx_ziwi.js

This commit is contained in:
smallfawn
2025-02-25 13:02:21 +08:00
parent 36dcb1938a
commit 1cc77a8aab

View File

@@ -1,7 +1,10 @@
/** /**
* cron 25 10 * * * wx_ZIWI+.js * cron 25 10 * * * wx_ZIWI+.js
* 积分换 猫粮狗粮 * 积分换 猫粮狗粮
* 变量名wxziwiwxid 值为lufly登录授权的微信id 用于获取微信CODE 来刷新CK
* 变量名luflytoken 谨慎使用加密本 防止偷取TOKEN
* 变量名:ZIWIAUTH * 变量名:ZIWIAUTH
*
* 变量值:https://ziwi.gzcrm.cn/json-rpc? Headers中的authorization 去掉Bearer 去掉Bearer 去掉Bearer * 变量值:https://ziwi.gzcrm.cn/json-rpc? Headers中的authorization 去掉Bearer 去掉Bearer 去掉Bearer
* 多账号& 或新增变量 * 多账号& 或新增变量
* scriptVersionNow = "0.0.1"; * scriptVersionNow = "0.0.1";
@@ -14,6 +17,8 @@ let envSplitor = ["&", "\n"]; //多账号分隔符
let strSplitor = "#"; //多变量分隔符 let strSplitor = "#"; //多变量分隔符
let userIdx = 0; let userIdx = 0;
let userList = []; let userList = [];
let appid = 'wxb26a710e583b05dc'
let wxcenter = 'http://w.smallfawn.top:5789'
let msg = "" let msg = ""
class Task { class Task {
constructor(str) { constructor(str) {
@@ -24,6 +29,9 @@ class Task {
this.artList = [] this.artList = []
} }
async main() { async main() {
if (process.env['wxziwiwxid']) {
await this.getCode()
}
await this.task_sign() await this.task_sign()
await this.act_list(); await this.act_list();
if (this.artList.length > 0) { if (this.artList.length > 0) {
@@ -33,13 +41,43 @@ class Task {
} }
} }
} }
async getCode() {
let { body: result } = await $.httpRequest({
method: 'post', headers: {
'Content-Type': 'application/json'
}, url: wxcenter + '/api/getcode', body: JSON.stringify({ "luflyKey": process.env['luflytoken'], "wxid": "" + process.env['wxziwiwxid'], "appid": "wxb26a710e583b05dc" })
})
if (result) {
console.log(result)
if (result.status) {
let code = result.data
await this.getJwtByCode(code)
}
}
}
async getJwtByCode(code) {
let result = await this.taskRequest('post', 'https://ziwi.gzcrm.cn/json-rpc?__method=WechatMiniProgramCodeToSession', { "id": "", "jsonrpc": "2.0", "method": "WechatMiniProgramCodeToSession", "params": { "appId": "wxb26a710e583b05dc", "code": "" + code, "launchOptions": { "path": "pages/index/index", "query": {}, "referrerInfo": {}, "apiCategory": "default" } } })
if (result) {
if ('result' in result) {
if ('jwt' in result.result) {
console.log(`刷新CK成功`)
return this.ck = result.result.jwt
}
}
}
}
async taskRequest(method, url, body = "") { async taskRequest(method, url, body = "") {
// //
let headers = { let headers = {
"Host": "ziwi.gzcrm.cn", "Host": "ziwi.gzcrm.cn",
"Connection": "keep-alive", "Connection": "keep-alive",
//"Content-Length": "85", //"Content-Length": "85",
"authorization": "Bearer "+ this.ck, "authorization": "Bearer " + this.ck,
"charset": "utf-8", "charset": "utf-8",
"User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Lite Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 XWEB/1160027 MMWEBSDK/20231002 MMWEBID/2585 MicroMessenger/8.0.43.2480(0x28002B51) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android", "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Lite Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 XWEB/1160027 MMWEBSDK/20231002 MMWEBID/2585 MicroMessenger/8.0.43.2480(0x28002B51) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",