Skip to content

Commit 993d86e

Browse files
committed
更新[中国联通]: 修改报错问题
1 parent 987d8c5 commit 993d86e

3 files changed

Lines changed: 21 additions & 53 deletions

File tree

‎10010/10010.cookie.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ if ($request && $request.method != 'OPTIONS' && $request.url.indexOf('querySigni
1414
const tokenheaderVal = JSON.stringify($request.headers)
1515
if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey)
1616
if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey)
17-
title = chavy.msg(cookieName, `获取刷新链接: 成功`, ``)
18-
} else if ($request && $request.method != 'OPTIONS' && $request.url.indexOf('daySign.do') >= 0) {
17+
chavy.msg(cookieName, `获取刷新链接: 成功`, ``)
18+
} else if ($request && $request.method != 'OPTIONS' && $request.url.endsWith('daySign') >= 0) {
1919
const signurlVal = $request.url
2020
const signheaderVal = JSON.stringify($request.headers)
2121
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
2222
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
23-
title = chavy.msg(cookieName, `获取Cookie: 成功 (每日签到)`, ``)
23+
chavy.msg(cookieName, `获取Cookie: 成功 (每日签到)`, ``)
2424
} else if ($request && $request.method != 'OPTIONS' && $request.url.indexOf('userLogin') >= 0) {
2525
const loginlotteryurlVal = $request.url
2626
const loginlotteryheaderVal = JSON.stringify($request.headers)
2727
if (loginlotteryurlVal) chavy.setdata(loginlotteryurlVal, loginlotteryurlKey)
2828
if (loginlotteryheaderVal) chavy.setdata(loginlotteryheaderVal, loginlotteryheaderKey)
29-
title = chavy.msg(cookieName, `获取Cookie: 成功 (登录抽奖)`, ``)
29+
chavy.msg(cookieName, `获取Cookie: 成功 (登录抽奖)`, ``)
3030
} else if ($request && $request.method != 'OPTIONS' && $request.url.indexOf('findActivityInfo') >= 0) {
3131
const findlotteryurlVal = $request.url
3232
const findlotteryheaderVal = JSON.stringify($request.headers)
3333
if (findlotteryurlVal) chavy.setdata(findlotteryurlVal, findlotteryurlKey)
3434
if (findlotteryheaderVal) chavy.setdata(findlotteryheaderVal, findlotteryheaderKey)
35-
title = chavy.msg(cookieName, `获取Cookie: 成功 (抽奖次数)`, ``)
35+
chavy.msg(cookieName, `获取Cookie: 成功 (抽奖次数)`, ``)
3636
}
3737

3838
function init() {

‎10010/10010.js‎

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ function loginapp() {
4242
const url = { url: VAL_loginurl, headers: JSON.parse(VAL_loginheader) }
4343
chavy.post(url, (error, response, data) => {
4444
try {
45-
updateSignAppCookies(response.headers['Set-Cookie'])
4645
resolve()
4746
} catch (e) {
4847
chavy.msg(cookieName, `登录结果: 失败`, `说明: ${e}`)
@@ -54,35 +53,10 @@ function loginapp() {
5453
})
5554
}
5655

57-
function updateSignAppCookies(respcookie) {
58-
if (VAL_signheader) {
59-
const OBJ_signheader = JSON.parse(VAL_signheader)
60-
let signcookie = OBJ_signheader['Cookie']
61-
signcookie = signcookie.replace(/route5=([^;]*)/, respcookie.match(/route5=([^;]*)/)[0])
62-
signcookie = signcookie.replace(/JSESSIONID=([^;]*)/, respcookie.match(/JSESSIONID=([^;]*)/)[0])
63-
OBJ_signheader['Cookie'] = signcookie
64-
VAL_signheader = JSON.stringify(OBJ_signheader)
65-
} else {
66-
chavy.log(`⚠ ${cookieName} updateSignAppCookies: 请先获取 Cookies`)
67-
}
68-
}
69-
70-
function updateLotteryAppCookies(respcookie) {
71-
if (VAL_lotteryheader) {
72-
const OBJ_lotteryheader = JSON.parse(VAL_lotteryheader)
73-
let lotterycookie = OBJ_lotteryheader['Cookie']
74-
lotterycookie = lotterycookie.replace(/route5=([^;]*)/, respcookie.match(/route5=([^;]*)/)[0])
75-
lotterycookie = lotterycookie.replace(/JSESSIONID=([^;]*)/, respcookie.match(/JSESSIONID=([^;]*)/)[0])
76-
OBJ_lotteryheader['Cookie'] = lotterycookie
77-
VAL_lotteryheader = JSON.stringify(OBJ_lotteryheader)
78-
} else {
79-
chavy.log(`⚠ ${cookieName} updatelotteryAppCookies: 请先获取 Cookies`)
80-
}
81-
}
82-
8356
function signapp() {
8457
return new Promise((resolve, reject) => {
85-
const url = { url: VAL_signurl, body: '{}', headers: JSON.parse(VAL_signheader) }
58+
if (VAL_signurl.endsWith('.do')) VAL_signurl = VAL_signurl.replace('.do', '')
59+
const url = { url: 'https://act.10010.com/SigninApp/signin/daySign', headers: JSON.parse(VAL_signheader) }
8660
chavy.post(url, (error, response, data) => {
8761
try {
8862
signinfo.signapp = JSON.parse(data)
@@ -105,7 +79,6 @@ function loginlottery() {
10579
const encryptmobileMatch = data.match(/encryptmobile=([^('|")]*)/)
10680
if (encryptmobileMatch) {
10781
signinfo.encryptmobile = encryptmobileMatch[1]
108-
chavy.log(`❌ ${cookieName} loginlottery - encryptmobile: ${signinfo.encryptmobile}`)
10982
} else {
11083
chavy.msg(cookieName, `获取抽奖令牌: 失败`, `说明: ${e}`)
11184
chavy.log(`❌ ${cookieName} loginlottery - 获取抽奖令牌失败: ${e}`)
@@ -124,14 +97,11 @@ function loginlottery() {
12497

12598
function findlottery() {
12699
return new Promise((resolve, reject) => {
127-
chavy.log(`❌ ${cookieName} findlottery - OLD - VAL_findlotteryurl: ${VAL_findlotteryurl}}`)
128100
VAL_findlotteryurl = VAL_findlotteryurl.replace(/encryptmobile=[^(&|$)]*/, `encryptmobile=${signinfo.encryptmobile}`)
129101
VAL_findlotteryurl = VAL_findlotteryurl.replace(/mobile=[^(&|$)]*/, `mobile=${signinfo.encryptmobile}`)
130-
chavy.log(`❌ ${cookieName} findlottery - NEW - VAL_findlotteryurl: ${VAL_findlotteryurl}}`)
131102
const url = { url: VAL_findlotteryurl, headers: JSON.parse(VAL_findlotteryheader) }
132103
chavy.get(url, (error, response, data) => {
133104
try {
134-
chavy.log(`❌ ${cookieName} findlottery - response: ${JSON.stringify(response)}`)
135105
signinfo.findlottery = JSON.parse(data)
136106
resolve()
137107
} catch (e) {
@@ -150,7 +120,6 @@ function lottery() {
150120
url.headers['Referer'] = `https://m.client.10010.com/dailylottery/static/doubleball/firstpage?encryptmobile=${signinfo.encryptmobile}`
151121
chavy.post(url, (error, response, data) => {
152122
try {
153-
chavy.log(`❌ ${cookieName} lottery - response: ${JSON.stringify(response)}`)
154123
signinfo.lotterylist = signinfo.lotterylist ? signinfo.lotterylist : []
155124
signinfo.lotterylist.push(JSON.parse(data))
156125
resolve()
@@ -194,44 +163,41 @@ function getinfo() {
194163
function showmsg() {
195164
let subTitle = ''
196165
let detail = ''
197-
let signday = ''
198166

199167
// 签到结果
200-
if (signinfo.signapp.msgCode == '0000') {
168+
if (signinfo.signapp.signinMedal) {
201169
subTitle = `签到: 成功`
202-
signday = `; 连签: ${signinfo.signapp.continuCount}天`
203-
detail = `连签: ${signinfo.signapp.continuCount}天, 积分: +${signinfo.signapp.prizeCount}`
204-
} else if (signinfo.signapp.msgCode == '0008') {
170+
detail = `积分: +${signinfo.signapp.prizeCount}, 成长值: +${signinfo.signapp.growthV}, 鲜花: +${signinfo.signapp.flowerCount}`
171+
} else if (JSON.stringify(signinfo.signapp) == '{}') {
205172
subTitle = `签到: 重复`
206173
} else {
207174
subTitle = `签到: 失败`
175+
chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(signinfo.signapp)}`)
208176
}
209177

210178
if (signinfo.info.code == '0000') {
211179
// 基本信息
212-
subTitle += signday
213180
detail = detail ? `${detail}\n` : ``
214181
const free = signinfo.info.dataList[0]
215182
const flow = signinfo.info.dataList[1]
216183
const voice = signinfo.info.dataList[2]
217184
detail = `话费: ${free.number}${free.unit}, 已用: ${flow.number}${flow.unit}, 剩余: ${voice.number}${voice.unit}`
185+
} else {
186+
chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(signinfo.info)}`)
218187
}
219188

220189
if (signinfo.findlottery && signinfo.findlottery.acFrequency && signinfo.lotterylist) {
221190
subTitle += `; 抽奖: ${signinfo.findlottery.acFrequency.usableAcFreq}次`
222-
detail += '\n查看抽奖详情\n'
191+
detail += '\n查看详情\n'
223192

224193
for (let i = 0; i < signinfo.findlottery.acFrequency.usableAcFreq; i++) {
225-
detail += `\n抽奖 (${i}): ${signinfo.lotterylist[i].RspMsg}`
194+
detail += `\n抽奖 (${i + 1}): ${signinfo.lotterylist[i].RspMsg}`
226195
}
196+
} else {
197+
chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(signinfo.findlottery)}`)
227198
}
228199

229-
// 详细信息
230-
// if (signinfo.detail.code == '0000') {
231-
// }
232-
233200
chavy.msg(cookieName, subTitle, detail)
234-
chavy.done()
235201
}
236202

237203
function init() {

‎10010/README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
99
> 2020.3.12 增加每日抽奖 (需要进抽奖页面获取 Cookie) (进抽奖页会弹两个获取 Cookie 成功的消息) (签到 Cookie 不用重新获取) (增加了 rewrite 和 mitm), 注意看操作步骤说明
1010
11+
> 2020.5.6 修复签到报错问题
12+
1113
## 配置 (Surge)
1214

1315
```properties
@@ -17,7 +19,7 @@ hostname = act.10010.com, m.client.10010.com
1719
[Script]
1820
# 注意获取Cookie有两条脚本
1921
http-request ^https:\/\/act.10010.com\/SigninApp\/signin\/querySigninActivity.htm script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.cookie.js
20-
http-request ^https:\/\/act.10010.com\/SigninApp(.*?)\/signin\/daySign.do script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.cookie.js
22+
http-request ^https:\/\/act.10010.com\/SigninApp(.*?)\/signin\/daySign script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.cookie.js
2123
http-request ^https:\/\/m.client.10010.com\/dailylottery\/static\/(textdl\/userLogin|active\/findActivityInfo) script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.cookie.js
2224
cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.js
2325
```
@@ -31,7 +33,7 @@ hostname = act.10010.com, m.client.10010.com
3133
[rewrite_local]
3234
# 注意获取Cookie有两条脚本
3335
^https:\/\/act.10010.com\/SigninApp\/signin\/querySigninActivity.htm url script-request-header 10010.cookie.js
34-
^https:\/\/act.10010.com\/SigninApp(.*?)\/signin\/daySign.do url script-request-header 10010.cookie.js
36+
^https:\/\/act.10010.com\/SigninApp(.*?)\/signin\/daySign url script-request-header 10010.cookie.js
3537
^https:\/\/m.client.10010.com\/dailylottery\/static\/(textdl\/userLogin|active\/findActivityInfo) url script-request-header 10010.cookie.js
3638

3739
[task_local]

0 commit comments

Comments
 (0)