()
| 228 | |
| 229 | // ---------- 任务相关方法 ---------- |
| 230 | async getTaskList() { |
| 231 | try { |
| 232 | let param = {} |
| 233 | let url = `https://yingsheng.elecfans.com/ysapi/wapi/activity/task/dailyList` |
| 234 | let headersParams = this.calculateSign(param, 'yingsheng') |
| 235 | let options = { |
| 236 | method: 'get', |
| 237 | url, |
| 238 | headers: { |
| 239 | ...headersParams, |
| 240 | "User-Agent": defaultUserAgent, |
| 241 | }, |
| 242 | } |
| 243 | let { data: result } = await axios.request(options) |
| 244 | if (result.code == 0) { |
| 245 | await $.wait(this.TASK_WAIT_TIME); |
| 246 | await this.recommendList(); // 获取推荐用户列表用于关注任务 |
| 247 | for (let key in result.data) { |
| 248 | let task = result.data[key] |
| 249 | if (task.title.includes('发布作品') || task.title.includes('作品播放量')) continue; |
| 250 | if (task.title.indexOf('观看作品') > -1) { |
| 251 | for (let idx in task.step) { |
| 252 | if (task.step[idx].com_status == 12) { |
| 253 | await $.wait(this.TASK_WAIT_TIME); |
| 254 | await this.receiveCoin(task); |
| 255 | break; |
| 256 | } else if (task.step[idx].com_status != 13) { |
| 257 | await $.wait(this.TASK_WAIT_TIME); |
| 258 | await this.viewVideoAdd(idx); |
| 259 | await $.wait(this.TASK_WAIT_TIME); |
| 260 | await this.receiveCoin(task); |
| 261 | break; |
| 262 | } |
| 263 | } |
| 264 | } else { |
| 265 | for (let idx in task.step) { |
| 266 | let step = task.step[idx] |
| 267 | if (step.com_status == 10) { |
| 268 | await $.wait(this.TASK_WAIT_TIME); |
| 269 | await this.taskReceive(task); |
| 270 | } |
| 271 | if (step.com_status == 12) { |
| 272 | await $.wait(this.TASK_WAIT_TIME); |
| 273 | await this.receiveCoin(task); |
| 274 | } else if (step.com_status != 13) { |
| 275 | let num = step.condition < 25 ? (step.condition - step.finish_progress) : 1 |
| 276 | let getReward = true; |
| 277 | for (let i = 0; i < num; i++) { |
| 278 | if (task.title.indexOf('点赞') > -1) { |
| 279 | let rndIdx = Math.floor(Math.random() * 2000) + 8000 |
| 280 | await $.wait(this.TASK_WAIT_TIME); |
| 281 | await this.thumbsup(rndIdx); |
| 282 | await $.wait(this.TASK_WAIT_TIME); |
| 283 | await this.thumbsup(rndIdx); |
| 284 | } else if (task.title.indexOf('观看直播') > -1) { |
| 285 | await $.wait(this.TASK_WAIT_TIME); |
| 286 | await this.finishLive(); |
| 287 | } else if (task.title.indexOf('关注') > -1) { |
no test coverage detected