MCPcopy Create free account
hub / github.com/Semporia/Scripts / doDailyTask

Function doDailyTask

jd_superMarket.js:151–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149}
150
151async function doDailyTask() {
152 const smtgQueryShopTaskRes = await smtgQueryShopTask();
153 if (smtgQueryShopTaskRes.code === 0 && smtgQueryShopTaskRes.data.success) {
154 const taskList = smtgQueryShopTaskRes.data.result.taskList;
155 console.log(`\n日常赚钱任务 完成状态`)
156 for (let item of taskList) {
157 console.log(` ${item['title'].length < 4 ? item['title'] + `\xa0` : item['title'].slice(-4)} ${item['finishNum'] === item['targetNum'] ? '已完成' : '未完成'} ${item['finishNum']}/${item['targetNum']}`)
158 }
159 for (let item of taskList) {
160 //领奖
161 if (item.taskStatus === 1 && item.prizeStatus === 1) {
162 const res = await smtgObtainShopTaskPrize(item.taskId);
163 console.log(`\n领取做完任务的奖励${JSON.stringify(res)}\n`)
164 }
165 //做任务
166 if ((item.type === 1 || item.type === 11) && item.taskStatus === 0) {
167 // 分享任务
168 const res = await smtgDoShopTask(item.taskId);
169 console.log(`${item.subTitle}结果${JSON.stringify(res)}`)
170 }
171 if (item.type === 2) {
172 //逛会场
173 if (item.taskStatus === 0) {
174 console.log('开始逛会场')
175 const itemId = item.content[item.type].itemId;
176 const res = await smtgDoShopTask(item.taskId, itemId);
177 console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
178 }
179 }
180 if (item.type === 8) {
181 //关注店铺
182 if (item.taskStatus === 0) {
183 console.log('开始关注店铺')
184 const itemId = item.content[item.type].itemId;
185 const res = await smtgDoShopTask(item.taskId, itemId);
186 console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
187 }
188 }
189 if (item.type === 9) {
190 //开卡领蓝币任务
191 if (item.taskStatus === 0) {
192 console.log('开始开卡领蓝币任务')
193 const itemId = item.content[item.type].itemId;
194 const res = await smtgDoShopTask(item.taskId, itemId);
195 console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
196 }
197 }
198 if (item.type === 10) {
199 //关注商品领蓝币
200 if (item.taskStatus === 0) {
201 console.log('关注商品')
202 const itemId = item.content[item.type].itemId;
203 const res = await smtgDoShopTask(item.taskId, itemId);
204 console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
205 }
206 }
207 if ((item.type === 8 || item.type === 2 || item.type === 10) && item.taskStatus === 0) {
208 // await doDailyTask();

Callers 1

jdSuperMarketFunction · 0.70

Calls 4

smtgQueryShopTaskFunction · 0.85
smtgObtainShopTaskPrizeFunction · 0.85
smtgDoShopTaskFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected