Skip to content

Commit e5a6017

Browse files
committed
增加积分查询功能
1 parent 0e3ee55 commit e5a6017

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

ksf/ksf.js

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
cron "18 8 * * *"
33
44
2-9 发布第一版 签到+积分抽奖
5+
2-18 增加积分查询功能
56
67
入口: https://github.com/yml2213/javascript/blob/master/ksf/ksf.jpg
78
@@ -46,11 +47,16 @@ const notify = $.isNode() ? require('./sendNotify') : '';
4647
console.log(`-------- 共 ${wx_yml_ksf_data.length} 个账号 --------`)
4748
// console.log(wx_yml_ksf_data);
4849
console.log(
49-
`\n\n=== 脚本执行 - 北京时间(UTC+8):${new Date(
50+
`\n\n====== 脚本执行 - 北京时间(UTC+8):${new Date(
5051
new Date().getTime() +
5152
new Date().getTimezoneOffset() * 60 * 1000 +
5253
8 * 60 * 60 * 1000
53-
).toLocaleString()} ===\n`);
54+
).toLocaleString()} ======\n`);
55+
56+
console.log( `=======成功运行脚本后不要打开小程序,会导致token失效=======`);
57+
console.log( `=======成功运行脚本后不要打开小程序,会导致token失效=======`);
58+
console.log( `=======成功运行脚本后不要打开小程序,会导致token失效=======`);
59+
5460

5561

5662
await wyy();
@@ -70,6 +76,7 @@ const notify = $.isNode() ? require('./sendNotify') : '';
7076
await $.wait(2 * 1000);
7177
await cj();
7278
await $.wait(2 * 1000);
79+
await cx();
7380

7481

7582
}
@@ -200,7 +207,45 @@ function cj(timeout = 0) {
200207

201208
}
202209

210+
// https://club.biqr.cn/api/member/getMemberInfo
211+
// 积分查询
212+
function cx(timeout = 0) {
213+
return new Promise((resolve) => {
214+
let url = {
215+
url: `https://${host}/api/member/getMemberInfo`,
216+
headers: {
217+
'Content-Type': 'application/x-www-form-urlencoded',
218+
'Token': token[0],
219+
},
203220

221+
}
222+
// console.log(url);
223+
224+
$.get(url, async (err, resp, data) => {
225+
226+
try {
227+
228+
// console.log(`输出data开始===================`);
229+
// console.log(data);
230+
// console.log(`输出data结束===================`);
231+
232+
result = JSON.parse(data);
233+
if (result.code === 0) {
234+
$.log(`\n 当前账号: ${result.data.nickname} , \n 查询积分:${result.data.integral} ,\n 累计获得查询积分:${result.data.totalIntegral} `)
235+
236+
} else {
237+
$.log(`\n 查询积分:失败 ❌ 了呢,请重新获取token ! `)
238+
}
239+
} catch (e) {
240+
$.logErr(e, resp);
241+
} finally {
242+
resolve()
243+
}
244+
}, timeout)
245+
246+
})
247+
248+
}
204249

205250

206251

0 commit comments

Comments
 (0)