Skip to content

Commit 5333fb8

Browse files
committed
更新[WPS]: 增加小程序签到
1 parent 30c6cb5 commit 5333fb8

7 files changed

Lines changed: 88 additions & 13 deletions

‎QuantumultX_AppStore_Local_Cookie.conf‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,5 @@ https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url sc
130130
^https:\/\/m-bean\.kaola\.com/m/point/sign\.html url script-request-body chavyleung/wykl/wykl.cookie.js
131131

132132
# WPS
133-
^https:\/\/zt.wps.cn\/2018\/docer_check_in\/api\/act_list url script-request-header chavyleung/wps/wps.cookie.js
133+
^https:\/\/zt.wps.cn\/2018\/docer_check_in\/api\/act_list url script-request-header chavyleung/wps/wps.cookie.js
134+
^https:\/\/zt.wps.cn\/2018\/clock_in\/api\/sign_up url script-request-header chavyleung/wps/wps.cookie.js

‎QuantumultX_Local_Cookie.conf‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,5 @@ https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url sc
126126
^https:\/\/m-bean\.kaola\.com/m/point/sign\.html url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/wykl/wykl.cookie.js
127127

128128
# WPS
129-
^https:\/\/zt.wps.cn\/2018\/docer_check_in\/api\/act_list url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.cookie.js
129+
^https:\/\/zt.wps.cn\/2018\/docer_check_in\/api\/act_list url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.cookie.js
130+
^https:\/\/zt.wps.cn\/2018\/clock_in\/api\/sign_up url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.cookie.js

‎QuantumultX_Local_Task.conf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@
8080
#网易考拉
8181
1 0 * * * chavyleung/wykl/wykl.js
8282
# WPS
83-
8 0 * * * chavyleung/wps/wps.js
83+
1 6 * * * chavyleung/wps/wps.js

‎QuantumultX_Remote_Task.conf‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,5 @@
162162

163163
# WPS
164164
# 打开 APP 我 > 签到 (右上角, 不用手动签到)
165-
8 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.js
165+
# 打开 `我的WPS会员` 小程序 (手动签到)
166+
1 6 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.js

‎wps/README.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可
44
5+
> 2020.3.15 增加小程序签到
6+
57
## 配置 (Surge)
68

79
```properties
@@ -10,6 +12,7 @@ hostname = zt.wps.cn
1012

1113
[Script]
1214
http-request ^https:\/\/zt.wps.cn\/2018\/docer_check_in\/api\/act_list script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.cookie.js
15+
http-request ^https:\/\/zt.wps.cn\/2018\/clock_in\/api\/sign_up script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.cookie.js
1316
cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.js
1417
```
1518

@@ -21,6 +24,7 @@ hostname = 110.43.90.61, zt.wps.cn
2124

2225
[rewrite_local]
2326
^https:\/\/zt.wps.cn\/2018\/docer_check_in\/api\/act_list url script-request-header wps.cookie.js
27+
^https:\/\/zt.wps.cn\/2018\/clock_in\/api\/sign_up url script-request-header wps.cookie.js
2428

2529
[task_local]
2630
1 0 * * * wps.js
@@ -34,9 +38,10 @@ hostname = 110.43.90.61, zt.wps.cn
3438
2. 再配置重写规则:
3539
- Surge: 把两条远程脚本放到`[Script]`
3640
- QuanX: 把`wps.cookie.js`和`wps.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关)
37-
3. 打开 APP , 进入签到页面, 系统提示: `获取Cookie: 成功` (不用手动签到)
38-
4. 最后就可以把两条获取 Cookie 的脚本注释掉了
39-
5. 运行一次脚本, 如果提示重复签到, 那就算成功了!
41+
3. 打开 APP , 进入签到页面, 系统提示: `获取Cookie: 成功 (APP)` (不用手动签到)
42+
4. 打开 `我的WPS会员` 小程序 , 进入签到页面并手动签到, 系统提示: `获取Cookie: 成功 (小程序)` (手动签到)
43+
5. 最后就可以把两条获取 Cookie 的脚本注释掉了
44+
6. 运行一次脚本, 如果提示重复签到, 那就算成功了!
4045

4146
> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
4247

‎wps/wps.cookie.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@ const chavy = init()
22
const cookieName = 'WPS'
33
const KEY_signhomeurl = 'chavy_signhomeurl_wps'
44
const KEY_signhomeheader = 'chavy_signhomeheader_wps'
5+
const KEY_signwxurl = 'chavy_signwxurl_wps'
6+
const KEY_signwxheader = 'chavy_signwxheader_wps'
57

6-
if ($request && $request.method != 'OPTIONS') {
8+
if ($request && $request.method != 'OPTIONS' && $request.url.match(/act_list/)) {
79
const VAL_signhomeurl = $request.url
810
const VAL_signhomeheader = JSON.stringify($request.headers)
911
if (VAL_signhomeurl) chavy.setdata(VAL_signhomeurl, KEY_signhomeurl)
1012
if (VAL_signhomeheader) chavy.setdata(VAL_signhomeheader, KEY_signhomeheader)
11-
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
13+
chavy.msg(cookieName, `获取Cookie: 成功 (APP)`, ``)
14+
} else if ($request && $request.method != 'OPTIONS' && $request.url.match(/sign_up/)) {
15+
const VAL_signwxurl = $request.url
16+
const VAL_signwxheader = JSON.stringify($request.headers)
17+
if (VAL_signwxurl) chavy.setdata(VAL_signwxurl, KEY_signwxurl)
18+
if (VAL_signwxheader) chavy.setdata(VAL_signwxheader, KEY_signwxheader)
19+
chavy.msg(cookieName, `获取Cookie: 成功 (小程序)`, ``)
1220
}
1321

1422
function init() {

‎wps/wps.js‎

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@ const chavy = init()
22
const cookieName = 'WPS'
33
const KEY_signhomeurl = 'chavy_signhomeurl_wps'
44
const KEY_signhomeheader = 'chavy_signhomeheader_wps'
5+
const KEY_signwxurl = 'chavy_signwxurl_wps'
6+
const KEY_signwxheader = 'chavy_signwxheader_wps'
57

68
const signinfo = {}
79
let VAL_signhomeurl = chavy.getdata(KEY_signhomeurl)
810
let VAL_signhomeheader = chavy.getdata(KEY_signhomeheader)
11+
let VAL_signwxurl = chavy.getdata(KEY_signwxurl)
12+
let VAL_signwxheader = chavy.getdata(KEY_signwxheader)
913

1014
;(sign = async () => {
1115
chavy.log(`🔔 ${cookieName}`)
1216
await gethome()
1317
await signapp()
1418
await getinfo()
19+
if (VAL_signwxurl) {
20+
await getwxinfo()
21+
if (signinfo.is_sign_up == 0) {
22+
await signwxapp()
23+
await getwxinfo()
24+
}
25+
}
1526
await getreward()
1627
showmsg()
1728
})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`))
@@ -21,7 +32,6 @@ function gethome() {
2132
const url = { url: VAL_signhomeurl, headers: JSON.parse(VAL_signhomeheader) }
2233
chavy.get(url, (error, response, data) => {
2334
try {
24-
chavy.log(`❕ ${cookieName} gethome - response: ${JSON.stringify(response)}`)
2535
signinfo.homeinfo = JSON.parse(data)
2636
resolve()
2737
} catch (e) {
@@ -61,6 +71,23 @@ function signapp() {
6171
})
6272
}
6373

74+
function signwxapp() {
75+
return new Promise((resolve, reject) => {
76+
const url = { url: VAL_signwxurl, headers: JSON.parse(VAL_signwxheader) }
77+
chavy.get(url, (error, response, data) => {
78+
try {
79+
signinfo.signwxapp = JSON.parse(data)
80+
resolve()
81+
} catch (e) {
82+
chavy.msg(cookieName, `小程序签到结果: 失败`, `说明: ${e}`)
83+
chavy.log(`❌ ${cookieName} signwxapp - 小程序签到失败: ${e}`)
84+
chavy.log(`❌ ${cookieName} signwxapp - response: ${JSON.stringify(response)}`)
85+
resolve()
86+
}
87+
})
88+
})
89+
}
90+
6491
function getinfo() {
6592
return new Promise((resolve, reject) => {
6693
const VAL_getinfourl = `https://zt.wps.cn/2018/docer_check_in/api/checkin_record`
@@ -87,6 +114,27 @@ function getinfo() {
87114
})
88115
}
89116

117+
function getwxinfo() {
118+
return new Promise((resolve, reject) => {
119+
const VAL_getwxinfourl = `https://zt.wps.cn/2018/clock_in/api/get_data?member=wps`
120+
const url = { url: VAL_getwxinfourl, headers: JSON.parse(VAL_signwxheader) }
121+
122+
chavy.get(url, (error, response, data) => {
123+
try {
124+
const wxinfo = JSON.parse(data)
125+
if (!signinfo.wxinfo) signinfo.is_sign_up = wxinfo.is_sign_up
126+
signinfo.wxinfo = wxinfo
127+
resolve()
128+
} catch (e) {
129+
chavy.msg(cookieName, `获取小程序结果: 失败`, `说明: ${e}`)
130+
chavy.log(`❌ ${cookieName} getwxinfo - 获取小程序结果失败: ${e}`)
131+
chavy.log(`❌ ${cookieName} getwxinfo - response: ${JSON.stringify(response)}`)
132+
resolve()
133+
}
134+
})
135+
})
136+
}
137+
90138
function getreward() {
91139
return new Promise((resolve, reject) => {
92140
const VAL_getrewardurl = `https://zt.wps.cn/2018/docer_check_in/api/reward_record`
@@ -117,18 +165,29 @@ function showmsg() {
117165
let subTitle = ''
118166
let detail = ''
119167
if (signinfo.signapp && signinfo.signapp.result == 'ok') {
120-
subTitle = `签到结果: 成功`
168+
subTitle = `日常签到: 成功`
121169
// detail = `获得金币${result.data.coin}, 金豆${result.data.flow}`
122170
} else if (signinfo.signapp && signinfo.signapp.result == 'error' && signinfo.signapp.msg == 'recheckin') {
123-
subTitle = `签到结果: 重复`
171+
subTitle = `日常签到: 重复`
124172
// detail = `说明: ${result.data.msg}`
125173
} else {
126-
subTitle = `签到结果: 失败`
174+
subTitle = `日常签到: 失败`
127175
detail = `详见日志`
128176
chavy.log(`❌ ${cookieName} showmsg - homeinfo: ${JSON.stringify(signinfo.homeinfo)}`)
129177
chavy.log(`❌ ${cookieName} showmsg - signapp: ${JSON.stringify(signinfo.signapp)}`)
130178
}
131179

180+
if (signinfo.wxinfo) {
181+
subTitle += subTitle == '' ? '' : '; '
182+
if (signinfo.is_sign_up == 0 && signinfo.signwxapp && signinfo.signwxapp.result == 'ok') subTitle += `小程序: 成功`
183+
else if (signinfo.is_sign_up == 1) subTitle += `小程序: 重复`
184+
else {
185+
subTitle += `小程序: 失败`
186+
chavy.log(`❌ ${cookieName} showmsg - wxinfo: ${JSON.stringify(signinfo.wxinfo)}`)
187+
chavy.log(`❌ ${cookieName} showmsg - signwxapp: ${JSON.stringify(signinfo.signwxapp)}`)
188+
}
189+
}
190+
132191
if (signinfo.homeinfo && signinfo.signapp && signinfo.info && signinfo.homeinfo.data[0]) {
133192
const cur = signinfo.homeinfo.data[0]
134193
detail += `连签: ${signinfo.info.data.max_days}天, 本期: ${cur.end_date} (第${cur.id}期)`

0 commit comments

Comments
 (0)