| 225 | }) |
| 226 | } |
| 227 | function extraTaskPrize() { |
| 228 | if($.outFlag != 0) return |
| 229 | return new Promise(async resolve => { |
| 230 | let sign = getSign(`/tzh/combination/extraTaskPrize`,{"activityId": activityId}) |
| 231 | $.post({ |
| 232 | url: `https://combination.m.jd.com/tzh/combination/extraTaskPrize`, |
| 233 | body: `activityId=${activityId}&t=${sign.timestamp}`, |
| 234 | headers: { |
| 235 | 'Accept': 'application/json, text/plain, */*', |
| 236 | "Accept-Language": "zh-cn", |
| 237 | "Connection": "keep-alive", |
| 238 | "Accept-Encoding": "gzip, deflate, br", |
| 239 | "Content-Type": "application/x-www-form-urlencoded", |
| 240 | 'Cookie': cookie, |
| 241 | 'User-Agent': $.UA, |
| 242 | 'sign': sign.sign, |
| 243 | 'timestamp': sign.timestamp |
| 244 | } |
| 245 | }, async (err, resp, data) => { |
| 246 | try { |
| 247 | if (err) { |
| 248 | console.log(`${$.toStr(err)}`) |
| 249 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 250 | } else { |
| 251 | // console.log(data) |
| 252 | let res = $.toObj(data) |
| 253 | if(typeof res == 'object'){ |
| 254 | if(res.code == 200 && res.data){ |
| 255 | let msg = res.data.jdNum && res.data.jdNum+"京豆" || '' |
| 256 | if(res.data.jdNum){ |
| 257 | console.log(`获得 ${msg}`) |
| 258 | $.bean += Number(res.data.jdNum) || 0 |
| 259 | }else{ |
| 260 | console.log(data) |
| 261 | } |
| 262 | }else if(res.msg){ |
| 263 | if(res.msg.indexOf('活动太火爆') > -1){ |
| 264 | $.hotFlag = true |
| 265 | } |
| 266 | console.log(res.msg) |
| 267 | }else{ |
| 268 | console.log(`活动获取失败\n${data}`) |
| 269 | console.log(data) |
| 270 | } |
| 271 | } |
| 272 | } |
| 273 | } catch (e) { |
| 274 | $.logErr(e, resp) |
| 275 | } finally { |
| 276 | resolve(); |
| 277 | } |
| 278 | }) |
| 279 | }) |
| 280 | } |
| 281 | function getData(url) { |
| 282 | return new Promise(async resolve => { |
| 283 | const options = { |