1
0
mirror of https://github.com/6dylan6/jdpro.git synced 2026-04-20 11:03:08 +08:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Tangcong 3e58bb4e18 Merge 005fe03104 into d507b07911 2025-01-14 22:27:04 +08:00
Tangcong 005fe03104 提交测试
点击右上角绿色按钮 "Commit changes..."。对于提交,您可以输入简短文字来描述您所做的更改。 此信息可帮助其他人了解您的提交中包含的内容。 GitHub 提供了一个简单的默认描述,但让我们稍微更改一下以进行练习。 首先,在第一个标题为“提交消息”的文本输入字段中输入 Add PROFILE.md。
2024-10-22 10:34:12 +08:00
152 changed files with 4491 additions and 658 deletions
-18
View File
@@ -1,18 +0,0 @@
name: 问题反馈 🐞
description: 有问题先更新订阅,不行才提
body:
- type: input
id: version
attributes:
label: 青龙版本
validations:
required: true
- type: textarea
id: description
attributes:
label: 问题描述
description: 尽量详细描述问题,附上错误日志或截图。
placeholder: 请描述
validations:
required: true
-5
View File
@@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: TG Chat
url: https://t.me/dylan_jdpro
about: 关注tg不迷路
@@ -1,9 +0,0 @@
name: "💡功能建议"
description: 为项目提想法
labels: ["pending","feature"]
body:
- type: textarea
id: require
attributes:
label: 需求描述
placeholder: 请描述
+1
View File
@@ -0,0 +1 @@
Welcome to my GitHub profile!
+38 -29
View File
@@ -6,15 +6,15 @@
### [TG CHANEL](https://t.me/dylan_jdpro)
国内机(带加速,也不太稳):
国内机(带代理):
```
ql repo https://js.googo.win/https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify|utils"
ql repo https://js.okyago.com/https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify|utils"
```
国外机(国外ip有限制可能有些任务不能正常运行)
国外机:
```
ql repo https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify|utils"
@@ -22,16 +22,23 @@ ql repo https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|U
```
线报监控类,[入口](https://github.com/6dylan6/jdm.git)
## 使用
1、部署青龙登陆,版本不用追新,稳定才好,推荐部署到内网(不要外网访问,2.20.2以下版本面板会被免密登录偷家,如果必须外网就用最新版本吧)。
2、到订阅管理创建订阅并运行;正确配置[参考](https://github.com/6dylan6/jdpro/issues/22)
## 简要流程
3、订阅执行完,到定时任务搜索依赖安装(jd_indeps)任务执行;
1、部署青龙并登陆。
4、到环境变量,创建变量,名称: JD_COOKIE,值:抓的CK(要安全就手抓),多个每行建一个,不要全写在一个
2、到配置管理config.sh修改,差不多在17行(特别注意,没有修改此配置,sh类型任务拉不下来)
RepoFileExtensions="js py"修改为 RepoFileExtensions="js py sh" 保存;
3、到订阅管理创建订阅并运行;正确配置[参考](https://github.com/6dylan6/jdpro/issues/22)
4、订阅运行完毕,到定时任务搜索依赖安装(jd_indeps.sh)任务执行,步骤2未完成会拉不到该任务;
4、到环境变量,创建变量,名称: JD_COOKIE,值:抓的CK(要安全就手抓),多个每行建一个,不要写在一个里;
5、配置通知,通知的key填写到配置管理config.sh文件;
@@ -68,20 +75,33 @@ export NOTIFY_SHOWNAMETYPE="4" 效果是 : 账号名称:备注
3、因为青龙有随机延时(可以在配置文件设置为0,默认300秒),所以涉及准点运行的任务,最后加now,如果是desi或conc不用加也会准时跑。
4、脚本的通知,需把通知key变量在config.sh文件配置
4、青龙系统通知(新增删除任务、登录等通知,需把通知变量写到config.sh文件,在环境变量里只发脚本运行通知哈
5、建议调整任务运行超时时间,青龙默认1小时有些跑不完就被强制结束,config.sh里配置。CommandTimeoutTime="3h" 即改为3小时,根据自己ck数量调整。
</code></pre>
</details>
6、ck掉线,不是常用地ip,短时间内连续获得豆可能就会会触发风控掉线
如需禁止某些CK参加所有活动或某些活动功能,实现重组CK顺序功能,包括随机、优先、轮换、组队、分段等功能,把[task_before](./docker/task_before.sh)文件内容复制到配置管理task_before.sh保存
常用变量举例:
Recombin_CK_Mode="1" 全部顺序随机
Recombin_CK_Mode="2" Recombin_CK_ARG1="15" 假设有100个CK,前15个CK按正常顺序靠前,其余CK随机乱序
Recombin_CK_Mode="3" Recombin_CK_ARG1="5" Recombin_CK_ARG2="5" 假设有100个CK,希望前5个账号始终保持在前部,剩余95个账号按照轮换模式每天轮换5个
其他用法具体参考[文档](https://docs.qq.com/doc/DTXh6QUVjRXJ1TFdN)
## 通用环境变量(到配置管理-config.sh里添加变量,export xxx='xxx'格式)
AUTOCFG='true' 自动配置sendNotify文件到deps目录
代理API模式(API代理是通过url接得到随机可用代理ip,格式是:xxx.xxx.xxx.xxx:xxxx
代理API模式部分支持
DY_PROXY='URL1#URL2' 多个#分割
DY_PROXY='URL1@URL2' 多个@分割
PERMIT_API='test' 需要走API代理的js关键词,多个&分割,可不设置,支持的js都会走
@@ -89,31 +109,20 @@ DY_PROXY_RENUM='5' 获取IP失败重试次数
DY_PROXY_REDELAY='3' 获取失败重试间隔 单位秒
代理池模式(就是一个代理服务器的地址)
代理池模式支持全部js脚
DP_POOL='http://xxx' 代理池url
PERMIT_JS='farm&plant&opencard' 需要走代理池的js关键词,多个&分割(可不设置,如果不设置就是所有的js都会走)
PERMIT_JS='farm&plant&opencard' 需要走代理池的js关键词,多个&分割,必须设置
禁止指定的pin执行任务:
多个任务同pinBANPIN='任务1|任务2@pin1,pin2'
BANPIN 禁止某pin执行任务
多个任务不同pinBANPIN='任务1@pin,pin2&任务2@pin2,pin3'
ALLOWPIN 只执行某pin执行任务
不指定任务只写pin 全部任务都不执行该pinBANPIN='pin1,pin2'
多个任务同pin:任务1|任务2@pin1,pin2
多个任务不同pin:任务1@pin,pin2&任务2@pin2,pin3
不指定任务只写pin:全部任务
示例
export BANPIN='draw@pin1,pin2'
export ALLOWPIN='draw@pin1,pin2'
## 支持的通知方式
+11 -6
View File
@@ -1,12 +1,17 @@
version: '2'
services:
ql_web:
image: whyour/qinglong:2.17.9
image: whyour/qinglong:2.11.3
container_name: ql
volumes:
- ./qinglong/data:/ql/data
- ./qinglong/deps/pnpm:/root/.local/share/pnpm
- ./qinglong/deps/pip3:/usr/local/lib/python3.11/site-packages
- ./data/config:/ql/config
- ./data/log:/ql/log
- ./data/db:/ql/db
- ./data/scripts:/ql/scripts
- ./data/repo:/ql/repo
ports:
- "5700:5700"
restart: unless-stopped
- "0.0.0.0:5700:5700"
environment:
- ENABLE_HANGUP=true
- ENABLE_WEB_PANEL=true
restart: always
+17 -8
View File
@@ -46,16 +46,25 @@ cd $ql_path
cat > docker-compose.yml <<EOF
version: '2'
services:
ql_web:
image: whyour/qinglong:2.17.9
container_name: ql
qinglong:
image: whyour/qinglong:2.11.3
container_name: qinglong
volumes:
- ./qinglong/data:/ql/data
- ./qinglong/deps/pnpm:/root/.local/share/pnpm
- ./qinglong/deps/pip3:/usr/local/lib/python3.11/site-packages
- ./data/config:/ql/config
- ./data/log:/ql/log
- ./data/db:/ql/db
- ./data/scripts:/ql/scripts
- ./data/repo:/ql/repo
ports:
- "5700:5700"
restart: unless-stopped
- "0.0.0.0:5500:5700"
networks:
- net
environment:
- ENABLE_HANGUP=true
- ENABLE_WEB_PANEL=true
restart: always
networks:
net:
EOF
docker-compose up -d
if [ $? -ne 0 ] ; then
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+17 -28
View File
@@ -5,37 +5,26 @@ require('dotenv').config();
const { readFile } = require('fs/promises');
const path = require('path');
const fs = require('fs');
const tokenFileList = ['/ql/data/db/keyv.sqlite', '/ql/data/config/auth.json', '/ql/config/auth.json'];
let authFile = getLatestFile(tokenFileList);
const HOSTS = ['http://127.0.0.1:5600','http://127.0.0.1:5700'];
function api(options){
const req = got.extend({prefixUrl: HOSTS[0],retry:{limit:0},timeout:{request:5000}})(options);
['json','text','buffer'].forEach(m=>{
const orig=req[m].bind(req);
req[m]=()=>orig().catch(e=>['ECONNREFUSED','ETIMEDOUT'].includes(e.code)?got.extend({prefixUrl:HOSTS[1],retry:{limit:0},timeout:{request:5000}})(options)[m]():Promise.reject(e));
});
return req;
}
function getLatestFile(files) {
let latestFile = null;
let latestMtime = 0;
for (const file of files) {
try {
const stats = fs.statSync(file);
const mtime = stats.mtimeMs;
if (mtime > latestMtime) {
latestMtime = mtime;
latestFile = file;
}
} catch (e) {
}
}
return latestFile;
}
let Fileexists280 = fs.existsSync('/ql/data/db/keyv.sqlite');
let Fileexists = fs.existsSync('/ql/data/config/auth.json');
let authFile = "";
if (Fileexists280)
authFile = "/ql/data/db/keyv.sqlite"
else if (Fileexists)
authFile = "/ql/data/config/auth.json"
else
authFile = "/ql/config/auth.json"
const api = got.extend({
prefixUrl: 'http://127.0.0.1:5600',
retry: { limit: 0 },
});
async function getToken() {
const authConfig = await readFile(authFile);
// console.log(authConfig.toString().match(/"token":"(.*?)",/)[1])
return authConfig.toString().match(/"token":"([^"]*)"(?!.*"token":)/)[1];
return authConfig.toString().match(/"token":"(.*?)",/)[1];
}
// getToken()
module.exports.getEnvs = async () => {
+12 -44
View File
@@ -17,13 +17,13 @@ if (process.env.JD_COOKIE) {
CookieJDs = [process.env.JD_COOKIE];
}
}
//if (JSON.stringify(process.env).indexOf('GITHUB') > -1) {
// console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`);
// !(async () => {
// await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`)
// await process.exit(0);
// })()
//}
if (JSON.stringify(process.env).indexOf('GITHUB') > -1) {
console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`);
!(async () => {
await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`)
await process.exit(0);
})()
}
//!(async () => {
// IP = await getIP();
// try {
@@ -42,7 +42,7 @@ if (process.env.BANPIN) {
//if (process.mainModule.filename.includes(i.split('^')[0])) {
if (i.split('@')[0].split('|').filter(x => process.argv[1].includes(x)).length != 0) {
let pinarr = i.split('@')[1].split(',');
console.log(`\n已配置该任务不执行pin: ${JSON.stringify(pinarr)}`);
console.log(`已配置该任务不执行pin: ${JSON.stringify(pinarr)}`);
for (let j of pinarr) {
j = decodeURIComponent(j);
CookieJDs = CookieJDs.filter(x => !x.includes(encodeURIComponent(j)));
@@ -53,50 +53,18 @@ if (process.env.BANPIN) {
} else {
let pinarr = banpin.split(',');
console.log(`\n已配置全部任务不执行pin: ${JSON.stringify(pinarr)}`);
console.log(`已配置全不执行pin: ${JSON.stringify(pinarr)}`);
for (let i of pinarr) {
i = decodeURIComponent(i);
j = decodeURIComponent(j);
CookieJDs = CookieJDs.filter(x => !x.includes(encodeURIComponent(i)));
}
}
} catch { }
}
if (process.env.ALLOWPIN) {
try {
const pin = process.env.ALLOWPIN;
const runck = [];
if (pin.includes('@')) {
const arr = pin.split('&');
for (let i of arr) {
//if (process.mainModule.filename.includes(i.split('^')[0])) {
if (i.split('@')[0].split('|').filter(x => process.argv[1].includes(x)).length != 0) {
let pinarr = i.split('@')[1].split(',');
console.log(`\n❗已配置该任务只执行pin: ${JSON.stringify(pinarr)}`);
for (let j of pinarr) {
j = decodeURIComponent(j);
runck.push(...CookieJDs.filter(x => x.includes(encodeURIComponent(j))));
}
}
}
} else {
let pinarr = pin.split(',');
console.log(`\n❗已配置全部任务只执行pin: ${JSON.stringify(pinarr)}`);
for (let i of pinarr) {
i = decodeURIComponent(i);
runck.push(...CookieJDs.filter(x => x.includes(encodeURIComponent(i))));
}
}
if (runck.length > 0) {
CookieJDs = runck
}
} catch { }
}
console.log(`\n====================共${CookieJDs.length}个京东账号Cookie=================`);
console.log(`===========脚本执行时间:${formatdate(new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000))}============`);
console.log('>>>>>>>>>>>>6dylan6提醒您:有问题先更新不行在反馈>>>>>>>>>>>>>\n');
console.log(`Tips‼️青龙2.20.2以下版本不要外网访问,已被爆破可任意登录!必须要外网的就全新安装新版吧,升级不行\n`);
console.log('>>>>>>>>>>>>6dylan6提醒您:有问题先更新不行在反馈>>>>>>>>>>>>>');
console.log(`Tips每月到客户服务-在线客服发'火爆了',如出滑块就拼一下会解除一些活动火爆\n`);
for (let i = 0; i < CookieJDs.length; i++) {
if (!CookieJDs[i].match(/pt_pin=(.+?);/) || !CookieJDs[i].match(/pt_key=(.+?);/)) console.log(`\n提示:京东cookie 【${CookieJDs[i]}】填写不规范,可能会影响部分脚本正常使用。正确格式为: pt_key=xxx;pt_pin=xxx;(分号;不可少)\n`);
+7
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
+2608 -3
View File
File diff suppressed because one or more lines are too long
+3 -2
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
-6
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+12
View File
File diff suppressed because one or more lines are too long
+12
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+9
View File
File diff suppressed because one or more lines are too long
+12
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+18
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
View File
File diff suppressed because one or more lines are too long
+10
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
-8
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
#依赖安装
#0 8 5 5 * jd_indeps.sh
#new Env('依赖安装');
#updatedate:20240903
#
DIR="$( pwd )"
dir_root=/ql
dir_repo=$dir_root/repo
dir_deps=$dir_root/deps
if [[ $AUTOCFG == 'true' ]];then
if [[ -z "$(echo "$DIR"|grep 'main')" ]];then
dir_code=$dir_log/6dylan6_jdpro_jd_sharecode
repo='6dylan6_jdpro'
else
dir_code=$dir_log/6dylan6_jdpro_main_jd_sharecode
repo='6dylan6_jdpro_main'
fi
[[ -d $dir_root/data ]] && dir_data=$dir_root/data
[[ -d $dir_data/repo ]] && dir_repo=$dir_data/repo
[[ -d $dir_data/deps ]] && dir_deps=$dir_data/deps
cp $dir_repo/${repo}/sendNotify.js $dir_deps/ > /dev/null 2>&1
echo -e "\n已配置sendNotify.js文件到deps目录下,再次执行订阅生效\n"
else
echo -e "\n如需自动配置sendNotify.js文件到desp目录下,请配置变量AUTOCFG='true'\n"
fi
npm_ver=`pnpm -v|awk -F. '{print $1}'`
if [[ $npm_ver -ge 7 ]];then
export PNPM_HOME="/root/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"
fi
echo -e "安装本库所需依赖,不一定一次全部安装成功,完成请检查\n"
echo -e "开始安装............\n"
#apk add g++ make pixman-dev pango-dev cairo-dev pkgconf --no-cache
#apk add g++ make --no-cache
pnpm config set registry https://registry.npmmirror.com
pnpm install -g
pnpm i -g tough-cookie
pnpm i -g ds@2.0.2
pnpm i -g png-js@1.0.0
pnpm i -g date-fns@3.6.0
pnpm i -g axios@1.7.4
pnpm i -g crypto-js@4.2.0
# pnpm install -g ts-md5@1.3.1
# pnpm install -g tslib@2.6.3
# pnpm install -g @types/node@22.4.0
pnpm i -g request@2.88.2
pnpm i -g jsdom@24.1.1
pnpm i -g moment@2.30.1
pnpm i -g cheerio@1.0.0
pnpm i -g tunnel
# pnpm install -g tough-cookie@4.1.4
pnpm i -g https-proxy-agent@7.0.5
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ jieba
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ requests
rm -rf /usr/local/pnpm-global/5/node_modules/.pnpm/canvas*
rm -rf /root/.local/share/pnpm/global/5/.pnpm/canvas*
pnpm i -g sharp@0.32.0
echo -e "\n所需依赖安装完成,请检查有没有报错,可尝试再次运行"
+328
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
+9
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+8
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
+213
View File
File diff suppressed because one or more lines are too long
+179
View File
@@ -0,0 +1,179 @@
/*
京东快递
@Leaf
*/
const $ = new Env('京东快递');
const got = require('got');
const envSplitor = ['&','\n','@']
const ckNames = ['JD_COOKIE']
const MAX_THREAD = parseInt(process.env['jd_jdkd_thread']) || 5
const DEFAULT_TIMEOUT=8000, DEFAULT_RETRY=3;
const default_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.31(0x18001f2f) NetType/WIFI Language/zh_CN miniProgram/wx73247c7819d61796'
const Referer = 'https://jingcai-h5.jd.com/'
const Origin = 'https://jingcai-h5.jd.com'
const client = got.extend({
headers:{
Connection:'keep-alive',
'User-Agent': default_UA,
Referer,
Origin,
AppParams: JSON.stringify({"appid":158,"ticket_type":"m"}),
ClientInfo: JSON.stringify({"appName":"jingcai","client":"m"}),
'LOP-DN': 'jingcai.jd.com',
'X-Requested-With': 'XMLHttpRequest',
},
retry: {limit:0},
timeout: DEFAULT_TIMEOUT,
followRedirect: false,
})
class BasicClass{constructor(){this.index=$.userIdx++;this.name='';} log(msg,opt={}){var m='',n=$.userCount.toString().length;;if(this.index)m+=`账号[${$.padStr(this.index,n)}]`;if(this.name)m+=`[${this.name}]`;$.log(m+msg,opt);} async request(opt){var resp=null,count=0;var fn=opt.fn||opt.url;opt.method=opt?.method?.toUpperCase()||'GET';while(count++<DEFAULT_RETRY){try{await client(opt).then(t=>{resp=t},e=>{resp=e.response});if(((resp?.statusCode/100)|0)<=4)break;}catch(e){if(e.name=='TimeoutError'){this.log(`[${fn}]请求超时,重试第${count}`);}else{this.log(`[${fn}]请求错误(${e.message}),重试第${count}`);}};} if(resp==null)return Promise.resolve({statusCode:-1,headers:null,result:null});let{statusCode,headers,body}=resp;if(body)try{body=JSON.parse(body);}catch{};return Promise.resolve({statusCode,headers,result:body})}}
let http = new BasicClass();
class UserClass extends BasicClass {
constructor(ck) {
super()
this.cookie = ck
this.pt_pin = ck.match(/pin=([\w\-\%]+)/) ? ck.match(/pin=([\w\-\%]+)/)[1] : ''
this.name = decodeURIComponent(this.pt_pin)
}
async queryTaskList() {
try {
let options = {
fn: 'queryTaskList',
method: 'post',
url: 'https://lop-proxy.jd.com/ESGApi/queryTaskList',
headers: {Cookie:this.cookie,'event-id':$.randomPattern('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx')},
json: [{"pin":"$cooMrdGatewayUid$"}],
}
let {result} = await this.request(options)
let code = result?.code
if(code == 1) {
//console.log(JSON.stringify(result?.content?.taskInfoList))
for(let task of (result?.content?.taskInfoList||[]).filter(x => x.taskReachNum < x.taskNeedReachNum && x.triggerType==1 && !x.taskTitle.includes('加购'))) {
await this.reachTaskInfo(task);
await $.wait(1000);
break;
}
} else {
let errCode = code || result?.error_response?.code
let errMsg = result?.msg || result?.error_response?.zh_desc
this.log(`查询任务列表出错[${errCode}]: ${errMsg}`)
}
} catch (e) {
$.log(e)
} finally {
return Promise.resolve()
}
}
async reachTaskInfo(task) {
try {
let options = {
fn: 'reachTaskInfo',
method: 'post',
url: 'https://lop-proxy.jd.com/ESGApi/reachTaskInfo',
headers: {Cookie:this.cookie,'event-id':$.randomPattern('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx')},
json: [{
taskNo: task.taskNo,
childTaskId: task.childTaskId,
pin: "$cooMrdGatewayUid$",
}],
}
let {result} = await this.request(options)
let code = result?.code
if(code == 1) {
this.log(`完成任务[${task.taskTitle}]成功`);
await $.wait(1000);
await this.queryTaskList();
} else {
let errCode = code || result?.error_response?.code
let errMsg = result?.msg || result?.error_response?.zh_desc
this.log(`完成任务[${task.taskTitle}]失败[${errCode}]: ${errMsg}`)
}
} catch (e) {
$.log(e)
} finally {
return Promise.resolve()
}
}
async queryCanGetRewardTaskList() {
try {
let options = {
fn: 'queryCanGetRewardTaskList',
method: 'post',
url: 'https://lop-proxy.jd.com/ESGApi/queryCanGetRewardTaskList',
headers: {Cookie:this.cookie,'event-id':$.randomPattern('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx')},
json: [{"pin":"$cooMrdGatewayUid$"}],
}
let {result} = await this.request(options)
let code = result?.code
if(code == 1) {
for(let item of (result?.content?.personalCarbonRewardRespDtoList||[])) {
await this.operationPersonalCarbonIntegral(item)
}
} else {
let errCode = code || result?.error_response?.code
let errMsg = result?.msg || result?.error_response?.zh_desc
this.log(`查询可领取奖励出错[${errCode}]: ${errMsg}`)
}
} catch (e) {
$.log(e)
} finally {
return Promise.resolve()
}
}
async operationPersonalCarbonIntegral(item) {
try {
let options = {
fn: 'operationPersonalCarbonIntegral',
method: 'post',
url: 'https://lop-proxy.jd.com/ESGApi/operationPersonalCarbonIntegral',
headers: {Cookie:this.cookie,'event-id':$.randomPattern('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx')},
json: [{
type: 2,
operationType: 1,
rewardNo: item.rewardNo,
taskNo: item.taskNo,
pin: "$cooMrdGatewayUid$",
}],
}
let {result} = await this.request(options)
let code = result?.code
if(code == 1) {
this.log(`收取[${item.taskTitle}]奖励成功, 现在有${result?.content?.carbonIntegral}g能量`)
} else {
let errCode = code || result?.error_response?.code
let errMsg = result?.msg || result?.error_response?.zh_desc
this.log(`收取[${item.taskTitle}]奖励失败[${errCode}]: ${errMsg}`)
}
} catch (e) {
$.log(e)
} finally {
return Promise.resolve()
}
}
async userTask() {
await this.queryTaskList();
await this.queryCanGetRewardTaskList();
}
}
!(async () => {
$.read_env(UserClass);
await $.threadTask('userTask',MAX_THREAD)
})()
.catch((e) => $.log(e))
.finally(() => $.exitNow())
function Env(name){return new class{constructor(name){this.name=name;this.startTime=Date.now();this.log(`[${this.name}]开始运行\n`,{time:true});this.notifyStr=[];this.notifyFlag=true;this.userIdx=0;this.userList=[];this.userCount=0;} log(msg,options={}){let opt={console:true};Object.assign(opt,options);if(opt.time){let fmt=opt.fmt||'hh:mm:ss';msg=`[${this.time(fmt)}]`+msg;} if(opt.notify)this.notifyStr.push(msg);if(opt.console)console.log(msg);} read_env(Class){let envStrList=ckNames.map(x=>process.env[x]);for(let env_str of envStrList.filter(x=>!!x)){let sp=envSplitor.filter(x=>env_str.includes(x));let splitor=sp.length>0?sp[0]:envSplitor[0];for(let ck of env_str.split(splitor).filter(x=>!!x)){this.userList.push(new Class(ck));}} this.userCount=this.userList.length;if(!this.userCount){this.log(`未找到变量,请检查变量${ckNames.map(x => '['+x+']').join('或')}`,{notify:true});return false;} this.log(`共找到${this.userCount}个账号`);return true;} async threads(taskName,conf,opt={}){while(conf.idx<$.userList.length){let user=$.userList[conf.idx++];await user[taskName](opt);}} async threadTask(taskName,thread){let taskAll=[];let taskConf={idx:0};while(thread--)taskAll.push(this.threads(taskName,taskConf));await Promise.all(taskAll);} time(t,x=null){let xt=x?new Date(x):new Date;let e={"M+":xt.getMonth()+1,"d+":xt.getDate(),"h+":xt.getHours(),"m+":xt.getMinutes(),"s+":xt.getSeconds(),"q+":Math.floor((xt.getMonth()+3)/3),S:this.padStr(xt.getMilliseconds(),3)};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(xt.getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t;} async showmsg(){if(!this.notifyFlag)return;if(!this.notifyStr.length)return;var notify=require('./sendNotify');this.log('\n============== 推送 ==============');await notify.sendNotify(this.name,this.notifyStr.join('\n'));} padStr(num,length,opt={}){let padding=opt.padding||'0';let mode=opt.mode||'l';let numStr=String(num);let numPad=(length>numStr.length)?(length-numStr.length):0;let pads='';for(let i=0;i<numPad;i++){pads+=padding;} if(mode=='r'){numStr=numStr+pads;}else{numStr=pads+numStr;} return numStr;} json2str(obj,c,encode=false){let ret=[];for(let keys of Object.keys(obj).sort()){let v=obj[keys];if(v&&encode)v=encodeURIComponent(v);ret.push(keys+'='+v);} return ret.join(c);} str2json(str,decode=false){let ret={};for(let item of str.split('&')){if(!item)continue;let idx=item.indexOf('=');if(idx==-1)continue;let k=item.substr(0,idx);let v=item.substr(idx+1);if(decode)v=decodeURIComponent(v);ret[k]=v;} return ret;} randomPattern(pattern,charset='abcdef0123456789'){let str='';for(let chars of pattern){if(chars=='x'){str+=charset.charAt(Math.floor(Math.random()*charset.length));}else if(chars=='X'){str+=charset.charAt(Math.floor(Math.random()*charset.length)).toUpperCase();}else{str+=chars;}} return str;} randomString(len,charset='abcdef0123456789'){let str='';for(let i=0;i<len;i++){str+=charset.charAt(Math.floor(Math.random()*charset.length));} return str;} randomList(a){let idx=Math.floor(Math.random()*a.length);return a[idx];} wait(t){return new Promise(e=>setTimeout(e,t));} async exitNow(){await this.showmsg();let e=Date.now();let s=(e-this.startTime)/1000;this.log('');this.log(`[${this.name}]运行结束,共运行了${s}`,{time:true});process.exit(0);}} (name)}
-7
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
-6
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3 -3
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
+15 -7
View File
File diff suppressed because one or more lines are too long
-6
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
-6
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
+16
View File
File diff suppressed because one or more lines are too long
+8
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+216
View File
File diff suppressed because one or more lines are too long
-6
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+8
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
+19
View File
File diff suppressed because one or more lines are too long
+11
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+8
View File
File diff suppressed because one or more lines are too long
+25
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -24,9 +24,9 @@ else
repo='6dylan6_jdpro_main'
fi
grep '6dylan6_20240905' /ql/data/config/task_before.sh >/dev/null 2>&1 || grep '6dylan6_20240905' /ql/config/task_before.sh > /dev/null 2>&1
#if [[ $? != 0 ]];then
if [[ $? != 0 ]];then
#cp /ql/repo/${repo}/docker/task_before.sh /ql/config/ >/dev/null 2>&1 || cp /ql/data/repo/${repo}/docker/task_before.sh /ql/data/config/ > /dev/null 2>&1
#fi
fi
[[ $QL_DIR == /ql ]] && dir_root=$QL_DIR
[[ -d $dir_root/data ]] && dir_data=$dir_root/data
[[ -d $dir_data/config ]] && dir_config=$dir_data/config

Some files were not shown because too many files have changed in this diff Show More