Update wx_ziwi.js

This commit is contained in:
smallfawn
2025-03-17 09:02:58 +08:00
parent 13e2fa213b
commit ba2b652935

View File

@@ -1,8 +1,8 @@
/** /**
* cron 25 10 * * * wx_ZIWI+.js * cron 25 10 * * * wx_ZIWI+.js
* 积分换 猫粮狗粮 * 积分换 猫粮狗粮
* 变量名wxziwiwxid 值为lufly登录授权的微信id 用于获取微信CODE 来刷新CK * 变量名wxid_ziwi 值为lufly登录授权的微信id 用于获取微信CODE 来刷新CK
* 变量名luflytoken 谨慎使用加密本 防止偷取TOKEN * 变量名wxcenter 谨慎使用加密本 防止偷取TOKEN
* *
* *
* *
@@ -12,13 +12,13 @@
const $ = new Env("微信小程序ZIWI+"); const $ = new Env("微信小程序ZIWI+");
const notify = $.isNode() ? require('../sendNotify') : ''; const notify = $.isNode() ? require('../sendNotify') : '';
let ckName = "wxziwiwxid"; let ckName = "wxid_ziwi";
let envSplitor = ["&", "\n"]; //多账号分隔符 let envSplitor = ["&", "\n"]; //多账号分隔符
let strSplitor = "#"; //多变量分隔符 let strSplitor = "#"; //多变量分隔符
let userIdx = 0; let userIdx = 0;
let userList = []; let userList = [];
let appid = 'wxb26a710e583b05dc' let appid = 'wxb26a710e583b05dc'
let wxcenter = 'http://w.smallfawn.top:5789' let wxcenter = process.env['wxcenter'] || ''
class Task { class Task {
constructor(str) { constructor(str) {
this.index = ++userIdx; this.index = ++userIdx;
@@ -29,25 +29,34 @@ class Task {
this.ck = '' this.ck = ''
} }
async main() { async main() {
if (!wxcenter) return $.log(`请填写wxcenter`)
await this.getCode() await this.getCode()
} }
async getCode() { async getCode() {
let { body: result } = await $.httpRequest({ let options = {
method: 'post', headers: { url: `${wxcenter}/api/Wxapp/JSLogin`,
headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, url: wxcenter + '/api/getcode', body: JSON.stringify({ "luflyKey": process.env['luflytoken'], "wxid": "" + this.wxid, "appid": appid }) },
}) method: 'POST',
if (result) { data: { "Wxid": "" + this.wxid, "Appid": "" + appid }
console.log(result) }
if (result.status) { let { data: result } = await this.request(options);
let code = result.data
await this.getJwtByCode(code)
}
if (result.Success) {
let code = result.Data.code
await this.getJwtByCode(code)
} else {
$.log(`账号[${this.index}]【${this.name}】 获取code失败`);
} }
} }
async getJwtByCode(code) { async getJwtByCode(code) {