| 380 | await getCcTaskList('reportCcTask', body, type); |
| 381 | } |
| 382 | function getCcTaskList(functionId, body, type = '3') { |
| 383 | let url = ''; |
| 384 | return new Promise(resolve => { |
| 385 | if (functionId === 'getCcTaskList') { |
| 386 | url = `https://api.m.jd.com/client.action?functionId=${functionId}&body=${escape(JSON.stringify(body))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1614320848090&sign=d3259c0c19f6c792883485ae65f8991c&sv=111` |
| 387 | } |
| 388 | if (type === '3' && functionId === 'reportCcTask') url = `https://api.m.jd.com/client.action?functionId=${functionId}&body=${escape(JSON.stringify(body))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1622194121039&sign=d565c4594b8e05645f1fe9a495ac7a7d&sv=122` |
| 389 | if (type === '4' && functionId === 'reportCcTask') url = `https://api.m.jd.com/client.action?functionId=${functionId}&body=${escape(JSON.stringify(body))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1622193986049&sign=f5abd9fd7b9b8abaa25b34088f9e8a54&sv=102` |
| 390 | // if (functionId === 'reportCcTask') { |
| 391 | // url = `https://api.m.jd.com/client.action?functionId=${functionId}&body=${escape(JSON.stringify(body))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1614320901023&sign=26e637ba072ddbcfa44c5273ef928696&sv=111` |
| 392 | // } |
| 393 | const options = { |
| 394 | url, |
| 395 | body: `body=${escape(JSON.stringify(body))}`, |
| 396 | headers: { |
| 397 | "Accept": "application/json, text/plain, */*", |
| 398 | "Accept-Encoding": "gzip, deflate, br", |
| 399 | "Accept-Language": "zh-cn", |
| 400 | "Connection": "keep-alive", |
| 401 | "Content-Length": "63", |
| 402 | "Content-Type": "application/x-www-form-urlencoded", |
| 403 | "Host": "api.m.jd.com", |
| 404 | "Origin": "https://h5.m.jd.com", |
| 405 | "Cookie": cookie, |
| 406 | "Referer": "https://h5.m.jd.com/babelDiy/Zeus/4ZK4ZpvoSreRB92RRo8bpJAQNoTq/index.html", |
| 407 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"), |
| 408 | } |
| 409 | } |
| 410 | $.post((options), async (err, resp, data) => { |
| 411 | try { |
| 412 | if (err) { |
| 413 | console.log(`${JSON.stringify(err)}`) |
| 414 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 415 | } else { |
| 416 | if (safeGet(data)) { |
| 417 | if (type === '3' && functionId === 'reportCcTask') console.log(`点击首页领券图标(进入领券中心浏览15s)任务:${data}`) |
| 418 | if (type === '4' && functionId === 'reportCcTask') console.log(`点击“券后9.9”任务:${data}`) |
| 419 | // data = JSON.parse(data); |
| 420 | } |
| 421 | } |
| 422 | } catch (e) { |
| 423 | $.logErr(e, resp) |
| 424 | } finally { |
| 425 | resolve(); |
| 426 | } |
| 427 | }) |
| 428 | }) |
| 429 | } |
| 430 | function taskPostUrl(function_id, body = {}) { |
| 431 | const time = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; |
| 432 | return { |