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

Function viewTask

jd_mcxhd.js:170–207  ·  view source on GitHub ↗
(taskToken)

Source from the content-addressed store, hash-verified

168 })
169}
170function viewTask(taskToken){
171 const body = {
172 "dataSource": "newshortAward",
173 "method": "getTaskAward",
174 "reqParams": JSON.stringify({"taskToken": taskToken}),
175 "sdkVersion": "1.0.0",
176 "clientLanguage": "zh"
177 }
178 return new Promise(resolve => {
179 $.get({
180 url: `https://api.m.jd.com/?client=wh5&clientVersion=1.0.0&functionId=qryViewkitCallbackResult&body=${escape(JSON.stringify(body))}&_timestamp=${+new Date()}`,
181 headers: {
182 'Host': 'api.m.jd.com',
183 'Origin': 'https://h5.m.jd.com',
184 'Accept': '*/*',
185 'User-Agent': 'jdapp;iPhone;10.0.2;14.5.1;appBuild/167688;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
186 'Accept-Language': 'zh-cn',
187 'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/3fHfkJDWEckhqH73tRgUgxmg8U9S/index.html',
188 Cookie: cookie
189 }
190 }, async (err, resp, data) => {
191 try {
192 if (err) {
193 console.log(`${JSON.stringify(err)}`)
194 console.log(`${$.name} API请求失败,请检查网路重试`)
195 } else {
196 if (safeGet(data)) {
197 data = JSON.parse(data)
198 }
199 }
200 } catch (e) {
201 $.logErr(e, resp)
202 } finally {
203 resolve();
204 }
205 })
206 })
207}
208function checkTask(itemToken) {
209 let body = {"itemToken":itemToken}
210 return new Promise(resolve => {

Callers 1

doTaskFunction · 0.70

Calls 4

safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected