| 214 | } |
| 215 | } |
| 216 | function goldCreatorDoTask(body) { |
| 217 | return new Promise(resolve => { |
| 218 | const options = taskUrl('goldCreatorDoTask', body) |
| 219 | $.get(options, async (err, resp, data) => { |
| 220 | try { |
| 221 | if (err) { |
| 222 | console.log(`${JSON.stringify(err)}`) |
| 223 | console.log(`${$.name} goldCreatorDetail API请求失败,请检查网路重试`) |
| 224 | } else { |
| 225 | if (safeGet(data)) { |
| 226 | data = JSON.parse(data) |
| 227 | if (data.code === '0') { |
| 228 | if (data.result.taskCode === '0') { |
| 229 | console.log(`成功,获得 ${data.result.lotteryScore}京豆\n`); |
| 230 | if (data.result.lotteryScore) $.beans += parseInt(data.result.lotteryScore); |
| 231 | } else { |
| 232 | console.log(`失败:${data.result['taskMsg']}\n`); |
| 233 | } |
| 234 | } else { |
| 235 | console.log(`失败:${JSON.stringify(data)}\n`); |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | } catch (e) { |
| 240 | $.logErr(e, resp) |
| 241 | } finally { |
| 242 | resolve(); |
| 243 | } |
| 244 | }) |
| 245 | }) |
| 246 | } |
| 247 | function taskUrl(function_id, body = {}) { |
| 248 | return { |
| 249 | url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=content_ecology&clientVersion=10.0.0&client=wh5&eufv=false&uuid=`, |