MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / signIn

Function signIn

wxapp/aima.js:202–248  ·  view source on GitHub ↗
(account, index)

Source from the content-addressed store, hash-verified

200
201// ================== 核心逻辑 ==================
202async function signIn(account, index) {
203 let token = await getAccessToken(account);
204 const setToken = (newToken) => {
205 token = newToken;
206 };
207
208 $.log(`🚀 账号【${index}】查询签到状态...`);
209 const searchRes = await request(
210 "post",
211 `${WXCLIENT_URL}/mkt/activities/sign:search`,
212 token,
213 {
214 data: { activityId: ACTIVITY_ID },
215 account,
216 onToken: setToken,
217 }
218 );
219
220 if (searchRes.status !== 200 || searchRes.data?.code !== 200) {
221 throw new Error(`查询签到状态失败: HTTP ${searchRes.status} ${JSON.stringify(searchRes.data)}`);
222 }
223
224 const signStatus = searchRes.data?.content?.signStatus;
225 if (signStatus === 1) {
226 $.log(`✅ 账号【${index}】今日已签到!`);
227 return;
228 }
229
230 $.log(`⏳ 账号【${index}】正在签到...`);
231 const joinRes = await request(
232 "post",
233 `${WXCLIENT_URL}/mkt/activities/sign:join`,
234 token,
235 {
236 data: { activityId: ACTIVITY_ID, activitySceneId: null },
237 account,
238 onToken: setToken,
239 }
240 );
241
242 if (joinRes.status === 200 && joinRes.data?.code === 200) {
243 const point = joinRes.data.content?.point || joinRes.data.content?.points || 0;
244 $.log(`🎉 账号【${index}】签到成功!${point ? `获得 ${point} 积分` : ""}`);
245 } else {
246 throw new Error(`签到失败: HTTP ${joinRes.status} ${JSON.stringify(joinRes.data)}`);
247 }
248}
249
250// ================== 主函数 ==================
251!(async () => {

Callers 1

aima.jsFile · 0.85

Calls 3

getAccessTokenFunction · 0.85
requestFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected