mirror of
https://github.com/smallfawn/QLScriptPublic.git
synced 2026-11-05 22:36:53 +08:00
fix(del some script): del some script
This commit is contained in:
1 parent
90186664a6
commit
4b1e357630
4 files changed
+10
-1436
No files matched your search
@@ -1,821 +0,0 @@
|
||||
/**
|
||||
* cron 20 8 * * *
|
||||
* Show:滴滴领券&果园 暂时每天一次
|
||||
* 变量名:didi
|
||||
* 注意:微信小程序和APP的token同样可用 搜不到关键词就搜token
|
||||
* 变量值:https://api.didi.cn 抓域名中 请求体*(body) city_id 中的 和请求头Headers中的Didi-Ticket
|
||||
* 注意 ut.xiaojukeji.com 请求体中的token和Didi-Ticket是一样的 都可以抓 找不到可以放大镜搜索
|
||||
* 有BUG记得反馈 果园入口 微信打开 http://www.yuban.ltd/wx/?id=20240322215239111024747
|
||||
* 正确格式 Didi-Ticket # city_id
|
||||
* scriptVersionNow = "0.0.1";
|
||||
*/
|
||||
|
||||
const $ = new Env("滴滴领券&果园");
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
let ckName = "didi";
|
||||
let envSplitor = ["&", "\n"]; //多账号分隔符
|
||||
let strSplitor = "#"; //多变量分隔符
|
||||
let userIdx = 0;
|
||||
let userList = [];
|
||||
class Task {
|
||||
constructor(str) {
|
||||
this.index = ++userIdx;
|
||||
this.ck = str.split(strSplitor)[0]; //单账号多变量分隔符
|
||||
this.ckStatus = true;
|
||||
this.couponsBindList = []
|
||||
this.waterNum = 0;
|
||||
this.city_id = Number(str.split(strSplitor)[1]);
|
||||
}
|
||||
async main() {
|
||||
await this.productInit();
|
||||
await this.sign_do()
|
||||
await this.doLottery()
|
||||
for (let i of this.couponsBindList) {
|
||||
await this.coupon_bind(i.activity_id, i.group_id, i.coupon_conf_id)
|
||||
}
|
||||
await this.do_group()
|
||||
await this.mission_get()
|
||||
await this.plant_sign()
|
||||
await this.plant_newEnter()
|
||||
if (this.waterNum > 10) {
|
||||
for (let i = 0; i < (this.waterNum / 10); i++) {
|
||||
await this.plant_newWatering()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
async taskRequest(method, url, body = "") {
|
||||
//
|
||||
let headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Didi-Ticket': this.ck,
|
||||
}
|
||||
const reqeuestOptions = {
|
||||
url: url,
|
||||
method: method,
|
||||
headers: headers,
|
||||
}
|
||||
body == "" ? "" : Object.assign(reqeuestOptions, { body: body })
|
||||
let { body: result } = await $.httpRequest(reqeuestOptions)
|
||||
return result
|
||||
}
|
||||
|
||||
async productInit() {
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://api.didi.cn/webx/v3/productInit`, JSON.stringify({
|
||||
"city_id": this.city_id,
|
||||
"dchn": "YYPDp7e",
|
||||
"args": {
|
||||
"runtime_args": {
|
||||
"Didi-Ticket": this.ck,
|
||||
}
|
||||
},
|
||||
}))
|
||||
if (result.errno == 0) {
|
||||
//
|
||||
$.log(`✅账号[${this.index}]-初始化活动信息成功🎉`)
|
||||
let tmpArr = result.data.conf.strategy_data.daily_info.daily_coupon.coupons
|
||||
let tmpArr2 = result.data.conf.strategy_data.sec_kill_info.seckill
|
||||
// $.log(`本次共可领取[${tmpArr.length}]张每日精选券`)
|
||||
for (let i of tmpArr2) {
|
||||
if (i.status == 3) {
|
||||
//过去
|
||||
} else if (i.status == 1) {
|
||||
//当前
|
||||
for (let j of i.coupons) {
|
||||
//console.log(j)
|
||||
if (j.status == 1) {
|
||||
//console.log(j)
|
||||
this.couponsBindList.push({ activity_id: j.activity_id, group_id: j.group_id, coupon_conf_id: j.coupon_conf_id })
|
||||
}
|
||||
}
|
||||
} else if (i.status == 2) {
|
||||
//将来
|
||||
}
|
||||
}
|
||||
for (let i of tmpArr) {
|
||||
if (i.status == 1) {
|
||||
//console.log(i)
|
||||
this.couponsBindList.push({ activity_id: i.activity_id, group_id: i.group_id, coupon_conf_id: i.coupon_conf_id })
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async doLottery() {
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://ut.xiaojukeji.com/ut/janitor/api/action/lottery/doLottery`, JSON.stringify({
|
||||
"act_id": "217533998314",
|
||||
"city_id": this.city_id
|
||||
}))
|
||||
//console.log(options);
|
||||
//console.log(JSON.stringify(result));
|
||||
if (result.errno == 0) {
|
||||
//console.log(`✅账号[${this.index}] 欢迎用户: ${result.errcode}🎉`);
|
||||
$.log(`✅账号[${this.index}]-抽奖成功-[${result.data.prize_data[0].name}]🎉`)
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-抽奖失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async coupon_bind(activity_id, group_id, coupon_conf_id) {
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://ut.xiaojukeji.com/ut/janitor/api/action/coupon/bind`, JSON.stringify({
|
||||
"activity_id": activity_id,
|
||||
"group_id": group_id,
|
||||
"coupon_conf_id": coupon_conf_id,
|
||||
"city_id": this.city_id
|
||||
}))
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
$.log(`✅账号[${this.index}]-时间段领券成功-[${result.data.name}]🎉`)
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-时间段领券失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async do_group() {
|
||||
try {
|
||||
let body = {
|
||||
"prod_key": "integrated-marketing-award",
|
||||
"token": this.ck,
|
||||
"xak": "integrated-marketing-award-D5LYBz4SGgg4",
|
||||
"city_id": this.city_id
|
||||
}
|
||||
let result = await this.taskRequest("post", `https://ut.xiaojukeji.com/ut/active_brick/api/v1/award/do_group?wsgsig=${this.get_wsgsig(body)}`, JSON.stringify(body))
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
let awardArr = []
|
||||
for (let i of result.data.details) {
|
||||
for (let j of i.rewards) {
|
||||
awardArr.push(j.info[0].coupon_name)
|
||||
}
|
||||
}
|
||||
$.log(`✅账号[${this.index}]-每日领券成功-[${awardArr}]🎉`)
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-每日领券失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
$.log(`❌账号[${this.index}]-领券失败-[501报错 - 测试版]`);
|
||||
}
|
||||
}
|
||||
async sign_do() {
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://ut.xiaojukeji.com/ut/janitor/api/action/sign/do`, JSON.stringify({
|
||||
//"activity_id": "217534045313",
|
||||
}))
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
//console.log(`✅账号[${this.index}] 欢迎用户: ${result.errcode}🎉`);
|
||||
$.log(`✅账号[${this.index}]-签到成功-[]🎉`)
|
||||
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-签到失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async plant_newEnter() {
|
||||
let body = {
|
||||
platform: 1,
|
||||
game_id: 23,
|
||||
token:
|
||||
this.ck
|
||||
};
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://game.xiaojukeji.com/api/game/plant/newEnter?wsgsig=${this.get_wsgsig(body)}`, JSON.stringify(body))
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
$.log(`✅账号[${this.index}]-果园信息获取成功-[${result.data.tree_info.pack_water}💧 ${result.data.tree_info.tree_progress}%]🎉`)
|
||||
this.waterNum = Number(result.data.tree_info.pack_water);
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-果园信息获取失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async mission_award(mission_id) {
|
||||
let body = {
|
||||
mission_id: mission_id,
|
||||
game_id: 23,
|
||||
platform: 1,
|
||||
token:
|
||||
this.ck,
|
||||
}
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://game.xiaojukeji.com/api/game/mission/award?wsgsig=${this.get_wsgsig(body)}`, JSON.stringify(body))
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
$.log(`✅账号[${this.index}]-领取果园奖励成功-[${result.data.reward[0].count}/${result.data.reward[0].name}]🎉`)
|
||||
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-领取果园奖励失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async mission_get() {
|
||||
try {
|
||||
let result = await this.taskRequest("get", `https://game.xiaojukeji.com/api/game/mission/get?game_id=23&token=${this.ck}`)
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
for (let i of result.data.missions) {
|
||||
if (i.type == 1) {
|
||||
if (i.status == 0 && i.target == 1) {
|
||||
await this.mission_update(i.id)
|
||||
}
|
||||
if (i.status == 2) {
|
||||
await this.mission_award(i.id)
|
||||
}
|
||||
} else if (i.type == 2) {
|
||||
|
||||
} else if (i.type == 5) {
|
||||
await this.mission_subscribe(i.id)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-果园初始化失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async mission_update(mission_id) {
|
||||
let body = {
|
||||
mission_id: mission_id,
|
||||
game_id: 23,
|
||||
platform: 1,
|
||||
token:
|
||||
this.ck,
|
||||
}
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://game.xiaojukeji.com/api/game/mission/update?wsgsig=${this.get_wsgsig(body)}`, JSON.stringify(body))
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
$.log(`✅账号[${this.index}]-上传任务状态成功-[${result.errmsg}]🎉`)
|
||||
await this.mission_award(mission_id)
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-上传任务状态失败-[${result.errmsg, mission_id}] `);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async mission_subscribe(id) {
|
||||
let body = {
|
||||
status: true,
|
||||
game_id: 23,
|
||||
platform: 1,
|
||||
token:
|
||||
this.ck,
|
||||
};
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://game.xiaojukeji.com/api/game/subscribe?wsgsig=${this.get_wsgsig(body)}`, JSON.stringify(body))
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
$.log(`✅账号[${this.index}]-上传任务状态成功-[${result.errmsg}]🎉`)
|
||||
await this.mission_award(id)
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-上传任务状态失败-[${result.errmsg, mission_id}] `);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async plant_sign() {
|
||||
try {
|
||||
let body = {
|
||||
platform: 1,
|
||||
game_id: 23,
|
||||
token:
|
||||
this.ck,
|
||||
}
|
||||
let result = await this.taskRequest("post", `https://game.xiaojukeji.com/api/game/plant/sign?wsgsig=${this.get_wsgsig(body)}`, JSON.stringify(body))
|
||||
// console.log("post", `https://game.xiaojukeji.com/api/game/plant/sign?wsgsig=${this.get_wsgsig(body)}`, JSON.stringify(body));
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
$.log(`✅账号[${this.index}]-果园签到成功-[${result.errmsg}]🎉`)
|
||||
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-果园签到失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async plant_newWatering() {
|
||||
let body = {
|
||||
platform: 1,
|
||||
game_id: 23,
|
||||
token:
|
||||
this.ck,
|
||||
}
|
||||
try {
|
||||
let result = await this.taskRequest("post", `https://game.xiaojukeji.com/api/game/plant/newWatering?wsgsig=${this.get_wsgsig(body)}`, JSON.stringify(body))
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.errno == 0) {
|
||||
$.log(`✅账号[${this.index}]-浇水成功-[${result.data.tree_progress}%]🎉`)
|
||||
|
||||
} else {
|
||||
$.log(`❌账号[${this.index}]-浇水失败-[${result.errmsg}]`);
|
||||
//console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
get_wsgsig(OO) {
|
||||
OO = JSON.stringify(OO);
|
||||
function c(t) {
|
||||
for (var e = t.length, n = t.length - 1; n >= 0; n--) {
|
||||
var r = t.charCodeAt(n);
|
||||
r > 127 && r <= 2047 ? e++ : r > 2047 && r <= 65535 && (e += 2),
|
||||
r >= 56320 && r <= 57343 && n--;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
function r(t) {
|
||||
for (
|
||||
var e =
|
||||
"ABCDEFG0123456789abcdefgHIJKLMN+/hijklmnOPQRSTopqrstUVWXYZuvwxyz",
|
||||
n = "" + t,
|
||||
r = void 0,
|
||||
o = void 0,
|
||||
i = 0,
|
||||
u = "";
|
||||
n.charAt(0 | i) || ((e = "="), i % 1);
|
||||
u += e.charAt(63 & (r >> (8 - (i % 1) * 8)))
|
||||
) {
|
||||
if ((o = n.charCodeAt((i += 0.75))) > 255)
|
||||
throw new Error(
|
||||
"'base64' failed: The string to be encoded contains characters outside of the Latin1 range."
|
||||
);
|
||||
r = (r << 8) | o;
|
||||
}
|
||||
return u;
|
||||
}
|
||||
function o(t, e) {
|
||||
for (var n = [], r = 0; r < e.length; r++)
|
||||
n[r] = t[r % 4] ^ e.charCodeAt(r);
|
||||
return (
|
||||
(n = Array.prototype.slice.apply(t).concat(n)),
|
||||
String.fromCharCode.apply(null, n)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//D参数为提交的param
|
||||
function en(T) {
|
||||
return (
|
||||
"dd03-" +
|
||||
r(
|
||||
o(
|
||||
new Uint8Array(
|
||||
new Uint32Array([
|
||||
Math.floor(4294967296 * Math.random()),
|
||||
]).buffer
|
||||
),
|
||||
T
|
||||
)
|
||||
).replace(/=*$/, "")
|
||||
);
|
||||
}
|
||||
function MD5(data) {
|
||||
const crypto = require("crypto");
|
||||
return crypto.createHash("md5").update(data).digest("hex");
|
||||
}
|
||||
let time = Math.floor(new Date() / 1e3)
|
||||
return en('ts=' + time + '&v=1&os=web&av=02&kv=0000010001&vl=' + c(OO) + '&sig=' + MD5("R4doMFFeMNlliIWM" + OO))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
!(async () => {
|
||||
if (!(await checkEnv())) return;
|
||||
if (userList.length > 0) {
|
||||
let taskall = [];
|
||||
for (let user of userList) {
|
||||
if (user.ckStatus) {
|
||||
taskall.push(user.main());
|
||||
}
|
||||
}
|
||||
await Promise.all(taskall);
|
||||
}
|
||||
await $.sendMsg($.logs.join("\n"))
|
||||
})()
|
||||
.catch((e) => console.log(e))
|
||||
.finally(() => $.done());
|
||||
|
||||
//********************************************************
|
||||
/**
|
||||
* 变量检查与处理
|
||||
* @returns
|
||||
*/
|
||||
async function checkEnv() {
|
||||
let userCookie = ($.isNode() ? process.env[ckName] : $.getdata(ckName)) || "";
|
||||
if (userCookie) {
|
||||
let e = envSplitor[0];
|
||||
for (let o of envSplitor)
|
||||
if (userCookie.indexOf(o) > -1) {
|
||||
e = o;
|
||||
break;
|
||||
}
|
||||
for (let n of userCookie.split(e)) n && userList.push(new Task(n));
|
||||
} else {
|
||||
console.log(`未找到CK【${ckName}】`);
|
||||
return;
|
||||
}
|
||||
return console.log(`共找到${userList.length}个账号`), true; //true == !0
|
||||
}
|
||||
function Env(t, s) {
|
||||
return new (class {
|
||||
constructor(t, s) {
|
||||
this.name = t;
|
||||
this.data = null;
|
||||
this.dataFile = "box.dat";
|
||||
this.logs = [];
|
||||
this.logSeparator = "\n";
|
||||
this.startTime = new Date().getTime();
|
||||
Object.assign(this, s);
|
||||
this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`);
|
||||
}
|
||||
isNode() {
|
||||
return "undefined" != typeof module && !!module.exports;
|
||||
}
|
||||
isQuanX() {
|
||||
return "undefined" != typeof $task;
|
||||
}
|
||||
isSurge() {
|
||||
return "undefined" != typeof $httpClient && "undefined" == typeof $loon;
|
||||
}
|
||||
isLoon() {
|
||||
return "undefined" != typeof $loon;
|
||||
}
|
||||
loaddata() {
|
||||
if (!this.isNode()) return {};
|
||||
{
|
||||
this.fs = this.fs ? this.fs : require("fs");
|
||||
this.path = this.path ? this.path : require("path");
|
||||
const t = this.path.resolve(this.dataFile),
|
||||
s = this.path.resolve(process.cwd(), this.dataFile),
|
||||
e = this.fs.existsSync(t),
|
||||
i = !e && this.fs.existsSync(s);
|
||||
if (!e && !i) return {};
|
||||
{
|
||||
const i = e ? t : s;
|
||||
try {
|
||||
return JSON.parse(this.fs.readFileSync(i));
|
||||
} catch (t) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
writedata() {
|
||||
if (this.isNode()) {
|
||||
this.fs = this.fs ? this.fs : require("fs");
|
||||
this.path = this.path ? this.path : require("path");
|
||||
const t = this.path.resolve(this.dataFile),
|
||||
s = this.path.resolve(process.cwd(), this.dataFile),
|
||||
e = this.fs.existsSync(t),
|
||||
i = !e && this.fs.existsSync(s),
|
||||
o = JSON.stringify(this.data);
|
||||
e ? this.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o);
|
||||
}
|
||||
}
|
||||
lodash_get(t, s, e) {
|
||||
const i = s.replace(/\[(\d+)\]/g, ".$1").split(".");
|
||||
let o = t;
|
||||
for (const t of i) if (((o = Object(o)[t]), void 0 === o)) return e;
|
||||
return o;
|
||||
}
|
||||
lodash_set(t, s, e) {
|
||||
return Object(t) !== t
|
||||
? t
|
||||
: (Array.isArray(s) || (s = s.toString().match(/[^.[\]]+/g) || []),
|
||||
(s
|
||||
.slice(0, -1)
|
||||
.reduce(
|
||||
(t, e, i) =>
|
||||
Object(t[e]) === t[e]
|
||||
? t[e]
|
||||
: (t[e] = Math.abs(s[i + 1]) >> 0 == +s[i + 1] ? [] : {}),
|
||||
t
|
||||
)[s[s.length - 1]] = e),
|
||||
t);
|
||||
}
|
||||
getdata(t) {
|
||||
let s = this.getval(t);
|
||||
if (/^@/.test(t)) {
|
||||
const [, e, i] = /^@(.*?)\.(.*?)$/.exec(t),
|
||||
o = e ? this.getval(e) : "";
|
||||
if (o)
|
||||
try {
|
||||
const t = JSON.parse(o);
|
||||
s = t ? this.lodash_get(t, i, "") : s;
|
||||
} catch (t) {
|
||||
s = "";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
setdata(t, s) {
|
||||
let e = !1;
|
||||
if (/^@/.test(s)) {
|
||||
const [, i, o] = /^@(.*?)\.(.*?)$/.exec(s),
|
||||
h = this.getval(i),
|
||||
a = i ? ("null" === h ? null : h || "{}") : "{}";
|
||||
try {
|
||||
const s = JSON.parse(a);
|
||||
this.lodash_set(s, o, t), (e = this.setval(JSON.stringify(s), i));
|
||||
} catch (s) {
|
||||
const h = {};
|
||||
this.lodash_set(h, o, t), (e = this.setval(JSON.stringify(h), i));
|
||||
}
|
||||
} else e = this.setval(t, s);
|
||||
return e;
|
||||
}
|
||||
getval(t) {
|
||||
if (this.isSurge() || this.isLoon()) {
|
||||
return $persistentStore.read(t);
|
||||
} else if (this.isQuanX()) {
|
||||
return $prefs.valueForKey(t);
|
||||
} else if (this.isNode()) {
|
||||
this.data = this.loaddata();
|
||||
return this.data[t];
|
||||
} else {
|
||||
return this.data && this.data[t] || null;
|
||||
}
|
||||
}
|
||||
setval(t, s) {
|
||||
if (this.isSurge() || this.isLoon()) {
|
||||
return $persistentStore.write(t, s);
|
||||
} else if (this.isQuanX()) {
|
||||
return $prefs.setValueForKey(t, s);
|
||||
} else if (this.isNode()) {
|
||||
this.data = this.loaddata();
|
||||
this.data[s] = t;
|
||||
this.writedata();
|
||||
return true;
|
||||
} else {
|
||||
return this.data && this.data[s] || null;
|
||||
}
|
||||
}
|
||||
initGotEnv(t) {
|
||||
this.got = this.got ? this.got : require("got");
|
||||
this.cktough = this.cktough ? this.cktough : require("tough-cookie");
|
||||
this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar();
|
||||
if (t) {
|
||||
t.headers = t.headers ? t.headers : {};
|
||||
if (typeof t.headers.Cookie === "undefined" && typeof t.cookieJar === "undefined") {
|
||||
t.cookieJar = this.ckjar;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {Object} options
|
||||
* @returns {String} 将 Object 对象 转换成 queryStr: key=val&name=senku
|
||||
*/
|
||||
queryStr(options) {
|
||||
return Object.entries(options)
|
||||
.map(([key, value]) => `${key}=${typeof value === 'object' ? JSON.stringify(value) : value}`)
|
||||
.join('&');
|
||||
}
|
||||
//从url获取参数组成json
|
||||
getURLParams(url) {
|
||||
const params = {};
|
||||
const queryString = url.split('?')[1];
|
||||
if (queryString) {
|
||||
const paramPairs = queryString.split('&');
|
||||
paramPairs.forEach(pair => {
|
||||
const [key, value] = pair.split('=');
|
||||
params[key] = value;
|
||||
});
|
||||
}
|
||||
return params;
|
||||
}
|
||||
isJSONString(str) {
|
||||
try {
|
||||
var obj = JSON.parse(str);
|
||||
if (typeof obj == 'object' && obj) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
isJson(obj) {
|
||||
var isjson = typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length;
|
||||
return isjson;
|
||||
}
|
||||
async sendMsg(message) {
|
||||
if (!message) return;
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify($.name, message)
|
||||
} else {
|
||||
$.msg($.name, '', message)
|
||||
}
|
||||
}
|
||||
async httpRequest(options) {
|
||||
let t = {
|
||||
...options
|
||||
};
|
||||
if (!t.headers) {
|
||||
t.headers = {}
|
||||
}
|
||||
if (t.params) {
|
||||
t.url += '?' + this.queryStr(t.params);
|
||||
}
|
||||
t.method = t.method.toLowerCase();
|
||||
if (t.method === 'get') {
|
||||
delete t.headers['Content-Type'];
|
||||
delete t.headers['Content-Length'];
|
||||
delete t.headers['content-type'];
|
||||
delete t.headers['content-length'];
|
||||
delete t["body"]
|
||||
}
|
||||
if (t.method === 'post') {
|
||||
let ContentType;
|
||||
if (!t.body) {
|
||||
t.body = ""
|
||||
} else {
|
||||
if (typeof t.body == "string") {
|
||||
if (this.isJSONString(t.body)) {
|
||||
ContentType = 'application/json'
|
||||
} else {
|
||||
ContentType = 'application/x-www-form-urlencoded'
|
||||
}
|
||||
} else if (this.isJson(t.body)) {
|
||||
t.body = JSON.stringify(t.body);
|
||||
ContentType = 'application/json';
|
||||
}
|
||||
}
|
||||
if (!t.headers['Content-Type'] || !t.headers['content-type']) {
|
||||
t.headers['Content-Type'] = ContentType;
|
||||
}
|
||||
delete t.headers['Content-Length'];
|
||||
}
|
||||
if (this.isNode()) {
|
||||
this.initGotEnv(t);
|
||||
let httpResult = await this.got(t);
|
||||
if (this.isJSONString(httpResult.body)) {
|
||||
httpResult.body = JSON.parse(httpResult.body)
|
||||
}
|
||||
return httpResult;
|
||||
}
|
||||
if (this.isQuanX()) {
|
||||
t.method = t.method.toUpperCase()
|
||||
return new Promise((resolve, reject) => {
|
||||
$task.fetch(t).then(response => {
|
||||
if (this.isJSONString(response.body)) {
|
||||
response.body = JSON.parse(response.body)
|
||||
}
|
||||
resolve(response)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
randomNumber(length) {
|
||||
const characters = '0123456789';
|
||||
return Array.from({ length }, () => characters[Math.floor(Math.random() * characters.length)]).join('');
|
||||
}
|
||||
randomString(length) {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
return Array.from({ length }, () => characters[Math.floor(Math.random() * characters.length)]).join('');
|
||||
}
|
||||
timeStamp() {
|
||||
return new Date().getTime()
|
||||
}
|
||||
uuid() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0,
|
||||
v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
time(t) {
|
||||
let s = {
|
||||
"M+": new Date().getMonth() + 1,
|
||||
"d+": new Date().getDate(),
|
||||
"H+": new Date().getHours(),
|
||||
"m+": new Date().getMinutes(),
|
||||
"s+": new Date().getSeconds(),
|
||||
"q+": Math.floor((new Date().getMonth() + 3) / 3),
|
||||
S: new Date().getMilliseconds(),
|
||||
};
|
||||
/(y+)/.test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
(new Date().getFullYear() + "").substr(4 - RegExp.$1.length)
|
||||
));
|
||||
for (let e in s)
|
||||
new RegExp("(" + e + ")").test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
1 == RegExp.$1.length
|
||||
? s[e]
|
||||
: ("00" + s[e]).substr(("" + s[e]).length)
|
||||
));
|
||||
return t;
|
||||
}
|
||||
msg(s = t, e = "", i = "", o) {
|
||||
const h = (t) =>
|
||||
!t || (!this.isLoon() && this.isSurge())
|
||||
? t
|
||||
: "string" == typeof t
|
||||
? this.isLoon()
|
||||
? t
|
||||
: this.isQuanX()
|
||||
? { "open-url": t }
|
||||
: void 0
|
||||
: "object" == typeof t && (t["open-url"] || t["media-url"])
|
||||
? this.isLoon()
|
||||
? t["open-url"]
|
||||
: this.isQuanX()
|
||||
? t
|
||||
: void 0
|
||||
: void 0;
|
||||
this.isMute ||
|
||||
(this.isSurge() || this.isLoon()
|
||||
? $notification.post(s, e, i, h(o))
|
||||
: this.isQuanX() && $notify(s, e, i, h(o)));
|
||||
let logs = ['', '==============📣系统通知📣=============='];
|
||||
logs.push(t);
|
||||
e ? logs.push(e) : '';
|
||||
i ? logs.push(i) : '';
|
||||
console.log(logs.join('\n'));
|
||||
this.logs = this.logs.concat(logs);
|
||||
}
|
||||
log(...t) {
|
||||
t.length > 0 && (this.logs = [...this.logs, ...t]),
|
||||
console.log(t.join(this.logSeparator));
|
||||
}
|
||||
logErr(t, s) {
|
||||
const e = !this.isSurge() && !this.isQuanX() && !this.isLoon();
|
||||
e
|
||||
? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack)
|
||||
: this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t);
|
||||
}
|
||||
wait(t) {
|
||||
return new Promise((s) => setTimeout(s, t));
|
||||
}
|
||||
done(t = {}) {
|
||||
const s = new Date().getTime(),
|
||||
e = (s - this.startTime) / 1e3;
|
||||
this.log(
|
||||
"",
|
||||
`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`
|
||||
)
|
||||
this.log()
|
||||
if (this.isNode()) {
|
||||
process.exit(1)
|
||||
}
|
||||
if (this.isQuanX()) {
|
||||
$done(t)
|
||||
}
|
||||
}
|
||||
})(t, s);
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
|
||||
#环境变量 dydd
|
||||
import os
|
||||
import requests
|
||||
import time
|
||||
import hashlib
|
||||
|
||||
# 获取青龙面板环境变量 dydd
|
||||
dydd = os.environ.get('dydd', '')
|
||||
|
||||
# 按换行符分割账号,并过滤空行
|
||||
accounts = [line.strip() for line in dydd.strip().split('\n') if line.strip()]
|
||||
|
||||
url = "https://app2.d1ev.com/api/user/add-integral"
|
||||
|
||||
# 公共参数
|
||||
params_base = {
|
||||
'app_id': "d1ev_app",
|
||||
'appName': "第一电动",
|
||||
'os': "android",
|
||||
'osVer': "9",
|
||||
'vName': "2.5.6",
|
||||
'vCode': "20506"
|
||||
}
|
||||
|
||||
headers = {
|
||||
'User-Agent': "Dalvik/2.1.0 (Linux; U; Android 9; PCRT00 Build/PQ3A.190605.06201646)",
|
||||
'Connection': "Keep-Alive",
|
||||
'Accept-Encoding': "gzip",
|
||||
'TE': "gzip, deflate; q=0.5"
|
||||
}
|
||||
|
||||
# 定义任务列表,每个任务包括任务类型和执行次数
|
||||
tasks = [
|
||||
{'type': 11, 'name': '签到', 'count': 1},
|
||||
{'type': 3, 'name': '分享', 'count': 3},
|
||||
{'type': 5, 'name': '点赞', 'count': 5},
|
||||
{'type': 2, 'name': '阅读', 'count': 1}
|
||||
]
|
||||
|
||||
for account in accounts:
|
||||
# 分割账号为 uid 和 token
|
||||
parts = account.split('#')
|
||||
if len(parts) != 2:
|
||||
print(f"跳过无效格式账号: {account}")
|
||||
continue
|
||||
|
||||
uid, token = parts
|
||||
|
||||
# 生成当前时间戳
|
||||
current_timestamp = str(int(time.time()))
|
||||
|
||||
for task in tasks:
|
||||
task_type = task['type']
|
||||
task_name = task['name']
|
||||
task_count = task['count']
|
||||
|
||||
for _ in range(task_count):
|
||||
# 构造签名字符串
|
||||
sign_str = f"OMKCy2UxZwn8e4Ak{params_base['appName']}{params_base['app_id']}{params_base['os']}{params_base['osVer']}{current_timestamp}{token}{task_type}{uid}{params_base['vCode']}{params_base['vName']}"
|
||||
|
||||
# 计算 MD5 签名
|
||||
sign = hashlib.md5(sign_str.encode('utf-8')).hexdigest()
|
||||
|
||||
# 定义带有动态值的参数
|
||||
params = {
|
||||
'timestamp': current_timestamp,
|
||||
'token': token,
|
||||
'uid': uid,
|
||||
'type': task_type,
|
||||
'sign': sign.upper(),
|
||||
**params_base
|
||||
}
|
||||
|
||||
try:
|
||||
# 发送 GET 请求
|
||||
response = requests.get(url, params=params, headers=headers)
|
||||
response.raise_for_status() # 如果请求失败,则抛出异常
|
||||
|
||||
# 打印任务执行结果
|
||||
print(f"账号: {uid}, 任务: {task_name}, 响应: {response.text}")
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"账号: {uid}, 任务: {task_name}, 请求失败: {e}")
|
||||
|
||||
# 任务间隔5秒
|
||||
time.sleep(5)
|
||||
|
||||
# 任务类型间隔10秒
|
||||
time.sleep(10)
|
||||
|
||||
-515
@@ -1,515 +0,0 @@
|
||||
/**
|
||||
* cron 27 16 * * * exeedcars.js
|
||||
* @author https://github.com/smallfawn/QLScriptPublic
|
||||
* Show: Hi星途 发帖5分 分享动态5分 回帖2分 签到2分 平均45天积分换一次
|
||||
* 变量名: exeedcarsLife
|
||||
* 变量值: https://starway.exeedcars.com headers中的Authorization 去掉Bearer 去掉Bearer 去掉Bearer
|
||||
* scriptVersionNow = "0.0.1";
|
||||
* export exeedcarsPost=true 无需引号 开启发帖 不填不写 默认不执行
|
||||
* export exeedcarsComment=true 开启评论 不填不写 默认不执行
|
||||
* 11/27 新增果园任务 和 签到 熟成之后获得200积分
|
||||
*/
|
||||
|
||||
const $ = new Env("Hi星途");
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
let ckName = "exeedcarsLife";
|
||||
let envSplitor = ["@", "\n"]; //多账号分隔符
|
||||
let strSplitor = "&"; //多变量分隔符
|
||||
let userIdx = 0;
|
||||
let userList = [];
|
||||
class UserInfo {
|
||||
constructor(str) {
|
||||
this.index = ++userIdx;
|
||||
this.ck = str.split(strSplitor)[0]; //单账号多变量分隔符
|
||||
this.ckStatus = true;
|
||||
this.titleList = []
|
||||
this.contentList = []
|
||||
this.commentList = []
|
||||
this.treeTaskList = []
|
||||
this.treeWaterNum = 0
|
||||
}
|
||||
get_headers() {
|
||||
return {
|
||||
"Authorization": "Bearer " + this.ck,
|
||||
"client_id": "app",
|
||||
"client_secret": "app",
|
||||
"Client-Agent": "device:Xiaomi MI 8 Lite;os:Android 10;version:V1.0.55",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
//"Content-Length": 619,
|
||||
"Host": "starway.exeedcars.com",
|
||||
"Connection": "Keep-Alive",
|
||||
"Accept-Encoding": "gzip",
|
||||
"User-Agent": "okhttp/4.8.1"
|
||||
}
|
||||
|
||||
}
|
||||
async main() {
|
||||
$.log(`===== 开始执行第[${this.index}]个账号 =====`)
|
||||
await this.user_info();
|
||||
if (this.ckStatus) {
|
||||
await this.user_point()
|
||||
await this.signIn_status()
|
||||
await this.art_list()
|
||||
if (process.env["exeedcarsPost"] == "true" || process.env["exeedcarsComment"] == "true") {
|
||||
console.log(`正在远程获取评论!请等待10s左右`);
|
||||
await this._getText()
|
||||
}
|
||||
if (process.env["exeedcarsPost"] == "true") {
|
||||
await this.submit_common("dync", { "hasVideo": "0", "appId": "star", "title": this.titleList[0], "content": this.contentList[0] })
|
||||
}
|
||||
if (process.env["exeedcarsComment"] == "true") {
|
||||
await this.submit_common("comment", { "appId": "star", "id": this.artList[0].id, "position": "0", "contentType": "1", "content": this.commentList[0] })
|
||||
}
|
||||
await this.submit_common("share", { "appId": "star", "shareChannel": "1", "id": this.artList[0].id, "contentType": "1" })
|
||||
await this.tree_task_common(1)
|
||||
await this.tree_task_list()
|
||||
if (this.treeTaskList.length > 0) {
|
||||
for (let task of this.treeTaskList) {
|
||||
$.log(`[${task.growName}] - ${task.limit} / ${task.limitTimes}`)
|
||||
}
|
||||
for (let task of this.treeTaskList) {
|
||||
if (task.limitTimes > task.limit) {
|
||||
if (task.id == 3) {
|
||||
let tasknum = Number(task.limitTimes) - Number(task.limit)
|
||||
for (let i = 0; i < tasknum; i++)
|
||||
await this.tree_task_common(task.id)
|
||||
} else {
|
||||
await this.tree_task_common(task.id)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.tree_task_water_info()
|
||||
if (this.treeWaterNum > 0) {
|
||||
await this.tree_task_water()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
async _getText() {
|
||||
try {
|
||||
let textList = []
|
||||
let options = {
|
||||
fn: "获取随机一言",
|
||||
method: "get",
|
||||
url: `https://v1.hitokoto.cn/?c=e`,
|
||||
}
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await $.wait(1000)
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result["length"] > 10) {
|
||||
textList.push(result.hitokoto)
|
||||
}
|
||||
this.titleList = [textList[0]]
|
||||
this.contentList = [textList[1]]
|
||||
this.commentList = [textList[2]]
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async signIn_status() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "签到状态",
|
||||
method: "get",
|
||||
url: `https://starway.exeedcars.com/api-social/ec/personal/query/attendanceStatus`,
|
||||
headers: this.get_headers(),
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
if (result.data == true) {
|
||||
$.log(`今天已签到🎉`)
|
||||
} else {
|
||||
$.log(`今天未签到🎉`)
|
||||
//执行签到
|
||||
await this.task_signIn()
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
//
|
||||
async task_signIn() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "签到",
|
||||
method: "get",
|
||||
url: `https://starway.exeedcars.com/api-social/ec/personal/attendance`,
|
||||
headers: this.get_headers(),
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
$.log(`签到成功 获得[${result.data}]分`)
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async user_point() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "积分查询",
|
||||
method: "get",
|
||||
url: `https://starway.exeedcars.com/api-user/user/integral/get`,
|
||||
headers: this.get_headers(),
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
$.log(`当前积分[${result.data.pointBalance}]分`)
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async tree_task_common(id) {
|
||||
try {
|
||||
let options = {
|
||||
fn: "种树任务通用",
|
||||
method: "post",
|
||||
url: `https://starway.exeedcars.com/api-marking/tree/event/trigger/event`,
|
||||
headers: this.get_headers(),
|
||||
body: JSON.stringify({ "id": id })
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
$.log(`完成任务 获得[${result.data}]💧`)
|
||||
} else {
|
||||
if (id == 1) {
|
||||
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async tree_task_list() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "种树任务列表",
|
||||
method: "get",
|
||||
url: `https://starway.exeedcars.com/api-marking/tree/event/get/effect`,
|
||||
headers: this.get_headers(),
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
this.treeTaskList = result.data
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async tree_task_water() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "浇水",
|
||||
method: "get",
|
||||
url: `https://starway.exeedcars.com/api-marking/tree/user/water/get/water`,
|
||||
headers: this.get_headers(),
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
$.log(`浇水成功`)
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async tree_task_water_info() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "浇水",
|
||||
method: "get",
|
||||
url: `https://starway.exeedcars.com/api-marking/tree/user/water/get`,
|
||||
headers: this.get_headers(),
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
$.log(`剩余[${result.data.water}]💧`)
|
||||
this.treeWaterNum = result.data.water
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async user_info() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "信息查询",
|
||||
method: "get",
|
||||
url: `https://starway.exeedcars.com/api-user/user/queryById`,
|
||||
headers: this.get_headers(),
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
$.log(`✅[${result.data.nickName}][${result.data.phone}][${result.data.id}]🎉`)
|
||||
this.ckStatus = true;
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
this.ckStatus = false;
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async art_list() {
|
||||
try {
|
||||
let nonceStr = this.get_uuid()
|
||||
let time = new Date().getTime().toString()
|
||||
let default_options = { "nonceStr": nonceStr, "timestamp": time }
|
||||
let config_options = { "pageNumber": "1", "pageType": "3", "appId": "star", "pageSize": "10" }
|
||||
Object.assign(config_options, default_options)
|
||||
let content = this.creat_content(config_options)
|
||||
let options = {
|
||||
fn: "文章列表",
|
||||
method: "post",
|
||||
url: `https://starway.exeedcars.com/api-social/ec/social/anon/list`,
|
||||
headers: this.get_headers(),
|
||||
body: JSON.stringify({ "appId": "star", "nonceStr": nonceStr, "content": content, "timestamp": time })
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
this.artList = result.data.list
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async submit_common(type, config_options) {
|
||||
try {
|
||||
let nonceStr = this.get_uuid()
|
||||
let time = new Date().getTime().toString()
|
||||
let default_options = { "nonceStr": nonceStr, "timestamp": time }
|
||||
|
||||
Object.assign(config_options, default_options)
|
||||
let content = this.creat_content(config_options)
|
||||
let options = {
|
||||
fn: "提交通用",
|
||||
method: "post",
|
||||
url: `https://starway.exeedcars.com/api-social/ec/social/${type}/submit`,
|
||||
headers: this.get_headers(),
|
||||
body: JSON.stringify({ "appId": "star", "nonceStr": nonceStr, "content": content, "timestamp": time })
|
||||
}
|
||||
let { body: result } = await httpRequest(options);
|
||||
//console.log(options);
|
||||
result = JSON.parse(result);
|
||||
//console.log(result);
|
||||
if (result.code == "200") {
|
||||
console.log(`[${type}]成功`);
|
||||
} else {
|
||||
console.log(`❌[${options.fn}]失败`);
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
creat_content(e) {
|
||||
function jsencrtpt_result(t) {
|
||||
let Ie =
|
||||
"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbFRhFFvYlqIu1fp9Hau9MIIVQFTLXbbEWTays1lB1N50jcOnzzj6oDExyjM8050YgsrM3i8M4B1eCpjetjGqPx6BxvnmUr/FIv1/7DDbtMvADlVpYKc7v7kCftjdwbKDT4GPwl2I2WkjSJaU3LhFiYlmxW+9zA1moz3Tc6yp8OQIDAQAB\n-----END PUBLIC KEY-----"
|
||||
global["window"] = {}
|
||||
global["navigator"] = {}
|
||||
const { JSEncrypt } = require("encryptlong")
|
||||
const encryptor = new JSEncrypt()
|
||||
encryptor.setPublicKey(Ie)
|
||||
return encryptor.encryptLong(t)
|
||||
|
||||
}
|
||||
function jsrsasign_result(t) {
|
||||
let Se =
|
||||
"-----BEGIN PRIVATE KEY-----\nMIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMObKgSn8qZePjTNtRXd+aJywxLzMOM2AgNSXJ5oLMd7miSKCPaXz1sNKIPEYLNgiii04PJg3fNcpHFC5dZeX9iUvtsCUtFvdFsj/WgwsXuIWce2QjpX83TwjhN3essGbJIjAXzouLTTB3Tc8gL3Wd8J36vd3r3I28p8tj74+7ovAgMBAAECgYAA4emqzPEhJ7POneJFb25/xkNvAbXrpvtp8VwEpzVWfROr6gjrp3ZSVbJPT9qrTe9TfDQzU2YT2XZ9iM44ETmYEJ9moHSWLCpWFclJFY2Hy9HxaEw56Zu+iYWrZ9jtbiC2A/XOsOv/198slBpB8+7PCsinEUsKC1CP9YwOuwTLZQJBAPDpcRGBBMVOol/ADGuqCHBqtN3wX5PznKFGJIMi5tFQcghFlhixDsw/43spek1BMht+MhERUXrBvQHyCFE7LK0CQQDP21Tkp4NwOE6h1Q9hAgjOp6emuU7vbJmUU+dHiiNt6yVAYMV5tbdRacN4XS58Dt9K8WyYXQmMdYC8nVtcISHLAkBNi2aYssW9WNVNKr0UvrNetAop0iCBuA13n+NKzqYrQ9Cgtv1cT0mrFvl7AFvcmBqv3Mvy0HdAozHaeXSR6RE1AkByI6sWdLZEpWbojysGxis37/CsKQ4jg6tCPGDAdCbIcVvfYkSOdS7ZUg64xdKE5VXQvYo4kL5xlwS+jlpg2QDJAkEA3BNrYDBleAhrCuslvBB4LlFiyS0JpkqzfzNjYLvD0pd9wIR5JBvrWiYqiX4y4LfcdfF1IpMrKKeR48mpUGDAZg==\n-----END PRIVATE KEY-----"
|
||||
const jsrsasign = require('jsrsasign')
|
||||
var r = jsrsasign.KEYUTIL.getKey(Se),
|
||||
n = new jsrsasign.KJUR.crypto.Signature({ alg: "SHA256withRSA" });
|
||||
return n.init(r), n.updateString(t), jsrsasign.hextob64(n.sign());
|
||||
}
|
||||
function Ce(str) {
|
||||
str = str.replaceAll("‘", "");
|
||||
str = str.replaceAll("’", "");
|
||||
str = str.replaceAll("“", "");
|
||||
str = str.replaceAll("”", "");
|
||||
var utf16String = "";
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var char = str.charAt(i);
|
||||
if (char.match(/[\u4E00-\u9FA5]/) || char.match(/[\u3000-\u303F]/) || char.match(/[\uFF01-\uFF5E]/)) { // 检测是否是中文字符或中文标点符号
|
||||
utf16String += "\\u" + char.charCodeAt(0).toString(16); // 转换为UTF-16编码
|
||||
} else {
|
||||
utf16String += char; // 其他字符直接添加到结果中
|
||||
}
|
||||
}
|
||||
return utf16String;
|
||||
|
||||
}
|
||||
|
||||
let t = JSON.stringify(e);
|
||||
t = Ce(t)
|
||||
//console.log(t)
|
||||
let r = jsrsasign_result(t)
|
||||
let n = encodeURI(r)
|
||||
let s = "body=".concat(t, "&sign=").concat(n)
|
||||
let content = jsencrtpt_result(s)
|
||||
//console.log(content);
|
||||
return content
|
||||
}
|
||||
get_uuid() {
|
||||
return 'xxxxxxxx-xxxx-xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0,
|
||||
v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function start() {
|
||||
if (process.env["exeedcarsPost"] == "true") {
|
||||
$.log(`您开启了发帖开关---`)
|
||||
} else {
|
||||
$.log(`您未开启发帖开关---`)
|
||||
}
|
||||
if (process.env["exeedcarsComment"] == "true") {
|
||||
$.log(`您开启了评论开关---`)
|
||||
} else {
|
||||
$.log(`您未开启评论开关---`)
|
||||
}
|
||||
let taskall = [];
|
||||
for (let user of userList) {
|
||||
if (user.ckStatus) {
|
||||
taskall.push(await user.main());
|
||||
}
|
||||
}
|
||||
await Promise.all(taskall);
|
||||
$.msg($.name, "任务执行 over", "smallfawn 提醒您 天冷加衣")
|
||||
}
|
||||
|
||||
!(async () => {
|
||||
if (!(await checkEnv())) return;
|
||||
if (userList.length > 0) {
|
||||
await start();
|
||||
}
|
||||
await SendMsg($.logs.join("\n"))
|
||||
})()
|
||||
.catch((e) => console.log(e))
|
||||
.finally(() => $.done());
|
||||
|
||||
//********************************************************
|
||||
/**
|
||||
* 变量检查与处理
|
||||
* @returns
|
||||
*/
|
||||
async function checkEnv() {
|
||||
let userCookie = ($.isNode() ? process.env[ckName] : $.getdata(ckName)) || "";
|
||||
if (userCookie) {
|
||||
let e = envSplitor[0];
|
||||
for (let o of envSplitor)
|
||||
if (userCookie.indexOf(o) > -1) {
|
||||
e = o;
|
||||
break;
|
||||
}
|
||||
for (let n of userCookie.split(e)) n && userList.push(new UserInfo(n));
|
||||
} else {
|
||||
console.log("未找到CK");
|
||||
return;
|
||||
}
|
||||
return console.log(`共找到${userList.length}个账号`), true; //true == !0
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
function httpRequest(options) {
|
||||
if (!options["method"]) {
|
||||
return console.log(`请求方法不存在`);
|
||||
}
|
||||
if (!options["fn"]) {
|
||||
console.log(`函数名不存在`);
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
$[options.method](options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
$.logErr(err);
|
||||
} else {
|
||||
try {
|
||||
resp = JSON.parse(resp);
|
||||
} catch (error) { }
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve(resp);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
async function SendMsg(message) {
|
||||
if (!message) return;
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify($.name, message)
|
||||
} else {
|
||||
$.msg($.name, '', message)
|
||||
}
|
||||
}
|
||||
// prettier-ignore
|
||||
function Env(t, s) { return new (class { constructor(t, s) { (this.name = t), (this.data = null), (this.dataFile = "box.dat"), (this.logs = []), (this.logSeparator = "\n"), (this.startTime = new Date().getTime()), Object.assign(this, s), this.log("", `\ud83d\udd14${this.name},\u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } getScript(t) { return new Promise((s) => { this.get({ url: t }, (t, e, i) => s(i)) }) } runScript(t, s) { return new Promise((e) => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let o = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); (o = o ? 1 * o : 20), (o = s && s.timeout ? s.timeout : o); const [h, a] = i.split("@"), r = { url: `http://${a}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: o }, headers: { "X-Key": h, Accept: "*/*" }, }; this.post(r, (t, s, i) => e(i)) }).catch((t) => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { (this.fs = this.fs ? this.fs : require("fs")), (this.path = this.path ? this.path : require("path")); const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s); if (!e && !i) return {}; { const i = e ? t : s; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { (this.fs = this.fs ? this.fs : require("fs")), (this.path = this.path ? this.path : require("path")); const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), o = JSON.stringify(this.data); e ? this.fs.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o) } } lodash_get(t, s, e) { const i = s.replace(/\[(\d+)\]/g, ".$1").split("."); let o = t; for (const t of i) if (((o = Object(o)[t]), void 0 === o)) return e; return o } lodash_set(t, s, e) { return Object(t) !== t ? t : (Array.isArray(s) || (s = s.toString().match(/[^.[\]]+/g) || []), (s.slice(0, -1).reduce((t, e, i) => Object(t[e]) === t[e] ? t[e] : (t[e] = Math.abs(s[i + 1]) >> 0 == +s[i + 1] ? [] : {}), t)[s[s.length - 1]] = e), t) } getdata(t) { let s = this.getval(t); if (/^@/.test(t)) { const [, e, i] = /^@(.*?)\.(.*?)$/.exec(t), o = e ? this.getval(e) : ""; if (o) try { const t = JSON.parse(o); s = t ? this.lodash_get(t, i, "") : s } catch (t) { s = "" } } return s } setdata(t, s) { let e = !1; if (/^@/.test(s)) { const [, i, o] = /^@(.*?)\.(.*?)$/.exec(s), h = this.getval(i), a = i ? ("null" === h ? null : h || "{}") : "{}"; try { const s = JSON.parse(a); this.lodash_set(s, o, t), (e = this.setval(JSON.stringify(s), i)) } catch (s) { const h = {}; this.lodash_set(h, o, t), (e = this.setval(JSON.stringify(h), i)) } } else e = this.setval(t, s); return e } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? ((this.data = this.loaddata()), this.data[t]) : (this.data && this.data[t]) || null } setval(t, s) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? ((this.data = this.loaddata()), (this.data[s] = t), this.writedata(), !0) : (this.data && this.data[s]) || null } initGotEnv(t) { (this.got = this.got ? this.got : require("got")), (this.cktough = this.cktough ? this.cktough : require("tough-cookie")), (this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar()), t && ((t.headers = t.headers ? t.headers : {}), void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, s = () => { }) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => { !t && e && ((e.body = i), (e.statusCode = e.status)), s(t, e, i) }) : this.isQuanX() ? $task.fetch(t).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t)) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, s) => { try { const e = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(e, null), (s.cookieJar = this.ckjar) } catch (t) { this.logErr(t) } }).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h, } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t))) } post(t, s = () => { }) { if ((t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon())) $httpClient.poLine truncated
|
||||
+10
-10
@@ -26,7 +26,7 @@ class Task {
|
||||
this.token = str.split(strSplitor)[2]; //单账号多变量分隔符
|
||||
this.oaid = str.split(strSplitor)[3]; //单账号多变量分隔符
|
||||
this.ckStatus = true;
|
||||
this.taskList=[]
|
||||
this.taskList = []
|
||||
|
||||
}
|
||||
async main() {
|
||||
@@ -35,7 +35,7 @@ class Task {
|
||||
await this.special_finish()
|
||||
await this.task_list()
|
||||
//console.log(this.taskList)
|
||||
for(let i of this.taskList){
|
||||
for (let i of this.taskList) {
|
||||
await $.wait(5000)
|
||||
await this.task_finish(i.id)
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class Task {
|
||||
console.log(result);
|
||||
}
|
||||
}
|
||||
async task_list() {
|
||||
async task_list() {
|
||||
let result = await this.taskRequest("post", 'https://fenxiang-lottery-api.fenxianglife.com/fenxiang-lottery/home/data/V2', JSON.stringify({
|
||||
"plateform": "android",
|
||||
"version": "5.4.3"
|
||||
@@ -143,14 +143,14 @@ class Task {
|
||||
oaid: this.oaid,
|
||||
}
|
||||
const c = "\u7c89\u8c61\u597d\u725b\u903ca8c19d8267527ea4c7d2f011acf7766f"
|
||||
let s = method === "get" ? void 0:JSON.parse(body)
|
||||
let s = method === "get" ? void 0 : JSON.parse(body)
|
||||
let e = void 0 === s ? {} : s
|
||||
g.sign = v(re(e) + re(g) + c)
|
||||
g.sign = v(re(e) + re(g) + c)
|
||||
let headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Lite Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.99 Mobile Safari/537.36 AgentWeb/5.0.0 UCBrowser/11.6.4.950',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Encoding': 'gzip, deflate',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Encoding': 'gzip, deflate',
|
||||
'Content-Type': 'application/json',
|
||||
'origin': 'https://m.fenxianglife.com',
|
||||
'sec-fetch-dest': 'empty',
|
||||
'x-requested-with': 'com.n_add.android',
|
||||
@@ -158,7 +158,7 @@ class Task {
|
||||
'sec-fetch-mode': 'cors',
|
||||
'referer': 'https://m.fenxianglife.com/h5-lottery/index.html?hideBack=1&sourceType=lottery_tab&token=030e7e9158af06dea2b3d0175a471ada&AppToken=96e06ae9f3cab6784de443015b8d9ad8&uid=515226607&v=5.4.3&did=njia992631e6-b9b2-4383-b67c-86b5d0fe818a&level=1&platform=android×tamp=1717426249&channel=xiaomi&traFromId=23192687628924991393323633117947',
|
||||
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||
"Content-Type":"application/json"
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
Object.assign(headers, g)
|
||||
//console.log(headers)
|
||||
@@ -166,7 +166,7 @@ class Task {
|
||||
url: url,
|
||||
method: method,
|
||||
headers: headers,
|
||||
body:body
|
||||
body: body
|
||||
}
|
||||
let { body: result } = await $.httpRequest(reqeuestOptions)
|
||||
return result
|
||||
|
||||
Reference in new issue
Block a user