| 232 | }) |
| 233 | } |
| 234 | function taskList() { |
| 235 | return new Promise(resolve => { |
| 236 | $.get(taskUrl('taskList'), async (err, resp, data) => { |
| 237 | try { |
| 238 | if (err) { |
| 239 | console.log(`${JSON.stringify(err)}`) |
| 240 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 241 | } else { |
| 242 | if (safeGet(data)) { |
| 243 | data = JSON.parse(data); |
| 244 | if (data.retCode === '200') { |
| 245 | for(let vo of data.result.tasks){ |
| 246 | if(vo.times < vo.maxTimes) |
| 247 | for(let bo of vo.subItem){ |
| 248 | if (vo.taskType === '6'){ |
| 249 | const shareCode = bo.itemToken |
| 250 | console.log(`好友助力码:${shareCode}`) |
| 251 | if (shareCode) $.shareCodeList.push(shareCode) |
| 252 | } |
| 253 | else if(vo.taskType!=='9') { |
| 254 | await doTask(bo.itemToken) |
| 255 | } |
| 256 | else{ |
| 257 | await doTask(bo.itemToken,bo.taskToken) |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | } else { |
| 262 | console.log(`抽奖失败`) |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | } catch (e) { |
| 267 | $.logErr(e, resp) |
| 268 | } finally { |
| 269 | resolve(); |
| 270 | } |
| 271 | }) |
| 272 | }) |
| 273 | } |
| 274 | function startGame() { |
| 275 | return new Promise(resolve => { |
| 276 | $.get(taskUrl('startGame'), async (err, resp, data) => { |