Skip to content

Commit b336ab5

Browse files
committed
perf:ddsy.js update
优化整体流程代码
1 parent 32cdacc commit b336ab5

4 files changed

Lines changed: 155 additions & 637 deletions

File tree

‎daily/chery.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ cron: 8 30 * * *
77
------------------------------------------
88
#Notice:
99
APP 抓包的登录接口uaa2c.chery.cn 里面的返回的access_token就是环境变量需要的token,多个账号换行或者&
10-
11-
10+
自助获取变量
11+
https://logintools.smallfawn.top/chery.html
1212
⚠️【免责声明】
1313
------------------------------------------
1414
1、此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。
@@ -20,7 +20,7 @@ APP 抓包的登录接口uaa2c.chery.cn 里面的返回的access_token就是环
2020
7、所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明。本人保留随时更改或补充此声明的权利。一旦您使用或复制了此脚本,即视为您已接受此免责声明。
2121
*/
2222

23-
const { Env } = require("./tools/env")
23+
const { Env } = require("../tools/env")
2424
const $ = new Env("奇瑞汽车");
2525
let ckName = `chery`;
2626
const strSplitor = "#";

‎daily/ddsy.js‎

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
/*
2+
------------------------------------------
3+
@Author: sm
4+
@Date: 2024.06.07 19:15
5+
@Description: ddky
6+
cron: 9 30 * * *
7+
------------------------------------------
8+
#Notice:
9+
变量值:https://hapi.ddky.com/mcp/weixin/rest.htm?后面的loginToken&userId&uDate 多账户换行或者&分隔
10+
网页版登录 https://m.ddky.com/
11+
小程序登录叮当快药
12+
APP 都可以找到这三个值
13+
⚠️【免责声明】
14+
------------------------------------------
15+
1、此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。
16+
2、由于此脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。
17+
3、请勿将此脚本用于任何商业或非法目的,若违反规定请自行对此负责。
18+
4、此脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。
19+
5、本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。
20+
6、如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。
21+
7、所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明。本人保留随时更改或补充此声明的权利。一旦您使用或复制了此脚本,即视为您已接受此免责声明。
22+
*/
23+
24+
const { Env } = require("./tools/env")
25+
const $ = new Env("叮当快药");
26+
let ckName = `ddky`;
27+
const strSplitor = "#";
28+
const axios = require("axios");
29+
const defaultUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.31(0x18001e31) NetType/WIFI Language/zh_CN miniProgram"
30+
31+
32+
class Task {
33+
constructor(env) {
34+
this.index = $.userIdx++
35+
this.token = env.split(strSplitor)[0]; //单账号多变量分隔符
36+
37+
this.userId = env.split(strSplitor)[1];
38+
this.uDate = env.split(strSplitor)[2];
39+
40+
}
41+
42+
async run() {
43+
44+
await this.getSignInId()
45+
}
46+
47+
getSign(s) {
48+
const crypto = require("crypto");//SIGN TYPE 1是签到 2是补签
49+
return crypto.createHash('md5').update(s).digest('hex');
50+
}
51+
getTime() {
52+
var now = new Date();
53+
var year = now.getFullYear()
54+
, month = now.getMonth() + 1
55+
, day = now.getDate()
56+
, hours = now.getHours()
57+
, minutes = now.getMinutes()
58+
, seconds = now.getSeconds();
59+
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
60+
}
61+
getSignDay() {
62+
var now = new Date();
63+
var year = now.getFullYear()
64+
, month = now.getMonth() + 1
65+
, day = now.getDate()
66+
return year + '-' + month + '-' + day
67+
}
68+
async getSignInId() {
69+
const time = this.getTime()
70+
const method = `ddky.promotion.signin.pageinfo`
71+
const signDay = this.getSignDay()
72+
const str = method +
73+
`loginToken${this.token}` +
74+
`method${method}` +
75+
`platH5` +
76+
`platformH5` +
77+
`signDay${signDay}` +
78+
`t${time}` +
79+
`uDate${this.uDate}` +
80+
`userId${this.userId}` +
81+
`v1.0` +
82+
`versionName4.9.0` +
83+
`6C57AB91A1308E26B797F4CD382AC79D`
84+
let sign = (this.getSign(str)).toUpperCase();
85+
let callbackStr = new Date().getTime()
86+
try {
87+
let options = {
88+
url: `https://hapi.ddky.com/mcp/weixin/rest.htm?sign=${sign}&loginToken=${this.token}&method=${method}&plat=H5&platform=H5&signDay=${signDay}&t=${time}&uDate=${this.uDate}&userId=${this.userId}&v=1.0&versionName=4.9.0&callback=Zepto${callbackStr}`,
89+
headers: {},
90+
}
91+
let { data: response } = await axios.request(options);
92+
let result = response.replace(`Zepto${callbackStr}`, "")
93+
result = result.replaceAll("(", "")
94+
result = result.replaceAll(")", "")
95+
result = JSON.parse(result)
96+
if (result.code = "0") {
97+
await this.user_info(result.result.signDayVo.signinId)
98+
}
99+
100+
} catch (e) {
101+
console.log(e);
102+
}
103+
}
104+
async user_info(signInId) {
105+
let callbackStr = new Date().getTime()
106+
const time = this.getTime()
107+
const str = `ddky.promotion.signin.sign` + `channelH5` + `laterSignType1` + `loginToken${this.token}` + `methodddky.promotion.signin.sign` +
108+
`platH5` + `platformH5` + `signinId${signInId}` + `t${time}` + `uDate${this.uDate}` + `userId${this.userId}` + `v1.0` + `versionName4.9.0` +
109+
`6C57AB91A1308E26B797F4CD382AC79D`
110+
let sign = (this.getSign(str)).toUpperCase();
111+
try {
112+
let options = {
113+
url: `https://hapi.ddky.com/mcp/weixin/rest.htm?sign=${sign}&channel=H5&laterSignType=1&loginToken=${this.token}&method=ddky.promotion.signin.sign&plat=H5&platform=H5&signinId=${signInId}&t=${time}&uDate=${this.uDate}&userId=${this.userId}&v=1.0&versionName=4.9.0&callback=Zepto${callbackStr}`,
114+
headers: {},
115+
}
116+
let { data: response } = await axios.request(options);
117+
console.log(response);
118+
} catch (e) {
119+
console.log(e);
120+
}
121+
}
122+
123+
124+
125+
126+
127+
128+
129+
}
130+
131+
!(async () => {
132+
await getNotice()
133+
$.checkEnv(ckName);
134+
135+
for (let user of $.userList) {
136+
await new Task(user).run();
137+
}
138+
})()
139+
.catch((e) => console.log(e))
140+
.finally(() => $.done());
141+
142+
async function getNotice() {
143+
let options = {
144+
url: `https://ghproxy.net/https://raw.githubusercontent.com/smallfawn/Note/refs/heads/main/Notice.json`,
145+
headers: {
146+
"User-Agent": defaultUserAgent,
147+
}
148+
}
149+
let { data: res } = await axios.request(options);
150+
$.log(res)
151+
return res
152+
}

0 commit comments

Comments
 (0)