MCPcopy Create free account
hub / github.com/Toulu-debug/enen / main

Method main

jd_miniTask.ts:40–89  ·  view source on GitHub ↗
(user: User)

Source from the content-addressed store, hash-verified

38 }
39
40 async main(user: User) {
41 try {
42 this.user = user
43 this.user.UserAgent = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/6.8.0(0x16080000) NetType/WIFI MiniProgramEnv/Mac MacWechat/WMPF XWEB/30817`
44 this.h5stTool = new H5ST('60d61', this.fp, this.user.UserAgent, this.user.UserName, 'https://servicewechat.com/wx91d27dbf599dff74/728/page-frame.html', 'https://servicewechat.com')
45 await this.h5stTool.genAlgo()
46
47 let data: any, res: any
48 res = await this.api('MiniTask_ChannelPage', {"source": "task"})
49 this.o2s(res)
50 let shareCode: string[] = await this.getshareCodeHW('miniTask')
51 for (let t of res.data.signInfo.signTaskList) {
52 if (t.currentDay && t.signStatus === 0) {
53 if (this.user.index === 0) {
54 data = await this.api('miniTask_assistCheck', {"itemId": shareCode[0]})
55 } else {
56 data = await this.api('miniTask_doSign', {"itemId": "1"})
57 }
58 if (res.subCode === 0) {
59 console.log('签到成功', res.data.toastMsg, '连续签到:', res.data.signDays)
60 } else {
61 console.log(res.message)
62 }
63 }
64 }
65
66 for (let t of res.data.scanTaskList) {
67 if (t.status === 0) {
68 console.log(t.title)
69 data = await this.api('MiniTask_ScanTask', {"actionType": 1, "scanAssignmentId": t.scanAssignmentId, "itemId": t.itemId})
70 if (data.subCode === 0) {
71 console.log('开始任务')
72 await this.wait((t.times + 1) * 1000)
73 data = await this.api('MiniTask_ScanTask', {"actionType": 0, "scanAssignmentId": t.scanAssignmentId, "itemId": t.itemId})
74 if (data.subCode === 0) {
75 console.log('任务完成')
76 await this.wait(1000)
77 data = await this.api('MiniTask_ScanReward', {"scanAssignmentId": t.scanAssignmentId})
78 console.log(data)
79 console.log('领取奖励', data.data[0].discount)
80 }
81 }
82 }
83 }
84
85 } catch (e) {
86 console.log(e.message)
87 await this.wait(5000)
88 }
89 }
90}
91
92new Jd_Hbrain().init().then()

Callers

nothing calls this directly

Calls 3

apiMethod · 0.95
logMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected