mirror of
https://github.com/smallfawn/QLScriptPublic.git
synced 2025-12-21 01:04:46 +08:00
.
This commit is contained in:
542
wxapp/suboer.js
Normal file
542
wxapp/suboer.js
Normal file
File diff suppressed because one or more lines are too long
109
wxapp/topspace.py
Normal file
109
wxapp/topspace.py
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
'''
|
||||
topspace微信小程序
|
||||
|
||||
|
||||
new Env('topspace');
|
||||
抓x-vcs-user-token和app-id用&分割并且多号@
|
||||
'''
|
||||
import requests
|
||||
import os
|
||||
|
||||
class AC:
|
||||
def __init__(self, cookie):
|
||||
self.headers = {
|
||||
'User-Agent': "Mozilla/5.0 (Linux; Android 12; RMX3562 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/122.0.6261.120 Mobile Safari/537.36 XWEB/1220133 MMWEBSDK/20240404 MMWEBID/2307 MicroMessenger/8.0.49.2600(0x28003133) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
|
||||
'app-id': cookie.split('&')[1],
|
||||
'x-vcs-user-token': cookie.split('&')[0]
|
||||
}
|
||||
|
||||
def info(self):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/user-info-api/api/v1/sda-app/personal-info/basic-information"
|
||||
response = requests.get(url, headers=self.headers)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
userNickname = data["data"]["userNickname"]
|
||||
totalPoints = data["data"]["pointInfo"]["totalPoints"]
|
||||
print(f"用户:{userNickname}当前共有{totalPoints}币")
|
||||
return userNickname
|
||||
else:
|
||||
msg = data["msg"]
|
||||
print(f"登录失败: {msg}")
|
||||
return None
|
||||
|
||||
def check(self, userNickname):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/user-info-api/api/v2/point/check-in"
|
||||
response = requests.post(url, headers=self.headers)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
description = data["data"]["description"]
|
||||
total = data["data"]["total"]
|
||||
print(f"用户:{userNickname}{description}获得{total}TOP币")
|
||||
else:
|
||||
msg = data["msg"]
|
||||
print(f"签到失败: {msg}")
|
||||
|
||||
def list_articles(self, userNickname):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/sda-zone-api/api/v1/post/list"
|
||||
data = {
|
||||
"section_id": "1002",
|
||||
"page": {
|
||||
"current_page": 1,
|
||||
"page_size": 20
|
||||
},
|
||||
"sort_type": "RECOMMEND_FIRST"
|
||||
}
|
||||
response = requests.post(url, headers=self.headers, json=data)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
article_id = data["data"]["list"][0]["id"]
|
||||
print(f"用户:{userNickname}获取文章{article_id}")
|
||||
return article_id
|
||||
else:
|
||||
msg = data["msg"]
|
||||
print(f"获取文章失败: {msg}")
|
||||
|
||||
def publish_comment(self, userNickname, article_id):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/sda-zone-api/api/v1/comment/publish"
|
||||
data = {
|
||||
"content": "很酷",
|
||||
"post_id": article_id
|
||||
}
|
||||
response = requests.post(url, headers=self.headers, json=data)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
print("发布成功")
|
||||
else:
|
||||
print(f"发布失败: {data['msg']}")
|
||||
|
||||
def share_article(self, userNickname, article_id):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/sda-zone-api/api/v1/action/share"
|
||||
data = {
|
||||
"post_id": article_id
|
||||
}
|
||||
response = requests.post(url, headers=self.headers, json=data)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
print("转发成功")
|
||||
else:
|
||||
print(f"转发失败: {data['msg']}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
topspace = os.environ.get('topspace')
|
||||
if not topspace:
|
||||
print("请设置环境变量 'topspace' 后再运行")
|
||||
else:
|
||||
topspace_list = topspace.split('@')
|
||||
for num, topspace_item in enumerate(topspace_list, start=1):
|
||||
x_vcs_user_token, app_id = topspace_item.split('&')
|
||||
cookie = f"{x_vcs_user_token}&{app_id}"
|
||||
ac = AC(cookie)
|
||||
print(f"=====开始执行第{num}个账号任务=====")
|
||||
user_nickname = ac.info()
|
||||
if user_nickname:
|
||||
ac.check(user_nickname)
|
||||
article_id = ac.list_articles(user_nickname)
|
||||
if article_id:
|
||||
ac.publish_comment(user_nickname, article_id)
|
||||
ac.share_article(user_nickname, article_id)
|
||||
print("---------账号任务执行完毕---------")
|
||||
260
wxapp/wx_gjjkpro.js
Normal file
260
wxapp/wx_gjjkpro.js
Normal file
File diff suppressed because one or more lines are too long
202
wxapp/wx_hapi.js
Normal file
202
wxapp/wx_hapi.js
Normal file
File diff suppressed because one or more lines are too long
519
wxapp/wx_lccd.js
Normal file
519
wxapp/wx_lccd.js
Normal file
@@ -0,0 +1,519 @@
|
||||
/**
|
||||
* cron 5 15 * * *
|
||||
* Show:微信小程序-莱充充电
|
||||
* 变量名:
|
||||
* 变量值:https://shop.laichon.com/api/v1/ headers下的authorization 去掉JWT 只要后面的 # openid 多账户换行或者&
|
||||
* 示例 ejxxxxxx#o0sa51....
|
||||
* scriptVersionNow = "0.0.1";
|
||||
*/
|
||||
|
||||
const $ = new Env("微信小程序-莱充充电");
|
||||
const notify = $.isNode() ? require('../sendNotify') : '';
|
||||
let ckName = "wx_lccd";
|
||||
let envSplitor = ["&", "\n"]; //多账号分隔符
|
||||
let strSplitor = "#"; //多变量分隔符
|
||||
let userIdx = 0;
|
||||
let userList = [];
|
||||
class UserInfo {
|
||||
constructor(str) {
|
||||
this.index = ++userIdx;
|
||||
this.ck = str.split(strSplitor)[0];
|
||||
this.ck1 = str.split(strSplitor)[1];
|
||||
this.ckStatus = true;
|
||||
this.signStatus = ""
|
||||
this.headers = {
|
||||
"Host": "shop.laichon.com",
|
||||
"Connection": "keep-alive",
|
||||
"Content-Length": "9",
|
||||
"authorization": "JWT " + this.ck,
|
||||
"charset": "utf-8",
|
||||
"openid": this.ck1,
|
||||
"service-code": "WYC-MI-WEIXIN",
|
||||
"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/116.0.0.0 Mobile Safari/537.36 XWEB/1160027 MMWEBSDK/20231002 MMWEBID/2585 MicroMessenger/8.0.43.2480(0x28002B51) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
"Accept-Encoding": "gzip,compress,br,deflate",
|
||||
"Referer": "https://servicewechat.com/wxa68db1dabe823e7e/316/page-frame.html"
|
||||
}
|
||||
}
|
||||
async main() {
|
||||
await this.user_info()
|
||||
if(this.ckStatus){
|
||||
await this.task_sign();
|
||||
if (this.signStatus == 0) {
|
||||
await this.task_sign();
|
||||
} else if (this.signStatus == 1) {
|
||||
$.log(`签到翻倍`)
|
||||
await this.task_double();
|
||||
}
|
||||
$.log(`完成充电和看视频任务`)
|
||||
await this.task_complete(3)
|
||||
await this.task_complete(4)
|
||||
}
|
||||
|
||||
}
|
||||
async task_sign() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "签到",
|
||||
method: "get",
|
||||
url: `https://shop.laichon.com/api/v1/task/getSignTask`,
|
||||
headers: this.headers,
|
||||
}
|
||||
let { body: result } = await $.httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.code == 1) {
|
||||
if (result.data.isSign == 0) {
|
||||
//未签到
|
||||
$.log(`未签到`)
|
||||
this.signStatus = 0
|
||||
} else {
|
||||
$.log(`已签到`)
|
||||
this.signStatus = 1
|
||||
}
|
||||
} else {
|
||||
this.signStatus = 2
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async user_info() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "信息",
|
||||
method: "get",
|
||||
url: `https://shop.laichon.com/api/v1/member/userinfo`,
|
||||
headers: this.headers,
|
||||
}
|
||||
let { body: result } = await $.httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if(result.code_key == "success"){
|
||||
this.ckStatus = true
|
||||
$.log(`当前[${result.data.mobile} 积分[${result.data.point}]]`)
|
||||
}else {
|
||||
this.ckStatus = false
|
||||
console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async task_double() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "签到翻倍",
|
||||
method: "get",
|
||||
url: `https://shop.laichon.com/api/v1/task/pointsDouble`,
|
||||
headers: this.headers,
|
||||
}
|
||||
let { body: result } = await $.httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if(result.code_key == "success"){
|
||||
$.log(`完成 +1`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async task_complete(id) {
|
||||
try {
|
||||
let options = {
|
||||
fn: "完成任务",
|
||||
method: "post",
|
||||
url: `https://shop.laichon.com/api/v1/task/taskComplete`,
|
||||
headers: this.headers,
|
||||
body: `task_id=${id}`
|
||||
}
|
||||
let { body: result } = await $.httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if(result.code_key == "success"){
|
||||
$.log(`完成 +1`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
!(async () => {
|
||||
if (!(await checkEnv())) return;
|
||||
if (userList.length > 0) {
|
||||
let taskall = [];
|
||||
for (let user of userList) {
|
||||
if (user.ckStatus) {
|
||||
taskall.push(await 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 UserInfo(n));
|
||||
} else {
|
||||
console.log(`未找到变量[${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('&');
|
||||
}
|
||||
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'] = 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);
|
||||
}
|
||||
162
wxapp/wx_midea.js
Normal file
162
wxapp/wx_midea.js
Normal file
File diff suppressed because one or more lines are too long
269
wxapp/wx_xlxyh.js
Normal file
269
wxapp/wx_xlxyh.js
Normal file
File diff suppressed because one or more lines are too long
479
wxapp/wx_ziwi.js
Normal file
479
wxapp/wx_ziwi.js
Normal file
@@ -0,0 +1,479 @@
|
||||
/**
|
||||
* cron 25 10 * * * wx_ZIWI+.js
|
||||
* 积分换 猫粮狗粮
|
||||
* 变量名:ZIWIAUTH
|
||||
* 变量值:https://ziwi.gzcrm.cn/json-rpc? Headers中的authorization 去掉Bearer 去掉Bearer 去掉Bearer
|
||||
* 多账号& 或新增变量
|
||||
* scriptVersionNow = "0.0.1";
|
||||
*/
|
||||
|
||||
const $ = new Env("微信小程序ZIWI+");
|
||||
const notify = $.isNode() ? require('../sendNotify') : '';
|
||||
let ckName = "ZIWIAUTH";
|
||||
let envSplitor = ["&", "\n"]; //多账号分隔符
|
||||
let strSplitor = "#"; //多变量分隔符
|
||||
let userIdx = 0;
|
||||
let userList = [];
|
||||
let msg = ""
|
||||
class Task {
|
||||
constructor(str) {
|
||||
this.index = ++userIdx;
|
||||
this.ck = str.split(strSplitor)[0]; //单账号多变量分隔符
|
||||
this.ckStatus = true;
|
||||
//定义在这里的headers会被get请求删掉content-type 而不会重置
|
||||
this.artList = []
|
||||
}
|
||||
async main() {
|
||||
await this.task_sign()
|
||||
await this.act_list();
|
||||
if (this.artList.length > 0) {
|
||||
for (let act of this.artList) {
|
||||
await this.task_like(act)
|
||||
await this.task_share(act)
|
||||
}
|
||||
}
|
||||
}
|
||||
async taskRequest(method, url, body = "") {
|
||||
//
|
||||
let headers = {
|
||||
"Host": "ziwi.gzcrm.cn",
|
||||
"Connection": "keep-alive",
|
||||
//"Content-Length": "85",
|
||||
"authorization": "Bearer "+ this.ck,
|
||||
"charset": "utf-8",
|
||||
"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/116.0.0.0 Mobile Safari/537.36 XWEB/1160027 MMWEBSDK/20231002 MMWEBID/2585 MicroMessenger/8.0.43.2480(0x28002B51) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
|
||||
"content-type": "application/json;charset=UTF-8",
|
||||
"Accept-Encoding": "gzip,compress,br,deflate",
|
||||
"Referer": "https://servicewechat.com/wxb26a710e583b05dc/41/page-frame.html"
|
||||
}
|
||||
if (method == "get") {
|
||||
let { body: result } = await $.httpRequest({ method: method, headers: headers, url: url })
|
||||
return result
|
||||
} else {
|
||||
let { body: result } = await $.httpRequest({ method: method, url: url, headers: headers, body: JSON.stringify(body) })
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
async task_sign() {
|
||||
//签到
|
||||
let result = await this.taskRequest("post", `https://ziwi.gzcrm.cn/json-rpc?__method=DoCheckin`, { "id": Date.now(), "jsonrpc": "2.0", "method": "DoCheckin", "params": { "activityId": "1" } })
|
||||
//console.log(options);
|
||||
$.log(JSON.stringify(result.result));
|
||||
}
|
||||
async task_like(id) {
|
||||
//点赞帖子
|
||||
let result = await this.taskRequest("post", `https://ziwi.gzcrm.cn/json-rpc?__method=LikeThread`, { "id": Date.now(), "jsonrpc": "2.0", "method": "LikeThread", "params": { "threadId": id } })
|
||||
//console.log(options);
|
||||
$.log(JSON.stringify(result.result));
|
||||
}
|
||||
|
||||
async task_share(id) {
|
||||
//分享帖子
|
||||
let result = await this.taskRequest("post", `https://ziwi.gzcrm.cn/json-rpc?__method=LikeThread`, { "id": 1704777211084, "jsonrpc": "2.0", "method": "SubmitCrmTrackLog", "params": { "event": "shareThread", "params": { "threadId": id, "path": "/pages/UserPosters/UserPosters?threadId=" + id } } })
|
||||
//console.log(options);
|
||||
$.log(JSON.stringify(result.result));
|
||||
}
|
||||
async act_list() {
|
||||
//分享帖子
|
||||
let result = await this.taskRequest("post", `https://ziwi.gzcrm.cn/json-rpc?__method=GetZIWIThreadList`, { "id": 1704777373474, "jsonrpc": "2.0", "method": "GetZIWIThreadList", "params": { "type": "ziwi", "pageSize": 10, "currentPage": 1 } })
|
||||
//console.log(result.result);
|
||||
if (result.result.list) {
|
||||
for (let act of result.result.list) {
|
||||
this.artList.push(act.threadId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function start() {
|
||||
let taskall = [];
|
||||
for (let user of userList) {
|
||||
if (user.ckStatus) {
|
||||
taskall.push(await user.main());
|
||||
}
|
||||
}
|
||||
await Promise.all(taskall);
|
||||
}
|
||||
|
||||
!(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 Task(n));
|
||||
} else {
|
||||
console.log("未找到CK");
|
||||
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] = decodeURIComponent(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["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'] = 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);
|
||||
}
|
||||
397
wxapp/xbox.js
Normal file
397
wxapp/xbox.js
Normal file
File diff suppressed because one or more lines are too long
261
wxapp/yeyebupaocha.js
Normal file
261
wxapp/yeyebupaocha.js
Normal file
File diff suppressed because one or more lines are too long
519
wxapp/ylnn.js
Normal file
519
wxapp/ylnn.js
Normal file
@@ -0,0 +1,519 @@
|
||||
/*
|
||||
@随缘撸豆
|
||||
伊利牛奶小程序 cron 45 12 * * * https://raw.githubusercontent.com/liuqi6968/-/main/ylnn.js
|
||||
|
||||
地址: #小程序://伊利/1jrunQEW7zfybgI
|
||||
|
||||
5.27 完成签到
|
||||
|
||||
------------------------ 青龙--配置文件-贴心复制区域 ----------------------
|
||||
# 伊利牛奶 小程序
|
||||
#小程序://伊利/1jrunQEW7zfybgI
|
||||
抓取 https://msmarket.msx.digitalyili.com 中的access-token
|
||||
export ylnn=" access-token "
|
||||
多账号用 换行 或 @ 分割
|
||||
注意脚本运行以后 在登录小程序ck会失效
|
||||
|
||||
|
||||
这个就是以前畅意100 以前玩过的可以找客服把积分移过到这个小程序里面
|
||||
*/
|
||||
|
||||
const $ = new Env("伊利牛奶")
|
||||
const CK_NAME = "ylnn"
|
||||
const Notify = 1 // 通知控制
|
||||
const tgLogFlag = 1 // 是否tg发送通知, 偷撸车使用, 默认0--不发送
|
||||
let msg = ''
|
||||
//===========================================================================
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
async function main(userInfo) {
|
||||
|
||||
await userInfo.sign()
|
||||
await userInfo.point()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
class UserInfo {
|
||||
constructor(index, str) {
|
||||
this.user_log = `${$.name}\n`
|
||||
this.index = index + 1
|
||||
|
||||
if (tgLogFlag) {
|
||||
try {
|
||||
this.ck = str
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
async sign() {
|
||||
let name = "签到";
|
||||
let options = {
|
||||
method: "post",
|
||||
url: `https://msmarket.msx.digitalyili.com/gateway/api/member/daily/sign`,
|
||||
headers: {
|
||||
"Host": "msmarket.msx.digitalyili.com",
|
||||
"charset": "utf-8",
|
||||
"content-type": "application/json",
|
||||
"access-token": `${this.ck}`
|
||||
},
|
||||
body: `{}`
|
||||
};
|
||||
// console.log(options);
|
||||
|
||||
let res = await httpRequest(options);
|
||||
// console.log(res);
|
||||
if (res.status == true) {
|
||||
this.cusLog(`账号 ${this.index} : 签到成功`)
|
||||
} else if (res.status == false) {
|
||||
this.cusLog(`账号 ${this.index} : ck过期 请重新抓取 access-token`)
|
||||
} else this.cusLog(`账号[${this.index}] ${name} 失败 ❌ 了呢`), console.log(res);
|
||||
}
|
||||
async point() {
|
||||
let name = "个人信息";
|
||||
let options = {
|
||||
method: "get",
|
||||
url: `https://msmarket.msx.digitalyili.com/gateway/api/member/point`,
|
||||
headers: {
|
||||
"Host": "msmarket.msx.digitalyili.com",
|
||||
"charset": "utf-8",
|
||||
"content-type": "application/json",
|
||||
"access-token": `${this.ck}`
|
||||
}
|
||||
|
||||
};
|
||||
// console.log(options);
|
||||
|
||||
let res = await httpRequest(options);
|
||||
// console.log(res);
|
||||
if (res.status == true) {
|
||||
this.cusLog(`账号 ${this.index} 总积分 : ${res.data} `)
|
||||
} else if (res.status == false) {
|
||||
this.cusLog(`账号 ${this.index} : ck过期 请重新抓取 access-token`)
|
||||
} else this.cusLog(`账号[${this.index}] ${name} 失败 ❌ 了呢`), console.log(res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async Sendtg_bot() {
|
||||
const TelegramBot = require('node-telegram-bot-api');
|
||||
const tg_token = process.env.tg_token;
|
||||
// console.log(tg_token);
|
||||
let bot = new TelegramBot(tg_token);
|
||||
let msg = this.user_log;
|
||||
// console.log(`=================`);
|
||||
// console.log(this.chatId, msg);
|
||||
await bot.sendMessage(this.chatId, msg);
|
||||
}
|
||||
|
||||
|
||||
cusLog(a) {
|
||||
if (tgLogFlag) {
|
||||
console.log(` ${a}`);
|
||||
msg += `\n ${a}`;
|
||||
this.user_log += `\n ${a}`;
|
||||
} else {
|
||||
console.log(` ${a}`);
|
||||
msg += `\n ${a}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
// 入口
|
||||
!(async () => {
|
||||
const notify = require("../sendNotify");
|
||||
$.doubleLog(await $.yiyan());
|
||||
let users = await getUsers(CK_NAME, async (index, element) => {
|
||||
let userInfo = new UserInfo(index, element);
|
||||
return userInfo;
|
||||
});
|
||||
|
||||
list = [];
|
||||
users.forEach(async element => {
|
||||
list.push(main(element));
|
||||
});
|
||||
|
||||
await Promise.all(list);
|
||||
|
||||
})()
|
||||
.catch((e) => console.log(e))
|
||||
.finally(() => $.done());
|
||||
|
||||
|
||||
// ==============================================================================
|
||||
async function getUsers(ckName, fnUserInfo) {
|
||||
let userList = [];
|
||||
let userCookie = process.env[ckName];
|
||||
let envSplicer = ["@", "\n", "&"];
|
||||
let userCount = 0;
|
||||
if (userCookie) {
|
||||
let e = envSplicer[0];
|
||||
for (let o of envSplicer)
|
||||
if (userCookie.indexOf(o) > -1) {
|
||||
e = o;
|
||||
break;
|
||||
}
|
||||
let arr = userCookie.split(e);
|
||||
for (let index = 0; index < arr.length; index++) {
|
||||
const element = arr[index];
|
||||
element && userList.push(await fnUserInfo(index, element));
|
||||
}
|
||||
userCount = userList.length;
|
||||
} else {
|
||||
console.log("抓取https://msmarket.msx.digitalyili.com 中的access-token");
|
||||
}
|
||||
console.log(`共找到${userCount}个账号`), !0;
|
||||
return userList;
|
||||
}
|
||||
|
||||
async function httpRequest(options, type = false) {
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
$.send(options, async (err, res_body, res_format, res) => {
|
||||
if (err) {
|
||||
console.log(`错误, 检查点--2`); return;
|
||||
}
|
||||
if (!type) {
|
||||
resolve(res_body);
|
||||
} resolve(res_format);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ============================================================================================================================
|
||||
|
||||
// 新的 env 函数, 增加自定义功能 yml-11.12改 合并
|
||||
function Env(name, env) {
|
||||
"undefined" != typeof process &&
|
||||
JSON.stringify(process.env).indexOf("GITHUB") > -1 &&
|
||||
process.exit(0);
|
||||
return new (class {
|
||||
constructor(name, env) {
|
||||
this.name = name;
|
||||
this.notifyStr = "";
|
||||
this.notifyFlag = false;
|
||||
this.startTime = new Date().getTime();
|
||||
Object.assign(this, env);
|
||||
console.log(`${this.name} 开始运行: \n`);
|
||||
}
|
||||
isNode() {
|
||||
return "undefined" != typeof module && !!module.exports;
|
||||
}
|
||||
send(options, e = () => { }) {
|
||||
let m = options.method.toLowerCase();
|
||||
let t = options;
|
||||
if (m != "get" && m != "post" && m != "put" && m != "delete") {
|
||||
console.log(`无效的http方法: ${m}`);
|
||||
return;
|
||||
}
|
||||
if (m == "get" && t.headers) {
|
||||
// delete t.headers["Content-Type"];
|
||||
delete t.headers["Content-Length"];
|
||||
} else if (t.body && t.headers) {
|
||||
if (t.headers["content-type"]) {
|
||||
let tem = t.headers["content-type"];
|
||||
delete t.headers["content-type"];
|
||||
t.headers["Content-Type"] = tem;
|
||||
} else if (t.body && t.headers) {
|
||||
if (!t.headers["Content-Type"])
|
||||
t.headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
}
|
||||
}
|
||||
if (this.isNode()) {
|
||||
this.request = this.request ? this.request : require("request");
|
||||
this.request(options, function (error, response) {
|
||||
if (error) throw new Error(error);
|
||||
let res_body = response.body;
|
||||
let res = response;
|
||||
try {
|
||||
if (typeof res_body == "string") {
|
||||
if ($.isJsonStr(res_body)) {
|
||||
res_body = JSON.parse(res_body);
|
||||
let res_format = $.formatJson(response.body);
|
||||
e(null, res_body, res_format, res);
|
||||
} else e(null, res_body, res_format, res);
|
||||
} else e(null, res_body, res_format, res);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
let a = `ENV -- request 请求错误, 检查点1\n${error}`;
|
||||
e(a, null, null, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
isJsonStr(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
if (typeof JSON.parse(str) == "object") {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
formatJson(value) {
|
||||
var json = value;
|
||||
var i = 0,
|
||||
len = 0,
|
||||
tab = " ",
|
||||
targetJson = "",
|
||||
indentLevel = 0,
|
||||
inString = false,
|
||||
currentChar = null;
|
||||
for (i = 0, len = json.length; i < len; i += 1) {
|
||||
currentChar = json.charAt(i);
|
||||
switch (currentChar) {
|
||||
case "{":
|
||||
case "[":
|
||||
if (!inString) {
|
||||
targetJson += currentChar + "\n" + repeat(tab, indentLevel + 1);
|
||||
indentLevel += 1;
|
||||
} else {
|
||||
targetJson += currentChar;
|
||||
}
|
||||
break;
|
||||
case "}":
|
||||
case "]":
|
||||
if (!inString) {
|
||||
indentLevel -= 1;
|
||||
targetJson += "\n" + repeat(tab, indentLevel) + currentChar;
|
||||
} else {
|
||||
targetJson += currentChar;
|
||||
}
|
||||
break;
|
||||
case ",":
|
||||
if (!inString) {
|
||||
targetJson += ",\n" + repeat(tab, indentLevel);
|
||||
} else {
|
||||
targetJson += currentChar;
|
||||
}
|
||||
break;
|
||||
case ":":
|
||||
if (!inString) {
|
||||
targetJson += ": ";
|
||||
} else {
|
||||
targetJson += currentChar;
|
||||
}
|
||||
break;
|
||||
case " ":
|
||||
case "\n":
|
||||
case "\t":
|
||||
if (inString) {
|
||||
targetJson += currentChar;
|
||||
}
|
||||
break;
|
||||
case '"':
|
||||
if (i > 0 && json.charAt(i - 1) !== "\\") {
|
||||
inString = !inString;
|
||||
}
|
||||
targetJson += currentChar;
|
||||
break;
|
||||
default:
|
||||
targetJson += currentChar;
|
||||
break;
|
||||
}
|
||||
}
|
||||
function repeat(s, count) {
|
||||
return new Array(count + 1).join(s);
|
||||
}
|
||||
function repeat(s, count) {
|
||||
return new Array(count + 1).join(s);
|
||||
}
|
||||
return targetJson;
|
||||
}
|
||||
type(str) {
|
||||
if (this.strCode(str) > 20) {
|
||||
return console.log(`数据类型是: ${typeof str}`);
|
||||
}
|
||||
return console.log(`${str}数据类型是: ${typeof str}`);
|
||||
}
|
||||
strCode(str) {
|
||||
var count = 0;
|
||||
if (str) {
|
||||
let len = str.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (str.charCodeAt(i) > 255) {
|
||||
count += 2;
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
} else return 0;
|
||||
}
|
||||
async SendMsg(message) {
|
||||
if (!message) return;
|
||||
if (Notify > 0) {
|
||||
if ($.isNode()) {
|
||||
var notify = require("../sendNotify");
|
||||
await notify.sendNotify($.name, message);
|
||||
} else {
|
||||
console.log($.name, "", message);
|
||||
}
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
getMin(a, b) {
|
||||
return a < b ? a : b;
|
||||
}
|
||||
getMax(a, b) {
|
||||
return a < b ? b : a;
|
||||
}
|
||||
json2str(obj, c, encodeUrl = false) {
|
||||
let ret = [];
|
||||
for (let keys of Object.keys(obj).sort()) {
|
||||
let v = obj[keys];
|
||||
if (v && encodeUrl) v = encodeURIComponent(v);
|
||||
ret.push(keys + "=" + v);
|
||||
}
|
||||
return ret.join(c);
|
||||
}
|
||||
str2json(str, decodeUrl = 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 (decodeUrl) v = decodeURIComponent(v);
|
||||
ret[k] = v;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
randomStr(len, up = false, charset = "abcdef0123456789") {
|
||||
let str = "";
|
||||
for (let i = 0; i < len; i++) {
|
||||
str += charset.charAt(Math.floor(Math.random() * charset.length));
|
||||
}
|
||||
if (!up) {
|
||||
return str;
|
||||
}
|
||||
return str.toUpperCase();
|
||||
}
|
||||
phoneNum(phone_num) {
|
||||
if (phone_num.length == 11) {
|
||||
let data = phone_num.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
|
||||
return data;
|
||||
} else {
|
||||
return phone_num;
|
||||
}
|
||||
}
|
||||
randomInt(min, max) {
|
||||
return Math.round(Math.random() * (max - min) + min);
|
||||
}
|
||||
async yiyan() {
|
||||
this.request = this.request ? this.request : require("request");
|
||||
return new Promise((resolve) => {
|
||||
var options = {
|
||||
method: "GET",
|
||||
url: "https://v1.hitokoto.cn/",
|
||||
headers: {},
|
||||
};
|
||||
this.request(options, function (error, response) {
|
||||
let data = JSON.parse(response.body);
|
||||
let data_ = `[一言]: ${data.hitokoto} by--${data.from}`;
|
||||
resolve(data_);
|
||||
});
|
||||
});
|
||||
}
|
||||
wait(t) {
|
||||
return new Promise((e) => setTimeout(e, t * 1000));
|
||||
}
|
||||
ts(type = false, _data = "") {
|
||||
let myDate = new Date();
|
||||
let a = "";
|
||||
switch (type) {
|
||||
case 10:
|
||||
a = Math.round(new Date().getTime() / 1000).toString();
|
||||
break;
|
||||
case 13:
|
||||
a = Math.round(new Date().getTime()).toString();
|
||||
break;
|
||||
case "h":
|
||||
a = myDate.getHours();
|
||||
break;
|
||||
case "m":
|
||||
a = myDate.getMinutes();
|
||||
break;
|
||||
case "y":
|
||||
a = myDate.getFullYear();
|
||||
break;
|
||||
case "h":
|
||||
a = myDate.getHours();
|
||||
break;
|
||||
case "mo":
|
||||
a = myDate.getMonth();
|
||||
break;
|
||||
case "d":
|
||||
a = myDate.getDate();
|
||||
break;
|
||||
case "ts2Data":
|
||||
if (_data != "") {
|
||||
time = _data;
|
||||
if (time.toString().length == 13) {
|
||||
let date = new Date(time + 8 * 3600 * 1000);
|
||||
a = date.toJSON().substr(0, 19).replace("T", " ");
|
||||
} else if (time.toString().length == 10) {
|
||||
time = time * 1000;
|
||||
let date = new Date(time + 8 * 3600 * 1000);
|
||||
a = date.toJSON().substr(0, 19).replace("T", " ");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
a = "未知错误,请检查";
|
||||
break;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
doubleLog(a) {
|
||||
console.log(` ${a}`);
|
||||
msg += `\n ${a}`;
|
||||
}
|
||||
async done(t = {}) {
|
||||
await $.SendMsg(msg);
|
||||
const e = new Date().getTime(),
|
||||
s = (e - this.startTime) / 1e3;
|
||||
console.log(`\n${this.name} 运行结束,共运行了 ${s} 秒!`);
|
||||
}
|
||||
})(name, env);
|
||||
}
|
||||
956
wxapp/zhanma.js
Normal file
956
wxapp/zhanma.js
Normal file
File diff suppressed because one or more lines are too long
517
wxapp/zippo.js
Normal file
517
wxapp/zippo.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user