MCPcopy Index your code
hub / github.com/NobyDa/Script / Checkin

Function Checkin

Ctrip-DailyBonus/Ctrip.js:68–96  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

66 });
67
68function Checkin(key) {
69 const opts = {
70 url: 'https://m.ctrip.com/restapi/soa2/22769/signToday',
71 headers: {
72 "Content-Type": "application/json",
73 "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21E219 MicroMessenger/8.0.49'
74 },
75 body: JSON.stringify({ head: { auth: key } })
76 };
77 $.debug(`Send checkin request:`, $.toStr(opts, 'error', null, 1));
78 return $.http.post(opts)
79 .then((resp) => {
80 $.debug(`Receive checkin request response:`, $.toStr(resp))
81 resp.body = JSON.parse(resp.body?.startsWith('{') && resp.body || '{}');
82 if (resp.body.code == 0) {
83 return '签到成功'
84 } else if (resp.body.code == 400001) {
85 return '已签过'
86 } else if (resp.body.code == 404001) {
87 return '登陆失效, 尝试移除账号...'
88 } else {
89 return `签到失败(${resp.body.message})`
90 }
91 })
92 .catch((err) => {
93 $.error(`Send checkin request error:`, err);
94 return `签到错误`
95 })
96}
97
98function Points(key) {
99 const opts = {

Callers 1

Ctrip.jsFile · 0.70

Calls 5

stringifyMethod · 0.45
debugMethod · 0.45
toStrMethod · 0.45
postMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected