(id, body)
| 349 | |
| 350 | // 做任务 |
| 351 | function dotask(id, body) { |
| 352 | return new Promise(resolve => { |
| 353 | $.post(taskPostUrl(`/wxFansInterActionActivity/${id}`, `activityId=${$.actid}&uuid=${$.uuid}${body?body:""}`), async (err, resp, data) => { |
| 354 | try { |
| 355 | if (err) { |
| 356 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 357 | } else { |
| 358 | let info = JSON.parse(data) |
| 359 | if(info&&info.result){ |
| 360 | console.log(` 操作结果:${info.result}`) |
| 361 | if(id =="startDraw"){ |
| 362 | if(info.data.drawOk){console.log(` 抽奖成功,活动 ${info.data.drawInfo.name}`)}else{console.log(JSON.stringify(info))} |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | } catch (e) { |
| 367 | $.logErr(e, resp) |
| 368 | } finally { |
| 369 | resolve(data); |
| 370 | } |
| 371 | }) |
| 372 | }) |
| 373 | } |
| 374 | |
| 375 | |
| 376 | function taskUrl(url, body) { |
no test coverage detected