forked from faintout/myself-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaixiang.js
135 lines (130 loc) · 4.16 KB
/
baixiang.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// cron: 40 7,18 * * *
// 抓header中Authorization 多账号换行
const {
getCurrDay,checkTime,Env,random
} = require('./utils.js')
const {sendNotify} = require('./sendNotify.js')
const $ = new Env("白象签到");
const axios = require('axios')
let index = 0
const userInfoList = $.getEnvKey('baixiang').split('\n')
if(!userInfoList.length||userInfoList[0]===''){
// throw new Error('未找到ck')
}
console.log(`获取到${userInfoList.length}个ck`);
const headers = {
"Host": "dy.baixiangfood.com",
"Connection": "keep-alive",
// "Content-Length": "16",
"xweb_xhr": "1",
"Authorization": "x",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c11)XWEB/11275",
"Content-Type": "application/json",
"Accept": "*/*",
"Sec-Fetch-Site": "cross-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "https://servicewechat.com/wxeaf5d66c48160b2d/18/page-frame.html",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9"
}
const api = {
sign: ({token,userId}) => {
return axios({
url: 'https://dy.baixiangfood.com/api/app/signLog/sign',
method: 'post',
headers:{
...headers,
"Authorization": token,
},
data:{userId}
})
},
getSignStatus: ({token,userId}) => {
return axios({
url:'https://dy.baixiangfood.com/api/app/signLog/getSignStatus ',
method: 'post',
headers:{
...headers,
"Authorization": token,
},
data:{userId}
})
},
getSignList: ({token,userId}) => {
return axios({
url: 'https://dy.baixiangfood.com/api/app/signLog/getSignlist ',
method: 'post',
headers:{
...headers,
"Authorization": token,
},
data:{userId}
})
},
getUserInfo: (token) => {
return axios({
url: 'https://dy.baixiangfood.com/api/app/user/getUserInfo ',
method: 'get',
headers:{
...headers,
"Authorization": token,
},
})
}
}
const getUserInfo = async (params) => {
const {data:{data:{id,phone,integral}}} = await api.getUserInfo(params)
if(!id){
$.log(`账号【${index}】登录失效`)
$.log('')
return null
}
$.log(`账号【${index}】 当前用户:【${phone}】`);
$.log(`账号【${index}】 当前积分:【${integral}】`);
return id
}
const getSignStatus = async (params) => {
const {data:{data:{signStatus},count}} = await api.getSignStatus(params)
!signStatus&&$.log(`账号【${index}】 今日已签到`);
$.log(`账号【${index}】 已连续签到:【${count}】天`);
return signStatus
}
const userSign = async (params) => {
const {data:{msg,count,code}} = await api.sign(params)
if(code===200){
$.log(`账号【${index}】 签到信息:${msg}!,获得${count}积分`);
}else{
$.log(`账号【${index}】 签到信息:${msg}`);
}
}
const processTokens = async () => {
const randomTime = random(1, 300)
console.log('随机延迟:',randomTime + '秒');
await $.wait(randomTime*1000)
for (const token of userInfoList) {
try {
$.log('')
index++
const id = await getUserInfo(token)
await $.wait(3500)
if(!id){
continue;
}
//检查签到状态
const signStatus = await getSignStatus({token,userId:id})
await $.wait(3500)
if(signStatus){
//签到
await userSign({token,userId:id})
}
await $.wait(3500)
} catch (error) {
$.logErr(error.toString());
}
}
$.log('')
await sendNotify('白象签到', $.logs.join('<br>'))
$.done()
};
processTokens()