forked from jinleki/jd_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jdPetShareCodes.js
37 lines (35 loc) · 1.91 KB
/
jdPetShareCodes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
东东萌宠互助码
此文件为Node.js专用。其他用户请忽略
支持京东N个账号
*/
//云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
let PetShareCodes = [
'MTAxODc2NTEzNTAwMDAwMDAwMjg3MDg2MA==@MTAxODc2NTEzMzAwMDAwMDAyNzUwMDA4MQ==@MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODc2NTEzNDAwMDAwMDAzMDI2MDI4MQ==',//账号一的好友shareCode,不同好友中间用@符号隔开
'MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODcxOTI2NTAwMDAwMDAyNjA4ODQyMQ==@MTAxODc2NTEzOTAwMDAwMDAyNzE2MDY2NQ==',//账号二的好友shareCode,不同好友中间用@符号隔开
]
// 从日志获取互助码
// const logShareCodes = require('./utils/jdShareCodes');
// if (logShareCodes.PETSHARECODES.length > 0 && !process.env.PETSHARECODES) {
// process.env.PETSHARECODES = logShareCodes.PETSHARECODES.join('&');
// }
// 判断github action里面是否有东东萌宠互助码
if (process.env.PETSHARECODES) {
if (process.env.PETSHARECODES.indexOf('&') > -1) {
console.log(`您的东东萌宠互助码选择的是用&隔开\n`)
PetShareCodes = process.env.PETSHARECODES.split('&');
} else if (process.env.PETSHARECODES.indexOf('\n') > -1) {
console.log(`您的东东萌宠互助码选择的是用换行隔开\n`)
PetShareCodes = process.env.PETSHARECODES.split('\n');
} else {
PetShareCodes = process.env.PETSHARECODES.split();
}
} else {
console.log(`由于您环境变量(PETSHARECODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
}
for (let i = 0; i < PetShareCodes.length; i++) {
const index = (i + 1 === 1) ? '' : (i + 1);
exports['PetShareCode' + index] = PetShareCodes[i];
}