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

Function awardTask

jd_live.js:189–216  ·  view source on GitHub ↗
(type="shareTask")

Source from the content-addressed store, hash-verified

187}
188
189function awardTask(type="shareTask") {
190 let body = `functionId=getChannelTaskRewardToM&appid=h5-live&body=%7B%22type%22%3A%22${type}%22%2C%22liveId%22%3A%222942545%22%7D&v=${getTs()}`
191 return new Promise(resolve => {
192 $.post(taskPostUrl(null, body,"https://api.m.jd.com/api"), async (err, resp, data) => {
193 try {
194 if (err) {
195 console.log(`${JSON.stringify(err)}`)
196 console.log(`${$.name} API请求失败,请检查网路重试`)
197 } else {
198 if (safeGet(data)) {
199 data = JSON.parse(data);
200 if (data.subCode === "0") {
201 $.bean += data.sum
202 console.log(`任务领奖成功,获得 ${data.sum} 京豆`);
203 message += `任务领奖成功,获得 ${data.sum} 京豆\n`
204 } else {
205 console.log(`任务领奖失败,${data.msg}`)
206 }
207 }
208 }
209 } catch (e) {
210 $.logErr(e, resp)
211 } finally {
212 resolve(data);
213 }
214 })
215 })
216}
217function sign() {
218 return new Promise(resolve => {
219 $.get(taskUrl("getChannelTaskRewardToM", {"type":"signTask","itemId":"1"}), async (err, resp, data) => {

Callers 1

getTaskListFunction · 0.70

Calls 6

getTsFunction · 0.70
taskPostUrlFunction · 0.70
safeGetFunction · 0.70
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected