Skip to content

Commit b0173b9

Browse files
committed
更新[京东618]: 删除多余日志输出, 一直火爆的话选择性弃坑吧
1 parent dd5a7ed commit b0173b9

4 files changed

Lines changed: 59 additions & 23 deletions

File tree

‎jd/jd.618.adapt.js‎

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ $.VAL_body = $.getdata('chavy_body_jd816')
44
$.VAL_headers = $.getdata('chavy_headers_jd816')
55
$.VAL_isSignShop = $.getdata('CFG_618_isSignShop') || 'true'
66
$.VAL_isJoinBrand = $.getdata('CFG_618_isJoinBrand') || 'false'
7+
$.VAL_radommsMin = $.getdata('CFG_618_radomms_min') || '2000'
8+
$.VAL_radommsMax = $.getdata('CFG_618_radomms_max') || '5000'
79

810
!(async () => {
911
$.log('', `🔔 ${$.name}, 开始!`, '')
@@ -31,7 +33,8 @@ function getData() {
3133
$.log(`❕ ${$.name}, 获取密钥!`)
3234
$.log(` 密钥 = ${$.secretp.slice(0, 10)}...`)
3335
$.log(` 等级 = ${_info.raiseInfo.scoreLevel}`)
34-
$.log(` 分数 = ${_info.raiseInfo.totalScore} => ${_info.raiseInfo.nextLevelScore}`, '')
36+
$.log(` 分数 = ${_info.raiseInfo.totalScore} => ${_info.raiseInfo.nextLevelScore}`)
37+
$.log(` 延时 = ${$.VAL_radommsMin} => ${$.VAL_radommsMax} 毫秒`, '')
3538
} catch (e) {
3639
$.log(`❗️ ${$.name}, 获取密钥!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
3740
} finally {
@@ -109,7 +112,11 @@ async function execActs() {
109112
for (let _actIdx = 0; _actIdx < $.acts.length; _actIdx++) {
110113
const _act = $.acts[_actIdx]
111114
$.log(` ${_actIdx + 1}. ${_act.name} (${_act.times}/${_act.maxTimes})`)
112-
// // 跳过:邀请好友、加入战队
115+
if (_act.times === _act.maxTimes) {
116+
$.log(` @跳过: 全部完成!`, '')
117+
continue
118+
}
119+
// 跳过:邀请好友、加入战队
113120
if ([2, 12].includes(_act.id)) {
114121
$.log(' 跳过!', '')
115122
continue
@@ -120,20 +127,32 @@ async function execActs() {
120127
for (let subactIdx = 0; subactIdx < _act.subacts.length; subactIdx++) {
121128
const subact = _act.subacts[subactIdx]
122129
$.log(` ${subactIdx + 1}. ${subact.name} (${subact.times}/${subact.maxTimes})`)
130+
if (subact.times === subact.maxTimes) {
131+
$.log(` @跳过: 全部完成!`, '')
132+
continue
133+
}
123134
for (let subataskIdx = 0; subataskIdx < subact.tasks.length; subataskIdx++) {
124135
const subatask = subact.tasks[subataskIdx]
125136
$.log(` ${subataskIdx + 1}. ${subatask.name.slice(0, 15)}...`)
137+
if (subatask._raw.status && subatask._raw.status === 2) {
138+
$.log(` @跳过: 已经做过!`, '')
139+
continue
140+
}
126141
await sendtask(subact, subatask, true)
127142
$.log(` @认领任务: ${subatask.isClaimSuc ? '🟢' : '🔴'}`)
128143
if (subatask.isskip) {
129144
$.log(` @跳过: ${subatask.msg}`)
130-
$.log(` @等待: 0.5 秒`, '')
131-
await new Promise($.wait(500))
145+
const randomms = genRadomms()
146+
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
147+
await new Promise($.wait(8000 + randomms))
132148
} else {
133-
$.log(` @等待: ${subact.waitDuration} 秒`)
134-
await new Promise($.wait(subact.waitDuration * 1000))
149+
const randomms = genRadomms()
150+
$.log(` @等待: ${subact.waitDuration} 秒 + ${randomms} 毫秒`)
151+
await new Promise($.wait(subact.waitDuration * 1000 + randomms))
135152
await sendtask(subact, subatask)
136-
$.log(` @完成任务: ${subatask.isExecSuc ? '🟢' : '🔴'}`, '')
153+
$.log(` @完成任务: ${subatask.isExecSuc ? '🟢' : '🔴'}`)
154+
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
155+
await new Promise($.wait(5000 + randomms))
137156
}
138157
}
139158
}
@@ -146,10 +165,13 @@ async function execActs() {
146165
$.log(` ${taskIdx + 1}. ${task.name}`)
147166
await joinBrand(task)
148167
$.log(` @加入会员: ${task.isJoinSuc ? '🟢' : '🔴'}`)
149-
$.log(` @等待: ${_act.waitDuration} 秒`)
150-
await new Promise($.wait(_act.waitDuration * 1000))
168+
const randomms = genRadomms()
169+
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
170+
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
151171
await brandAward(task)
152-
$.log(` @完成任务: ${task.isAwardSuc ? '🟢' : '🔴'}`, '')
172+
$.log(` @完成任务: ${task.isAwardSuc ? '🟢' : '🔴'}`)
173+
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
174+
await new Promise($.wait(5000 + randomms))
153175
}
154176
} else {
155177
$.log(` @跳过: BoxJs 设置为 关闭 品牌会员!`, '')
@@ -160,17 +182,25 @@ async function execActs() {
160182
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
161183
const task = _act.tasks[taskIdx]
162184
$.log(` ${taskIdx + 1}. ${task.name}`)
185+
if (task._raw.status && task._raw.status === 2) {
186+
$.log(` @跳过: 已经做过!`, '')
187+
continue
188+
}
163189
await sendtask(_act, task, true)
164190
$.log(` @认领任务: ${task.isClaimSuc ? '🟢' : '🔴'}`)
165191
if (task.isskip || task.ishot) {
166192
$.log(` @跳过: ${task.msg}`)
167-
$.log(` @等待: 0.5 秒`, '')
168-
await new Promise($.wait(500))
193+
const randomms = genRadomms()
194+
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
195+
await new Promise($.wait(8000 + randomms))
169196
} else {
170-
$.log(` @等待: ${_act.waitDuration} 秒`)
171-
await new Promise($.wait(_act.waitDuration * 1000))
197+
const randomms = genRadomms()
198+
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
199+
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
172200
await sendtask(_act, task)
173-
$.log(` @完成任务: ${task.isExecSuc ? '🟢' : '🔴'}`, '')
201+
$.log(` @完成任务: ${task.isExecSuc ? '🟢' : '🔴'}`)
202+
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
203+
await new Promise($.wait(5000 + randomms))
174204
}
175205
}
176206
}
@@ -185,8 +215,9 @@ async function execActs() {
185215
await signshop(shop)
186216
shop.msg = /,/.test(shop.msg) ? shop.msg.split(',')[1] : shop.msg
187217
$.log(` @签到: ${shop.isSuc ? '🟢 已领取!' : shop.code === 402 ? '⚪️ 无效活动!' : `🔴 ${shop.msg}`}`)
188-
$.log(` @等待: 1 秒`, '')
189-
await new Promise($.wait(1000))
218+
const randomms = genRadomms()
219+
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
220+
await new Promise($.wait(8000 + randomms))
190221
}
191222
} else {
192223
$.log(` @跳过: BoxJs 设置为 关闭 商店签到!`, '')
@@ -240,7 +271,6 @@ function sendtask(act, task, isClaim = false) {
240271
actionType: isClaim ? 1 : undefined,
241272
safeStr: JSON.stringify({ secretp: $.secretp })
242273
}
243-
244274
$.post(taskurl('cakebaker_ckCollectScore', JSON.stringify(body)), (error, response, data) => {
245275
try {
246276
const _data = JSON.parse(data)
@@ -294,6 +324,7 @@ function joinBrand(task) {
294324
}
295325
const joinurl = `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body=${encodeURIComponent(JSON.stringify(body))}&client=H5&clientVersion=8.5.6&uuid=88888`
296326
const url = { url: joinurl, headers: JSON.parse($.VAL_headers) }
327+
delete url.headers['Content-Length']
297328
$.get(url, (error, response, data) => {
298329
try {
299330
const _data = JSON.parse(data)
@@ -334,7 +365,13 @@ function taskurl(fid, body = '{}') {
334365
return url
335366
}
336367

368+
function genRadomms() {
369+
const max = $.VAL_radommsMax * 1
370+
const min = $.VAL_radommsMin * 1
371+
return parseInt(Math.random() * (max - min + 1) + min, 10)
372+
}
373+
337374
function showmsg() {}
338375

339376
// prettier-ignore
340-
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&&(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))}
377+
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);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),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&&(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.boom.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ async function showmsg() {
8585
}
8686

8787
// prettier-ignore
88-
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))}
88+
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);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),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&&(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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ const $ = new Env('京东618')
5151
})
5252

5353
// prettier-ignore
54-
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))}
54+
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);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),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&&(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.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ function sendtask(act, task, isClaim = false) {
272272
safeStr: JSON.stringify({ secretp: $.secretp })
273273
}
274274
$.post(taskurl('cakebaker_ckCollectScore', JSON.stringify(body)), (error, response, data) => {
275-
console.log(data)
276275
try {
277276
const _data = JSON.parse(data)
278277
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
@@ -375,4 +374,4 @@ function genRadomms() {
375374
function showmsg() {}
376375

377376
// prettier-ignore
378-
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&&(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))}
377+
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);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),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&&(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))}

0 commit comments

Comments
 (0)