此代码由日赚3万网autojs开发交流群整理提供,欢迎大家一起技术交流,查看更多脚本和源码: 点击一键加群。如有侵权,请联系我删除!
// 单机收入30+,长期稳定。包含 (恋恋_红心、恋恋_他她、巧遇_老、果聊、恋夜等几十种聊天平台)
function 检查重名app(例外app) {
if (例外app == "恋恋_红心") {
let 临时app名 = app.getAppName("com.imdw.lianlian")
if (临时app名 != null) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
} else if (例外app == "恋恋_他她") {
let 临时app名 = app.getAppName("com.oos.greenface.app")
if (临时app名 != null) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
} else if (例外app == "巧遇_老") {
let 临时app名 = app.getAppName("com.lanhu.qiaoyu")
if (临时app名 != null) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
} else if (例外app == "果聊") {
let 临时app名 = app.getAppName("company.newchat.coquettish.android")
if (临时app名 != null) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
} else if (例外app == "恋夜") {
let 临时app名 = app.getAppName("com.qiaoyu.chat")
if (临时app名 != null) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
} else if (例外app == "知心_原知己") {
let 临时app名 = app.getAppName("com.qianqianonechart.online")
if (临时app名 != null) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
} else if (例外app == "小月亮新") {
let 临时app名 = app.getAppName("com.smallmoon.app")
if (临时app名 != null) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
} else if (例外app == "新魅聊") {
let 临时app名 = app.getAppName("com.meiliao.chat")
if (临时app名 != null) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
} else if (例外app == "红颜新") {
let 临时app名 = app.getAppName("com.chaodong.fate.android")
if (临时app名) {
ui.详情.setText(例外app + "(已安装)");
ui.下载app.attr("w", "0dp");
return
}
}
ui.详情.setText(例外app + "(未安装)");
ui.下载app.attr("w", "40dp");
//有重名app才要改
}
function 更改图标(app记录) {
ui.app图片.attr("src", 软件[app记录].src)
// ui.app名字.setText(app记录)
if (getPackageName(app记录)) {//通过app名字找报名
ui.详情.setText(app记录 + "(已安装)");
ui.下载app.attr("w", "0dp");
} else {
检查重名app(app记录)
}
}
function 文本ui(标题名称, 文本, 返回ui) {
ui.layout(
'<vertical>\
<appbar bg="#1C1C1C" >\
<horizontal>\
<img id="返回" w="50" h="50" tint="#F5F5F5" src="@drawable/ic_keyboard_arrow_left_black_48dp" />\
<text id="标题名称" layout_gravity="center" text="" textColor="#FFFAFA" textSize="20sp" textStyle="bold" marginLeft="80" />\
</horizontal>\
</appbar>\
<text id="文本" text="" textColor="#000000" textSize="15sp" />\
</vertical>'
);
ui.标题名称.setText(标题名称);
ui.返回.on("click", () => {
if (返回ui == "登陆ui") {
登陆ui();
} else if (返回ui == "首页ui") {
首页ui();
}
})
}
//开发者ID (后台 左上角头像下方的ID)
var DeveloperID = "13417";
//API 密码 (后台 设置中的 接口安全密码)
var ApiPassword = "786744";
//软件名称
var SoftwareName = "zdyqfd";
//本地存储空间 对象
var LocalStorage = storages.create("QQ_296617805");
/**
* CDK登陆
*/
function CDKLogin() {
CDK = storage.get("CDK");
//退出上一次的Needle
var logoutResult = LogoutNeedle();
console.log(logoutResult[1]);
var loginResult = SendQLRequest(
"apiv3/card_login",
"card=" + CDK + "&software=" + SoftwareName
);
if (loginResult[0]) {
var successData = loginResult[1];
var endTime = successData["endtime"];
var lessTime = successData["less_time"];
var needle = successData["needle"];
PutSt("oldNeedle", needle); //存储本次 的Needle
console.log(needle + "登陆成功");
loginResults = true;
toast(lessTime);
threads.start(function() {
SendHeartbeat(needle);
});
} else {
var failResult = loginResult[1];
console.warn("CDKLogin FailMsg:" + failResult);
console.warn("所有线程已经停止!");
threads.shutDownAll(); //停止所有线程
}
}
/**
* 退出上一次的Needle
*/
function LogoutNeedle() {
var oldNeedle = GetSt("oldNeedle", "");
if (oldNeedle != "") {
var logoutResult = SendQLRequest(
"apiv3/card_logout",
"card=" + CDK + "&needle=" + oldNeedle
);
if (logoutResult[0]) {
return [true, oldNeedle + " 退出成功!"];
} else {
return [false, oldNeedle & " 退出失败!"];
}
} else {
return [true, "上次无存储的Needle"];
}
}
/**
* 卡密心跳
* @param {string} cdkNeedle
*/
function SendHeartbeat(cdkNeedle) {
do {
var heartbeatResult = SendQLRequest(
"apiv3/card_ping",
"card=" + CDK + "&software=" + SoftwareName + "&needle=" + cdkNeedle
);
if (heartbeatResult[0]) {
var successData = heartbeatResult[1];
var endTime = successData["endtime"];
var lessTime = successData["less_time"];
console.warn("心跳正常. 剩余时间:" + lessTime);
sleep(5 * 60 * 1000); //休息5分钟
} else {
var failResult = heartbeatResult[1];
console.warn("Heartbeat FailMsg:" + failResult);
console.warn("所有线程已经停止!");
threads.shutDownAll(); //停止所有线程
}
} while (true);
}
/**
* 访问权朗api
* @param {string}} api
* @param {string} apiParams
*/
function SendQLRequest(api, apiParams) {
var qlHostArray = [
"https://napi.2cccc.cc/",
"https://api2.2cccc.cc/",
"https://api3.2cccc.cc/"
];
var connectTimes = 0;
var taoBaoTimeStamp = "";
do {
connectTimes = connectTimes + 1;
taoBaoTimeStamp = http
.get("http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp")
.body.string();
if (connectTimes > 10) {
console.log("淘宝时间戳超时");
return [false, "连接淘宝时间戳服务器失败"];
}
} while (taoBaoTimeStamp.substring(2, 5) != "api");
taoBaoTimeStamp = JSON.parse(taoBaoTimeStamp);
var timeStamp = taoBaoTimeStamp["data"]["t"].substring(0, 10);
var sign = HexMd5(ApiPassword + "" + timeStamp);
var common_params =
"center_id=" + DeveloperID + "×tamp=" + timeStamp + "&sign=" + sign;
connectTimes = 0;
var qlResult = "";
do {
connectTimes = connectTimes + 1;
qlResult = http
.get(
qlHostArray[Math.floor(Math.random() * (3 - 0) + 0)] +
api +
"?" +
common_params +
"&" +
apiParams
)
.body.string();
if (connectTimes > 10) {
return [false, "权朗回执超时"];
}
} while (qlResult.substring(2, 6) != "code");
qlResult = JSON.parse(qlResult);
if (qlResult["code"] == "1") {
if (
HexMd5(qlResult["timestamp"] + ApiPassword).toUpperCase() ==
qlResult["sign"].toUpperCase() &&
Math.abs(timeStamp - qlResult["timestamp"]) < 700
) {
return [true, qlResult["data"]];
} else {
return [false, "请检查API密码是否填写正确"];
}
} else {
return [false, qlResult["msg"]];
}
}
//--------Helper---------
/**
* 判断是否 不是 空
* @param {any}} content 内容
*/
function IsNotNullOrEmpty(content) {
return (
content != null &&
content != undefined &&
content != "" &&
content != " " &&
content != " "
);
}
/**
* 存储空间 存入 键值数据
* @param {string} key 键名
* @param {any} value 值
*/
function PutSt(key, value) {
// cw(key + " : " + value);
if (IsNotNullOrEmpty(value)) {
LocalStorage.put(key, value);
} else {
//cw("key:" + key + "----> value为空,跳过保存");
}
}
/**
* 获取 存储控件中的 数据
* @param {string} key 键名
* @param {any} defaultValue 默认值
*/
function GetSt(key, defaultValue) {
var data = LocalStorage.get(key);
// cw(key + " : " + data);
if (IsNotNullOrEmpty(data)) {
return data;
} else {
if (defaultValue == undefined) {
defaultValue = "";
}
//cw(key + " : 返回默认值->>" + defaultValue);
return defaultValue;
}
}
//-------------------------------------