MCPcopy Create free account
hub / github.com/Semporia/Scripts / shareCodesFormat

Function shareCodesFormat

jd_cash.js:429–450  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

427}
428//格式化助力码
429function shareCodesFormat() {
430 return new Promise(async resolve => {
431 // console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
432 $.newShareCodes = [];
433 if ($.shareCodesArr[$.index - 1]) {
434 $.newShareCodes = $.shareCodesArr[$.index - 1].split('@');
435 } else {
436 console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
437 const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
438 $.newShareCodes = inviteCodes[tempIndex].split('@');
439 let authorCode = deepCopy($.authorCode)
440 $.newShareCodes = [...(authorCode.map((item, index) => authorCode[index] = item['inviteCode'])), ...$.newShareCodes];
441 }
442 const readShareCodeRes = await readShareCode();
443 if (readShareCodeRes && readShareCodeRes.code === 200) {
444 $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
445 }
446 $.newShareCodes.map((item, index) => $.newShareCodes[index] = { "inviteCode": item, "shareDate": $.shareDate })
447 console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
448 resolve();
449 })
450}
451
452function requireConfig() {
453 return new Promise(resolve => {

Callers 1

jdCashFunction · 0.70

Calls 3

deepCopyFunction · 0.85
readShareCodeFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected