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

Function shareCodesFormat

jd_sgmh.js:299–318  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

297
298//格式化助力码
299function shareCodesFormat() {
300 return new Promise(async resolve => {
301 // console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
302 $.newShareCodes = [];
303 if ($.shareCodesArr[$.index - 1]) {
304 $.newShareCodes = $.shareCodesArr[$.index - 1].split('@');
305 } else {
306 console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
307 const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
308 $.newShareCodes = inviteCodes[tempIndex].split('@');
309 }
310 const readShareCodeRes = await readShareCode();
311 // console.log(readShareCodeRes)
312 if (readShareCodeRes && readShareCodeRes.code === 200) {
313 $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
314 }
315 console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
316 resolve();
317 })
318}
319
320function readShareCode() {
321 console.log(`开始`)

Callers 1

jd_sgmh.jsFile · 0.70

Calls 2

readShareCodeFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected