forked from bing-wang-bing/zaqizaba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
onlyOneExecute.js
50 lines (45 loc) · 1.8 KB
/
onlyOneExecute.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
38
39
40
41
42
43
44
45
46
47
48
49
50
const exec = require("child_process").execSync;
const fs = require("fs");
const axios = require("axios");
const smartReplace = require("./smartReplace");
// 公共变量
const Secrets = {
JD_COOKIE: process.env.JD_COOKIE, //cokie,多个用&隔开即可
SyncUrl: process.env.SYNCURL, //签到地址,方便随时变动
PUSH_KEY: process.env.PUSH_KEY, //server酱推送消息
BARK_PUSH: process.env.BARK_PUSH, //Bark推送
TG_BOT_TOKEN: process.env.TG_BOT_TOKEN, //TGBot推送Token
TG_USER_ID: process.env.TG_USER_ID, //TGBot推送成员ID
MarketCoinToBeanCount: process.env.JDMarketCoinToBeans, //京小超蓝币兑换京豆数量
JoyFeedCount: process.env.JDJoyFeedCount, //宠汪汪喂食数量
FruitShareCodes: process.env.FruitShareCodes, //京东农场分享码
Unsubscribe: process.env.UNSUBSCRIBE, //取关商铺
DDFACTORY_SHARECODES: process.env.DDFACTORY_SHARECODES, //东东工厂互助码
};
async function changeFiele() {
let response = await axios.get(Secrets.SyncUrl);
let content = response.data;
content = await smartReplace.replaceWithSecrets(content, Secrets);
await fs.writeFileSync("./execute.js", content, "utf8");
console.log("替换变量完毕");
}
async function start() {
console.log(`当前执行时间:${new Date().toString()}`);
if (!Secrets.JD_COOKIE) {
console.log("请填写 JD_COOKIE 后在继续");
return;
}
if (!Secrets.SyncUrl) {
console.log("请填写 SYNCURL 后在继续");
return;
}
console.log(`当前共${Secrets.JD_COOKIE.split("&").length}个账号需要签到`);
try {
await changeFiele();
await exec("node execute.js", { stdio: "inherit" });
} catch (e) {
console.log("执行异常:" + e);
}
console.log("执行完毕");
}
start();