()
| 276 | } |
| 277 | //格式化助力码 |
| 278 | function shareCodesFormat() { |
| 279 | return new Promise(async resolve => { |
| 280 | // console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`) |
| 281 | $.newShareCodes = []; |
| 282 | if ($.shareCodesArr[$.index - 1]) { |
| 283 | $.newShareCodes = $.shareCodesArr[$.index - 1].split('@'); |
| 284 | } else { |
| 285 | console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`) |
| 286 | const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1); |
| 287 | $.newShareCodes = inviteCodes[tempIndex].split('@'); |
| 288 | } |
| 289 | const readShareCodeRes = await readShareCode(); |
| 290 | if (readShareCodeRes && readShareCodeRes.code === 200) { |
| 291 | $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])]; |
| 292 | } |
| 293 | console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify($.newShareCodes)}`) |
| 294 | resolve(); |
| 295 | }) |
| 296 | } |
| 297 | function requireConfig() { |
| 298 | return new Promise(resolve => { |
| 299 | console.log(`开始获取${$.name}配置文件\n`); |
no test coverage detected