| 247 | } |
| 248 | |
| 249 | async function helpFriend(inviterPin) { |
| 250 | return new Promise(resolve => { |
| 251 | $.get(taskUrl("inviteHelp", { |
| 252 | "inviterPin": inviterPin, |
| 253 | "taskId": "51", |
| 254 | "pageType": "doHelp", |
| 255 | "headImg": "", |
| 256 | "username": "", |
| 257 | "activityCode": actCode |
| 258 | }), async (err, resp, data) => { |
| 259 | try { |
| 260 | if (err) { |
| 261 | console.log(`${JSON.stringify(err)}`) |
| 262 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 263 | } else { |
| 264 | if (safeGet(data)) { |
| 265 | data = JSON.parse(data); |
| 266 | if (data['code'] === '0') { |
| 267 | console.log(data['result']['message']) |
| 268 | if(data['result']['message']==='您今天的助力次数已达上限,明天再试试吧~') $.canHelp = false |
| 269 | } else { |
| 270 | console.log(JSON.stringify(data)) |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | } catch (e) { |
| 275 | $.logErr(e, resp) |
| 276 | } finally { |
| 277 | resolve(data); |
| 278 | } |
| 279 | }) |
| 280 | }) |
| 281 | } |
| 282 | |
| 283 | async function receiveReward(body) { |
| 284 | return new Promise(resolve => { |