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

Method signIn

wxapp/dasenlin.js:277–335  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275 }
276
277 async signIn() {
278 const userSign = this.signInfo?.userSign || {};
279 if (this.isSignedToday(userSign.signDate)) {
280 $.log(`账号[${this.index}] 今日已签到`);
281 return;
282 }
283
284 const mobile = this.userInfo.phone || this.userInfo.mobile;
285 if (!mobile) {
286 $.log(`账号[${this.index}] 签到失败: 未获取到会员手机号`);
287 return;
288 }
289
290 try {
291 await this.request({
292 base: SIGN_BASE,
293 apiPath: "/integralmall/userSign/updateFormId.do",
294 data: {
295 remind: false,
296 },
297 }).catch(() => {});
298
299 const timestamp = Math.round(Date.now() / 1000);
300 const sign = md5(`${mobile}${timestamp}${SIGN_SALT}`);
301 const result = await this.request({
302 base: SIGN_BASE,
303 apiPath: "/integralmall/userSign/sign.do",
304 data: {
305 mobile,
306 timestamp,
307 sign,
308 storeNo: "",
309 },
310 raw: true,
311 });
312
313 if (Number(result.status) === 1 || /今日已签到/.test(getMessage(result))) {
314 $.log(`账号[${this.index}] 今日已签到`);
315 return;
316 }
317 if (!isSuccess(result)) throw new Error(getMessage(result));
318
319 const data = result.data || {};
320 if (data.yearPointFull) {
321 $.log(`账号[${this.index}] 签到成功,本年积分已达上限`);
322 return;
323 }
324 const integral = data.integral ?? result.message ?? "";
325 $.log(`账号[${this.index}] 签到成功${integral !== "" && integral !== "0" ? `: +${integral}积分` : ""}`);
326 } catch (e) {
327 const message = String(e.message || e);
328 if (/今日已签到|已签到/.test(message)) {
329 $.log(`账号[${this.index}] 今日已签到`);
330 return;
331 }
332 $.log(`账号[${this.index}] 签到失败: ${message}`);
333 if (isTokenError(message)) this.removeCachedToken();
334 }

Callers 1

runMethod · 0.95

Calls 8

isSignedTodayMethod · 0.95
requestMethod · 0.95
removeCachedTokenMethod · 0.95
getMessageFunction · 0.85
md5Function · 0.70
isSuccessFunction · 0.70
isTokenErrorFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected