Skip to content

Commit c67f188

Browse files
committed
添加[美团]签到 (QuanX需要v1.0.6-build195及更高)
1 parent 75fcbb6 commit c67f188

5 files changed

Lines changed: 258 additions & 3 deletions

File tree

‎QuantumultX_Local_Cookie.conf‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 本配置适用于: QuanX TestFlight v1.0.6-build195 及以后版本
22
# 如果你是商店版, 请使用: QuantumultX_AppStore_Local_Cookie.conf
33

4-
hostname = promotion.waimai.meituan.com, wx.10086.cn, www.maomicd.com, act.10010.com, api-takumi.mihoyo.com, gdws.nsenz.com, credits.bz.mgtv.com, *.csdn.net, wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com, *.feng.com, www.flyertea.com, music.163.com, *.m.163.com, user.qunar.com, *.rr.tv, *.weixinjia.net, *.smzdm.com, tieba.baidu.com, *.v2ex.com, *.video.qq.com, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
4+
hostname = i.meituan.com, promotion.waimai.meituan.com, wx.10086.cn, www.maomicd.com, act.10010.com, api-takumi.mihoyo.com, gdws.nsenz.com, credits.bz.mgtv.com, *.csdn.net, wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com, *.feng.com, www.flyertea.com, music.163.com, *.m.163.com, user.qunar.com, *.rr.tv, *.weixinjia.net, *.smzdm.com, tieba.baidu.com, *.v2ex.com, *.video.qq.com, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
55

66
# 电信营业厅
77
^https:\/\/wapside.189.cn:9001\/api\/home\/homeInfo url script-request-header chavyleung/10000/10000.cookie.js
@@ -89,4 +89,7 @@ https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url sc
8989

9090
# 美团外卖
9191
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/entry url script-request-header chavyleung/wmmeituan/wmmeituan.cookie.js
92-
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction url script-request-body chavyleung/wmmeituan/wmmeituan.cookie.js
92+
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction url script-request-body chavyleung/wmmeituan/wmmeituan.cookie.js
93+
94+
# 美团
95+
^https:\/\/i.meituan.com\/evolve\/signin\/signpost\/ url script-request-body chavyleung/meituan/meituan.cookie.js

‎QuantumultX_Local_Task.conf‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,6 @@
5353
# 中国移动
5454
7 0 * * * chavyleung/10086/10086.js
5555
# 美团外卖
56-
8 0 * * * chavyleung/wmmeituan/wmmeituan.js
56+
8 0 * * * chavyleung/wmmeituan/wmmeituan.js
57+
# 美团
58+
7 0 * * * chavyleung/meituan/meituan.js

‎meituan/README.md‎

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# 美团
2+
3+
> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可
4+
5+
> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight)
6+
7+
## 配置 (Surge)
8+
9+
```properties
10+
[MITM]
11+
i.meituan.com
12+
13+
[Script]
14+
http-request ^https:\/\/i.meituan.com\/evolve\/signin\/signpost\/ script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/meituan/meituan.cookie.js, requires-body=true
15+
cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/meituan/meituan.js
16+
```
17+
18+
## 配置 (QuanX)
19+
20+
```properties
21+
[MITM]
22+
i.meituan.com
23+
24+
[rewrite_local]
25+
26+
# [商店版] QuanX v1.0.6-build194 及更早版本
27+
# 不支持
28+
29+
# [TestFlight] QuanX v1.0.6-build195 及以后版本
30+
^https:\/\/i.meituan.com\/evolve\/signin\/signpost\/ url script-request-body meituan.cookie.js
31+
32+
[task_local]
33+
1 0 * * * meituan.js
34+
```
35+
36+
## 说明
37+
38+
1. 先把`i.meituan.com`加到`[MITM]`
39+
2. 再配置重写规则:
40+
- Surge: 把两条远程脚本放到`[Script]`
41+
- QuanX: 把`meituan.cookie.js`和`meituan.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关)
42+
3. 打开 APP , 进入签到页面, 系统提示: `获取刷新链接: 成功`
43+
4. 然后手动签到 1 次, 系统提示: `获取Cookie: 成功`
44+
5. 把获取 Cookie 的脚本注释掉
45+
6. 运行一次脚本, 如果提示重复签到, 那就算成功了!
46+
47+
> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
48+
49+
> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次.
50+
51+
## 常见问题
52+
53+
1. 无法写入 Cookie
54+
55+
- 检查 Surge 系统通知权限放开了没
56+
- 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴)
57+
58+
2. 写入 Cookie 成功, 但签到不成功
59+
60+
- 看看是不是在登录前就写入 Cookie 了
61+
- 如果是,请确保在登录成功后,再尝试写入 Cookie
62+
63+
3. 为什么有时成功有时失败
64+
65+
- 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败)
66+
- 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学):
67+
68+
- `Surge`配置:
69+
70+
```properties
71+
# 没有什么是一顿饭解决不了的:
72+
cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次
73+
# 如果有,那就两顿:
74+
cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次
75+
# 实在不行,三顿也能接受:
76+
cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次
77+
78+
# 再粗暴点,直接:
79+
cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次
80+
```
81+
82+
- `QuanX`配置:
83+
84+
```properties
85+
[task_local]
86+
1 0 * * * xxx.js # 每天00:01执行一次
87+
2 0 * * * xxx.js # 每天00:02执行一次
88+
3 0 * * * xxx.js # 每天00:03执行一次
89+
90+
*/60 * * * * xxx.js # 每60分执行一次
91+
```
92+
93+
## 感谢
94+
95+
[@NobyDa](https://github.com/NobyDa)
96+
97+
[@lhie1](https://github.com/lhie1)
98+
99+
[@ConnersHua](https://github.com/ConnersHua)

‎meituan/meituan.cookie.js‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
const cookieName = '美团'
2+
const tokenurlKey = 'chavy_tokenurl_meituan'
3+
const tokenheaderKey = 'chavy_tokenheader_meituan'
4+
const signurlKey = 'chavy_signurl_meituan'
5+
const signheaderKey = 'chavy_signheader_meituan'
6+
const signbodyKey = 'chavy_signbody_meituan'
7+
const chavy = init()
8+
9+
const requrl = $request.url
10+
if ($request && $request.method != 'OPTIONS' && requrl.match(/\/evolve\/signin\/signpost\//)) {
11+
const signurlVal = requrl
12+
const signheaderVal = JSON.stringify($request.headers)
13+
const signbodyVal = $request.body
14+
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
15+
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
16+
if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey)
17+
title = chavy.msg(cookieName, `获取Cookie: 成功`, ``)
18+
}
19+
20+
function init() {
21+
isSurge = () => {
22+
return undefined === this.$httpClient ? false : true
23+
}
24+
isQuanX = () => {
25+
return undefined === this.$task ? false : true
26+
}
27+
getdata = (key) => {
28+
if (isSurge()) return $persistentStore.read(key)
29+
if (isQuanX()) return $prefs.valueForKey(key)
30+
}
31+
setdata = (key, val) => {
32+
if (isSurge()) return $persistentStore.write(key, val)
33+
if (isQuanX()) return $prefs.setValueForKey(key, val)
34+
}
35+
msg = (title, subtitle, body) => {
36+
if (isSurge()) $notification.post(title, subtitle, body)
37+
if (isQuanX()) $notify(title, subtitle, body)
38+
}
39+
log = (message) => console.log(message)
40+
get = (url, cb) => {
41+
if (isSurge()) {
42+
$httpClient.get(url, cb)
43+
}
44+
if (isQuanX()) {
45+
url.method = 'GET'
46+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
47+
}
48+
}
49+
post = (url, cb) => {
50+
if (isSurge()) {
51+
$httpClient.post(url, cb)
52+
}
53+
if (isQuanX()) {
54+
url.method = 'POST'
55+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
56+
}
57+
}
58+
done = (value = {}) => {
59+
$done(value)
60+
}
61+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
62+
}
63+
chavy.done()

‎meituan/meituan.js‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
const cookieName = '美团'
2+
const tokenurlKey = 'chavy_tokenurl_meituan'
3+
const tokenheaderKey = 'chavy_tokenheader_meituan'
4+
const signurlKey = 'chavy_signurl_meituan'
5+
const signheaderKey = 'chavy_signheader_meituan'
6+
const signbodyKey = 'chavy_signbody_meituan'
7+
const chavy = init()
8+
const tokenurlVal = chavy.getdata(tokenurlKey)
9+
const tokenheaderVal = chavy.getdata(tokenheaderKey)
10+
const signurlVal = chavy.getdata(signurlKey)
11+
const signheaderVal = chavy.getdata(signheaderKey)
12+
const signBodyVal = chavy.getdata(signbodyKey)
13+
14+
sign()
15+
16+
function sign() {
17+
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
18+
chavy.post(url, (error, response, data) => {
19+
chavy.log(`${cookieName}, data: ${data}`)
20+
const result = JSON.parse(
21+
`{\"code\":0,\"msg\":\"操作成功\",\"data\":[{\"activityId\":100219,\"errorCode\":0,\"signInAwardRecords\":[{\"type\":4,\"info\":\"{\\\"amount\\\":206,\\\"id\\\":137735,\\\"manual\\\":false,\\\"type\\\":\\\"cash\\\"}\"},{\"type\":1,\"info\":\"{\\\"amount\\\":25.0,\\\"condition\\\":\\\"满200元可用\\\",\\\"name\\\":\\\"签到酒店首单券\\\",\\\"isMoney\\\":false,\\\"id\\\":137742,\\\"type\\\":\\\"coupon\\\",\\\"manual\\\":true,\\\"couponId\\\":\\\"0c7a0ebe5a\\\",\\\"personaId\\\":980}\"},{\"type\":1,\"info\":\"{\\\"amount\\\":4.0,\\\"condition\\\":\\\"满49元可用\\\",\\\"name\\\":\\\"签到美食券\\\",\\\"isMoney\\\":false,\\\"id\\\":137743,\\\"type\\\":\\\"coupon\\\",\\\"manual\\\":true,\\\"couponId\\\":\\\"6afa6cc079\\\",\\\"personaId\\\":110509}\"}],\"circleSignTimes\":1,\"circleSize\":7,\"firstSignDay\":true,\"success\":true,\"lastDayInCircle\":false}]}`
22+
)
23+
let subTitle = ``
24+
let detail = ``
25+
if (result.code == 0) {
26+
subTitle = `签到结果: 成功`
27+
detail = `本周连签: ${result.data[0].circleSignTimes}天`
28+
for (r of result.data[0].signInAwardRecords) {
29+
const rinfo = JSON.parse(r.info)
30+
if (rinfo.type == `cash`) detail += `, 奖励金: ${rinfo.amount / 100}元`
31+
else if (rinfo.type == `coupon`) detail += `\n优惠券: ${rinfo.name}: ${rinfo.amount}元 (${rinfo.condition})`
32+
else detail += `\n未知奖励!`
33+
}
34+
} else if (result.code == 2002) {
35+
subTitle = `签到结果: 成功 (重复签到)`
36+
detail = `说明: ${result.msg}`
37+
} else {
38+
subTitle = `签到结果: 失败`
39+
detail = `编码: ${result.code}, 说明: ${result.msg}`
40+
}
41+
chavy.msg(cookieName, subTitle, detail)
42+
chavy.done()
43+
})
44+
}
45+
46+
function init() {
47+
isSurge = () => {
48+
return undefined === this.$httpClient ? false : true
49+
}
50+
isQuanX = () => {
51+
return undefined === this.$task ? false : true
52+
}
53+
getdata = (key) => {
54+
if (isSurge()) return $persistentStore.read(key)
55+
if (isQuanX()) return $prefs.valueForKey(key)
56+
}
57+
setdata = (key, val) => {
58+
if (isSurge()) return $persistentStore.write(key, val)
59+
if (isQuanX()) return $prefs.setValueForKey(key, val)
60+
}
61+
msg = (title, subtitle, body) => {
62+
if (isSurge()) $notification.post(title, subtitle, body)
63+
if (isQuanX()) $notify(title, subtitle, body)
64+
}
65+
log = (message) => console.log(message)
66+
get = (url, cb) => {
67+
if (isSurge()) {
68+
$httpClient.get(url, cb)
69+
}
70+
if (isQuanX()) {
71+
url.method = 'GET'
72+
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
73+
}
74+
}
75+
post = (url, cb) => {
76+
if (isSurge()) {
77+
$httpClient.post(url, cb)
78+
}
79+
if (isQuanX()) {
80+
url.method = 'POST'
81+
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
82+
}
83+
}
84+
done = (value = {}) => {
85+
$done(value)
86+
}
87+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
88+
}

0 commit comments

Comments
 (0)