| 129 | } |
| 130 | |
| 131 | function getUserInfo() { |
| 132 | return new Promise(resolve => { |
| 133 | $.get(taskUrl('query'), async (err, resp, data) => { |
| 134 | try { |
| 135 | if (err) { |
| 136 | console.log(`${err},${jsonParse(resp.body)['message']}`) |
| 137 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 138 | } else { |
| 139 | $.userInfo = JSON.parse(data.match(/query\((.*)\n/)[1]).data |
| 140 | // console.log(`您的好友助力码为${$.userInfo.shareid}`) |
| 141 | console.log(`当前幸运值:${$.userInfo.bless}`) |
| 142 | for (let task of $.info.config.tasks) { |
| 143 | if (!$.userInfo.complete_task_list.includes(task['_id'])) { |
| 144 | console.log(`去做任务${task['_id']}`) |
| 145 | await doTask(task['_id']) |
| 146 | await $.wait(500) |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | } catch (e) { |
| 151 | $.logErr(e, resp) |
| 152 | } finally { |
| 153 | resolve(data); |
| 154 | } |
| 155 | }) |
| 156 | }) |
| 157 | } |
| 158 | |
| 159 | function doTask(taskId) { |
| 160 | let body = `task_bless=10&taskid=${taskId}` |