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

Function GetAuth

Ctrip-DailyBonus/Ctrip.js:122–134  ·  view source on GitHub ↗
(body, data)

Source from the content-addressed store, hash-verified

120}
121
122function GetAuth(body, data) {
123 if (body.ticket && body.uid) {
124 if (!data.account || !data.account[body.uid]) {
125 notifyMsg.push(`账号: ${body.uid}\n写入授权成功!`);
126 } else {
127 $.info(`账号: ${body.uid}\n更新授权成功!`);
128 }
129 data.account = { ...data.account, ...{ [body.uid]: { auth: body.ticket } } };
130 } else {
131 $.error(`写入授权失败, 授权值缺失.`)
132 }
133 return $.setjson(data, $.name);
134}
135
136//Bark APP notify
137async function BarkNotify(c, k, t, b) { for (let i = 0; i < 3; i++) { c.log(`🔷Bark notify >> Start push (${i + 1})`); const s = await new Promise((n) => { c.post({ url: 'https://api.day.app/push', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ title: t, body: b, device_key: k, ext_params: { group: t } }) }, (e, r, d) => r && r.status == 200 ? n(1) : n(d || e)) }); if (s === 1) { c.log('✅Push success!'); break } else { c.log(`❌Push failed! >> ${s.message || s}`) } } };

Callers 1

Ctrip.jsFile · 0.70

Calls 3

infoMethod · 0.45
errorMethod · 0.45
setjsonMethod · 0.45

Tested by

no test coverage detected