Skip to content

Commit 7c96df0

Browse files
committed
更新[京东618]: 增加炸弹
1 parent 8f41c39 commit 7c96df0

3 files changed

Lines changed: 60 additions & 3 deletions

File tree

‎jd/jd.618.boom.js‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const $ = new Env('京东618炸弹')
2+
$.VAL_url = $.getdata('chavy_url_jd816')
3+
$.VAL_body = $.getdata('chavy_body_jd816')
4+
$.VAL_headers = $.getdata('chavy_headers_jd816')
5+
6+
!(async () => {
7+
$.log('', `🔔 ${$.name}, 开始!`, '')
8+
await boom()
9+
await showmsg()
10+
})()
11+
.catch((e) => {
12+
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
13+
})
14+
.finally(() => {
15+
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
16+
})
17+
18+
function boom() {
19+
return new Promise((resove) => {
20+
$.post(taskurl('cakebaker_pk_getCakeBomb'), (error, response, data) => {
21+
try {
22+
if (error) throw new Error(error)
23+
const _data = JSON.parse(data)
24+
const _issuc = _data.code === 0 && _data.data && _data.data.bizCode === 0
25+
$.boom = { isSuc: _issuc, ..._data.data.result }
26+
$.log('', `❕ ${JSON.stringify(data)}`, '')
27+
} catch (e) {
28+
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
29+
} finally {
30+
resove()
31+
}
32+
})
33+
})
34+
}
35+
36+
function taskurl(fid, body = '{}') {
37+
const url = { url: `https://api.m.jd.com/client.action` }
38+
url.headers = JSON.parse($.VAL_headers)
39+
url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0`
40+
return url
41+
}
42+
43+
function showmsg() {
44+
return new Promise((resove) => {
45+
$.subt = `我方: ${$.boom.groupLevel || '❓'}层, 对方: ${$.boom.opponentLevel || 0}层, 炸掉: ${$.boom.destroyLevel || 0}层`
46+
$.desc = $.boom.tip || '提示: 无!'
47+
resove()
48+
})
49+
}
50+
51+
// prettier-ignore
52+
function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i),this.log("==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),t&&this.log(t),s&&this.log(s),i&&this.log(i)}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s.body=e,s.statusCode=s.status,i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))}

‎jd/jd.618.cookie.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Surge:
66
* Rewrite: JD618 = type=http-request,pattern=^https:\/\/api.m.jd.com\/client.action\?functionId=cakebaker_getHomeData,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.cookie.js,requires-body=true
77
* Tasks: JD618 = type=cron,cronexp="10,20,30,40,50 0 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.js,wake-system=true,timeout=600
8+
* Tasks: JD618.Boom = type=cron,cronexp="0 10,12,18,20 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js,wake-system=true
89
*
910
* QuanX:
1011
* # 本地
@@ -15,11 +16,14 @@
1516
* [task_local]
1617
* # 本地
1718
* 10,20,30,40,50 0 * * * jd.618.js, tag=京东618
19+
* 0 10,12,18,20 * * * jd.618.boom.js, tag=京东618炸弹
1820
* # 远程
19-
* 10,20,30,40,50 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.js, tag=京东618
21+
* 10,20,30,40,50 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.adapt.js, tag=京东618
22+
* 0 10,12,18,20 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js, tag=京东618炸弹
2023
*
2124
* Loon:
22-
* cron "10,20,30,40,50 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.js, timeout=600, tag=京东618
25+
* cron "10,20,30,40,50 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.adapt.js, timeout=600, tag=京东618
26+
* cron "0 10,12,18,20 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js, tag=京东618炸弹
2327
* http-request ^https:\/\/api.m.jd.com\/client.action\?functionId=cakebaker_getHomeData script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.cookie.js,requires-body=true
2428
*
2529
* [MITM]

‎jd/jd.618.sgmodule‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
#!system=ios
44

55
[Script]
6-
Tasks: JD618 = type=cron,cronexp="10,20,30,40,50 0 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.js,wake-system=true,timeout=600
6+
Tasks: JD618 = type=cron,cronexp="10,20,30,40,50 0 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.adapt.js,wake-system=true,timeout=600
7+
Tasks: JD618.Boom = type=cron,cronexp="0 10,12,18,20 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js,wake-system=true

0 commit comments

Comments
 (0)