-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckinL.js
94 lines (88 loc) · 3.23 KB
/
checkinL.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const got = require("got");
(async () => {
const key = {
activityId: "947079313798000641",
storeId: 49006,
timestamp: "1728532380809",
signature: "DDC22C8A5C291694ABB303272A2EF92C",
appid: "wxafec6f8422cb357b",
};
const opts = {
url: "https://webapi2.qmai.cn/web/cmk-center/sign/takePartInSign",
headers: {
Host: "webapi2.qmai.cn",
Connection: "keep-alive",
"Qm-From": "wechat",
Accept: "v=1.0",
"Qm-User-Token":
"FZqzj837jbtKRZhmckAI7LChE3fX01avnVC16RO3QMscDx6fjwmrw73v_7sev6AM",
xweb_xhr: 1,
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c11)XWEB/11275",
"Qm-From-Type": "catering",
"Content-Type": "application/json",
"Sec-Fetch-Site": "cross-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
Referer:
"https://servicewechat.com/wxafec6f8422cb357b/193/page-frame.html",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
},
json: key, // Automatically stringifies the body
responseType: "json", // Automatically parses the JSON response
};
const opts2 = {
url: "https://webapi2.qmai.cn/web/cmk-center/common/getCrmAvailablePoints?appid=wxafec6f8422cb357b",
headers: {
Host: "webapi2.qmai.cn",
Connection: "keep-alive",
"Qm-From": "wechat",
Accept: "v=1.0",
"Qm-User-Token":
"FZqzj837jbtKRZhmckAI7LChE3fX01avnVC16RO3QMscDx6fjwmrw73v_7sev6AM",
xweb_xhr: 1,
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c11)XWEB/11275",
"Qm-From-Type": "catering",
"Content-Type": "application/json",
"Sec-Fetch-Site": "cross-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
Referer:
"https://servicewechat.com/wxafec6f8422cb357b/193/page-frame.html",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
},
responseType: "json", // Automatically parses the JSON response
};
try {
const resp = await got.post(opts.url, {
headers: opts.headers,
json: opts.json,
});
const body = JSON.parse(resp.body || "{}");
if (body.code === 0) {
console.log(`签到成功,${body.message}`);
} else if (body.code === 1003106) {
console.log("业务繁忙,请稍后再试");
} else {
console.log(`签到失败(${body.message})`);
}
} catch (err) {
console.error(`Send checkin request error:`, err);
}
try {
const resp2 = await got.get(opts2.url, {
headers: opts2.headers,
});
const body2 = JSON.parse(resp2.body || "{}");
if (body2.code == 0) {
console.log(`查询积分成功,木子当前积分为${body2.data}`);
} else {
console.log(`查询失败(${body2.message})`);
}
} catch (err) {
console.error(`Send lookingup request error:`, err);
}
})();