所有分类
  • 所有分类
  • 会员专享
  • 源码区
  • API/辅助/网盘
  • qc菠菜打赏
  • 云IDC
  • 免挂聚合支付
  • 切片转码
  • 发卡盟商铺
  • 导航/引导
  • 封装打包/免/签名
  • 小程序/公众号
  • 应用/APP/程序

最新版

1.新增AES加密,login请求,返回AES加密后的数据,AES密码可在后台自定义
2.修复偶然情况下,卡密解绑后再次登录无法绑定的问题
3.优化数据表,去掉冗余数据

超级详细搭建教程:https://www.bilibili.com/video/BV1Eg411v7t6/
API请求文档:https://www.yuque.com/idouyin/okmrhr/yd7xtr

授权代码

/**
 * Auth:乐抖共创
 * QQ:57466335
 * 功能:网络验证
 * time:2022-11-18
 */
var The_App = {
    'Sever': 'http://192.168.137.1/api/app/',   //接口地址---更改成你的服务器地址
    'Safecode': 'bihevq4e6pb7n5q8duse12luq',    //软件安全码---更改成你的软件安全吗
    'Aeskey': '123456789jd67880',               //AES加密key,即网络验证软件设置中的自定义码,后台可自行修改。---后台修改下,这个是默认值!
    'version': '2.21'                           //当前软件版本
}
 
var Key = 'MZK9JHREM4XEYQ'               //软件登录卡密,一般在UI中,由用户输入
var Mcode = device.getAndroidId();       //机器码,安卓高版本已无法取IMEI,此处取安卓ID,
 
 
//监听脚本退出,退出执行App_Logout
events.on("exit", function () {
    App_Logout(Key)
    log("结束运行");
});
 
 
 
App_Init()
 
/**
 * 软件初始化,一般UI界面加载完成的时候,加载本方法,判断软件是否运营,是否更新新版本等..
 */
function App_Init() {
    var res = App_http('appinit', false, Key);
    if (res) {
        if (res.code == 1) {
            console.log('初始化成功');
            if (res.data.veision != The_App.version) {
                console.log('检测到新版本');
                console.log(res.data.notice);
            }
        }
        if (res.code == 0) {
            console.log('软件已停止运营');
            exit();
        }
        if (res.code == 9) {
            console.log('初始化失败,软件不存在');
            exit();
        }
    }
}
 
/**
 * 卡密登录,返回结果AES加密处理
 * 可根据实际需求返回自己需要的数据
 * <a href="https://bbs.125.la/home.php?mod=space&uid=275307" target="_blank">@param</a> {string} key 卡密
 * @returns 成功返回true;失败返回false
 */
function App_Login(key) {
    var res = App_http('login', true, key);
    if (res) {
        if (res.code == 1 && res.data.login == true) {
            return true
        }
    }
    return false;
}
 
/**
 * 退出登录,脚本退出的时候,可直接设置监听脚本退出,退出执行
 * 例如
 * events.on("exit", function(){
 *    App_Logout(Key)
 *    log("结束运行");
 * });
 * @param {string} key 
 * @returns 退出成功返回true
 */
function App_Logout(key) {
    var res = App_http('logout', false, key);
    if (res) {
        if (res.code == 1) {
            return true
        }
    }
    return false;
}
 
/**
 * 卡密解绑,不建议脚本开启,可后台手动解绑
 * 可根据实际需求返回自己需要的数据
 * @param {string} key 卡密
 * @returns 成功返回true;失败返回false
 */
function App_Unbind(key) {
    var res = App_http('unbind', false, key);
    if (res) {
        if (res.code == 1) {
            console.log('解绑成功');
            return true;
        } else {
            console.log(res.msg);
            return false;
        }
    }
    return false;
}
 
/**
 * http请求
 * @param {string} action 接口字段
 * @param {string} isaes 是否AES加密
 * @param {string} key 卡密
 * @returns 
 */
function App_http(action, isaes, key) {
    try {
        var res = http.post(The_App.Sever + action, {
            "safecode": The_App.Safecode,
            'key': key,
            'mcode': Mcode
        })
        if (isaes) {
            var result = res.body.string();
            let key = new $crypto.Key(The_App.Aeskey);
            result = $crypto.decrypt(result, key, "AES", {
                "input": "base64",
                "output": "string"
            });
            result = JSON.parse(result);
            console.log(result);
        } else {
            return res.body.json();
        }
    } catch (error) {
        console.log(error);
    }
    return false;
}
资源下载
下载价格VIP专享
仅限VIP下载升级VIP
0

评论0

没有账号?注册  忘记密码?