普通交流群698307198欢迎加入v群,和各位大神一同交流
免责声明:本博客提供的所有内容仅供学习、分享与交流,我们不保证内容的正确性。通过使用本博客内容随之而来的问题与本博客无关。当使用本博客代码时,代表你已接受本博客的免责声明

正文部分

  if(device.sdkInt<29){id = device.getIMEI();}else{id = device.getAndroidId();}

完整pjysdk修改版,直接复制即可.或者进群下载.

const PJYSDK = (function(){function PJYSDK(app_key, app_secret){http.__okhttp__.setMaxRetries(0);http.__okhttp__.setTimeout(10*1000);this.event = events.emitter();this.debug = true;this._lib_version = "v1.08";this._protocol = "https";this._host = "api.paojiaoyun.com";this._device_id = this.getDeviceID();this._retry_count = 9;this._app_key = app_key;this._app_secret = app_secret;this._card = null;this._username = null;this._password = null;this._token = null;this.is_trial = false;  // 是否是试用用户this.login_result = {"card_type": "","expires": "","expires_ts": 0,"config": "",};this._auto_heartbeat = true;  // 是否自动开启心跳任务this._heartbeat_gap = 60 * 1000; // 默认60秒this._heartbeat_task = null;this._heartbeat_ret = {"code": -9, "message": "还未开始验证"};this._prev_nonce = null;}PJYSDK.prototype.SetCard = function(card) {this._card = card.trim();}PJYSDK.prototype.SetUser = function(username, password) {this._username = username.trim();this._password = password;}PJYSDK.prototype.getDeviceID = function() {let id = device.serial;if(device.sdkInt<29){id = device.getIMEI();}else{id = device.getAndroidId();}//九黎修改的部分,之后就不会提示出错了return id;}PJYSDK.prototype.MD5 = function(str) {try {let digest = java.security.MessageDigest.getInstance("md5");let result = digest.digest(new java.lang.String(str).getBytes("UTF-8"));let buffer = new java.lang.StringBuffer();for (let index = 0; index < result.length; index++) {let b = result[index];let number = b & 0xff;let str = java.lang.Integer.toHexString(number);if (str.length == 1) {buffer.append("0");}buffer.append(str);}return buffer.toString();} catch (error) {alert(error);return "";}}PJYSDK.prototype.getTimestamp = function() {try {let res = http.get("http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp");let data = res.body.json();return Math.floor(data["data"]["t"]/1000);} catch (error) {return Math.floor(new Date().getTime()/1000);}}PJYSDK.prototype.genNonce = function() {const ascii_str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';let tmp = '';for(let i = 0; i < 20; i++) {tmp += ascii_str.charAt(Math.round(Math.random()*ascii_str.length));}return this.MD5(this.getDeviceID() + tmp);}PJYSDK.prototype.joinParams = function(params) {let ps = [];for (let k in params) {ps.push(k + "=" + params[k])}ps.sort()return ps.join("&")}PJYSDK.prototype.CheckRespSign = function(resp) {if (resp.code != 0 && resp.nonce === "" && resp.sign === "") {return resp}let ps = "";if (resp["result"]) {ps = this.joinParams(resp["result"]);}let s = resp["code"] + resp["message"] + ps + resp["nonce"] + this._app_secret;let sign = this.MD5(s);if (sign === resp["sign"]) {if (this._prev_nonce === null) {this._prev_nonce = resp["nonce"];return {"code":0, "message":"OK"};} else {if (resp["nonce"] > this._prev_nonce) {this._prev_nonce = resp["nonce"];return {"code": 0, "message": "OK"};} else {return {"code": -98, "message": "轻点,疼~"};}}}return {"code": -99, "message": "轻点,疼~"};}PJYSDK.prototype.retry_fib = function(num) {if (num > 9) {return 34}let a = 0;let b = 1;for (i = 0; i < num; i++) {let tmp = a + b;a = bb = tmp}return a}PJYSDK.prototype._debug = function(path, params, result) {if (this.debug) {log("\n" + path, "\nparams:", params, "\nresult:", result);}}PJYSDK.prototype.Request = function(method, path, params) {// 构建公共参数params["app_key"] = this._app_key;method = method.toUpperCase();let url = this._protocol + "://" + this._host + pathlet max_retries = this._retry_count;let retries_count = 0;let data = {"code": -1, "message": "连接服务器失败"};do {retries_count++;let sec = this.retry_fib(retries_count);delete params["sign"]params["nonce"] = this.genNonce();params["timestamp"] = this.getTimestamp();let ps = this.joinParams(params);let s = method + this._host + path + ps + this._app_secret;let sign = this.MD5(s);params["sign"] = sign;let resp, body;try {    if (method === "GET") {resp = http.get(url + "?" + ps + "&sign=" + sign);} else {  // POSTresp = http.post(url, params);}body = resp.body.string();data = JSON.parse(body);this._debug(method+'-'+path+':', params, data);let crs = this.CheckRespSign(data);if (crs.code !== 0) {return crs;} else {return data;}} catch (error) {log("[*] request error: ", error, sec + "s后重试");this._debug(method+'-'+path+':', params, body)sleep(sec*1000);}} while (retries_count < max_retries);return data;}/* 通用 */PJYSDK.prototype.GetHeartbeatResult = function() {return this._heartbeat_ret;}PJYSDK.prototype.GetTimeRemaining = function() {let g = this.login_result.expires_ts - this.getTimestamp();if (g < 0) {return 0;} return g;}/* 卡密相关 */PJYSDK.prototype.CardLogin = function() {  // 卡密登录if (!this._card) {return {"code": -4, "message": "请先设置卡密"};}let method = "POST";let path = "/v1/card/login";let data = {"card": this._card, "device_id": this._device_id};let ret = this.Request(method, path, data);if (ret.code == 0) {this._token = ret.result.token;this.login_result = ret.result;if (this._auto_heartbeat) {this._startCardHeartheat();}}return ret;}PJYSDK.prototype.CardHeartbeat = function() {  // 卡密心跳,默认会自动调用if (!this._token) {return {"code": -2, "message": "请在卡密登录成功后调用"};}let method = "POST";let path = "/v1/card/heartbeat";let data = {"card": this._card, "token": this._token};let ret = this.Request(method, path, data);if (ret.code == 0) {this.login_result.expires = ret.result.expires;this.login_result.expires_ts = ret.result.expires_ts;}return ret;}PJYSDK.prototype._startCardHeartheat = function() {  // 开启卡密心跳任务if (this._heartbeat_task) {this._heartbeat_task.interrupt();this._heartbeat_task = null;}this._heartbeat_task = threads.start(function(){setInterval(function(){}, 10000);});this._heartbeat_ret = this.CardHeartbeat();this._heartbeat_task.setInterval((self) => {self._heartbeat_ret = self.CardHeartbeat();if (self._heartbeat_ret.code != 0) {self.event.emit("heartbeat_failed", self._heartbeat_ret);}}, this._heartbeat_gap, this);this._heartbeat_task.setInterval((self) => {if (self.GetTimeRemaining() == 0) {self.event.emit("heartbeat_failed", {"code": 10210, "message": "卡密已过期!"});}}, 1000, this);}PJYSDK.prototype.CardLogout = function() {  // 卡密退出登录this._heartbeat_ret = {"code": -9, "message": "还未开始验证"};if (this._heartbeat_task) { // 结束心跳任务this._heartbeat_task.interrupt();this._heartbeat_task = null;}if (!this._token) {return {"code": 0, "message": "OK"};}let method = "POST";let path = "/v1/card/logout";let data = {"card": this._card, "token": this._token};let ret = this.Request(method, path, data);// 清理this._token = null;this.login_result = {"card_type": "","expires": "","expires_ts": 0,"config": "",};return ret;}PJYSDK.prototype.CardUnbindDevice = function() { // 卡密解绑设备,需开发者后台配置if (!this._token) {return {"code": -2, "message": "请在卡密登录成功后调用"};}let method = "POST";let path = "/v1/card/unbind_device";let data = {"card": this._card, "device_id": this._device_id, "token": this._token};return this.Request(method, path, data);}PJYSDK.prototype.SetCardUnbindPassword = function(password) { // 自定义设置解绑密码if (!this._token) {return {"code": -2, "message": "请在卡密登录成功后调用"};}let method = "POST";let path = "/v1/card/unbind_password";let data = {"card": this._card, "password": password, "token": this._token};return this.Request(method, path, data);}PJYSDK.prototype.CardUnbindDeviceByPassword = function(password) { // 用户通过解绑密码解绑设备let method = "POST";let path = "/v1/card/unbind_device/by_password";let data = {"card": this._card, "password": password};return this.Request(method, path, data);}PJYSDK.prototype.CardRecharge = function(card, use_card) { // 以卡充卡let method = "POST";let path = "/v1/card/recharge";let data = {"card": card, "use_card": use_card};return this.Request(method, path, data);}/* 用户相关 */PJYSDK.prototype.UserRegister = function(username, password, card) {  // 用户注册(通过卡密)let method = "POST";let path = "/v1/user/register";let data = {"username": username, "password": password, "card": card, "device_id": this._device_id};return this.Request(method, path, data);}PJYSDK.prototype.UserLogin = function() {  // 用户账号登录if (!this._username || !this._password) {return {"code": -4, "message": "请先设置用户账号密码"};}let method = "POST";let path = "/v1/user/login";let data = {"username": this._username, "password": this._password, "device_id": this._device_id};let ret = this.Request(method, path, data);if (ret.code == 0) {this._token = ret.result.token;this.login_result = ret.result;if (this._auto_heartbeat) {this._startUserHeartheat();}}return ret;}PJYSDK.prototype.UserHeartbeat = function() {  // 用户心跳,默认会自动开启if (!this._token) {return {"code": -2, "message": "请在用户登录成功后调用"};}let method = "POST";let path = "/v1/user/heartbeat";let data = {"username": this._username, "token": this._token};let ret = this.Request(method, path, data);if (ret.code == 0) {this.login_result.expires = ret.result.expires;this.login_result.expires_ts = ret.result.expires_ts;}return ret;}PJYSDK.prototype._startUserHeartheat = function() {  // 开启用户心跳任务if (this._heartbeat_task) {this._heartbeat_task.interrupt();this._heartbeat_task = null;}this._heartbeat_task = threads.start(function(){setInterval(function(){}, 10000);});this._heartbeat_ret = this.UserHeartbeat();this._heartbeat_task.setInterval((self) => {self._heartbeat_ret = self.UserHeartbeat();if (self._heartbeat_ret.code != 0) {self.event.emit("heartbeat_failed", self._heartbeat_ret);}}, this._heartbeat_gap, this);this._heartbeat_task.setInterval((self) => {if (self.GetTimeRemaining() == 0) {self.event.emit("heartbeat_failed", {"code": 10250, "message": "用户已到期!"});}}, 1000, this);}PJYSDK.prototype.UserLogout = function() {  // 用户退出登录this._heartbeat_ret = {"code": -9, "message": "还未开始验证"};if (this._heartbeat_task) { // 结束心跳任务this._heartbeat_task.interrupt();this._heartbeat_task = null;}if (!this._token) {return {"code": 0, "message": "OK"};}let method = "POST";let path = "/v1/user/logout";let data = {"username": this._username, "token": this._token};let ret = this.Request(method, path, data);// 清理this._token = null;this.login_result = {"card_type": "","expires": "","expires_ts": 0,"config": "",};return ret;}PJYSDK.prototype.UserChangePassword = function(username, password, new_password) {  // 用户修改密码let method = "POST";let path = "/v1/user/password";let data = {"username": username, "password": password, "new_password": new_password};return this.Request(method, path, data);}PJYSDK.prototype.UserRecharge = function(username, card) { // 用户通过卡密充值let method = "POST";let path = "/v1/user/recharge";let data = {"username": username, "card": card};return this.Request(method, path, data);}PJYSDK.prototype.UserUnbindDevice = function() { // 用户解绑设备,需开发者后台配置if (!this._token) {return {"code": -2, "message": "请在用户登录成功后调用"};}let method = "POST";let path = "/v1/user/unbind_device";let data = {"username": this._username, "device_id": this._device_id, "token": this._token};return this.Request(method, path, data);}/* 配置相关 */PJYSDK.prototype.GetCardConfig = function() { // 获取卡密配置let method = "GET";let path = "/v1/card/config";let data = {"card": this._card};return this.Request(method, path, data);}PJYSDK.prototype.UpdateCardConfig = function(config) { // 更新卡密配置let method = "POST";let path = "/v1/card/config";let data = {"card": this._card, "config": config};return this.Request(method, path, data);}PJYSDK.prototype.GetUserConfig = function() { // 获取用户配置let method = "GET";let path = "/v1/user/config";let data = {"user": this._username};return this.Request(method, path, data);}PJYSDK.prototype.UpdateUserConfig = function(config) { // 更新用户配置let method = "POST";let path = "/v1/user/config";let data = {"username": this._username, "config": config};return this.Request(method, path, data);}/* 软件相关 */PJYSDK.prototype.GetSoftwareConfig = function() { // 获取软件配置let method = "GET";let path = "/v1/software/config";return this.Request(method, path, {});}PJYSDK.prototype.GetSoftwareNotice = function() { // 获取软件通知let method = "GET";let path = "/v1/software/notice";return this.Request(method, path, {});}PJYSDK.prototype.GetSoftwareLatestVersion = function(current_ver) { // 获取软件最新版本let method = "GET";let path = "/v1/software/latest_ver";let data = {"version": current_ver};return this.Request(method, path, data);}/* 试用功能 */PJYSDK.prototype.TrialLogin = function() {  // 试用登录let method = "POST";let path = "/v1/trial/login";let data = {"device_id": this._device_id};let ret = this.Request(method, path, data);if (ret.code == 0) {this.is_trial = true;this.login_result = ret.result;if (this._auto_heartbeat) {this._startTrialHeartheat();}}return ret;}PJYSDK.prototype.TrialHeartbeat = function() {  // 试用心跳,默认会自动调用let method = "POST";let path = "/v1/trial/heartbeat";let data = {"device_id": this._device_id};let ret = this.Request(method, path, data);if (ret.code == 0) {this.login_result.expires = ret.result.expires;this.login_result.expires_ts = ret.result.expires_ts;}return ret;}PJYSDK.prototype._startTrialHeartheat = function() {  // 开启试用心跳任务if (this._heartbeat_task) {this._heartbeat_task.interrupt();this._heartbeat_task = null;}this._heartbeat_task = threads.start(function(){setInterval(function(){}, 10000);});this._heartbeat_ret = this.TrialHeartbeat();this._heartbeat_task.setInterval((self) => {self._heartbeat_ret = self.TrialHeartbeat();if (self._heartbeat_ret.code != 0) {self.event.emit("heartbeat_failed", self._heartbeat_ret);}}, this._heartbeat_gap, this);this._heartbeat_task.setInterval((self) => {if (self.GetTimeRemaining() == 0) {self.event.emit("heartbeat_failed", {"code": 10407, "message": "试用已到期!"});}}, 1000, this);}PJYSDK.prototype.TrialLogout = function() {  // 试用退出登录,没有http请求,只是清理本地记录this.is_trial = false;this._heartbeat_ret = {"code": -9, "message": "还未开始验证"};if (this._heartbeat_task) { // 结束心跳任务this._heartbeat_task.interrupt();this._heartbeat_task = null;}// 清理this._token = null;this.login_result = {"card_type": "","expires": "","expires_ts": 0,"config": "",};return {"code": 0, "message": "OK"};;}/* 高级功能 */PJYSDK.prototype.GetRemoteVar = function(key) { // 获取远程变量let method = "GET";let path = "/v1/af/remote_var";let data = {"key": key};return this.Request(method, path, data);}PJYSDK.prototype.GetRemoteData = function(key) { // 获取远程数据let method = "GET";let path = "/v1/af/remote_data";let data = {"key": key};return this.Request(method, path, data);}PJYSDK.prototype.CreateRemoteData = function(key, value) { // 创建远程数据let method = "POST";let path = "/v1/af/remote_data";let data = {"action": "create", "key": key, "value": value};return this.Request(method, path, data);}PJYSDK.prototype.UpdateRemoteData = function(key, value) { // 修改远程数据let method = "POST";let path = "/v1/af/remote_data";let data = {"action": "update", "key": key, "value": value};return this.Request(method, path, data);}PJYSDK.prototype.DeleteRemoteData = function(key, value) { // 删除远程数据let method = "POST";let path = "/v1/af/remote_data";let data = {"action": "delete", "key": key};return this.Request(method, path, data);}PJYSDK.prototype.CallRemoteFunc = function(func_name, params) { // 执行远程函数let method = "POST";let path = "/v1/af/call_remote_func";let ps = JSON.stringify(params);let data = {"func_name": func_name, "params": ps};let ret = this.Request(method, path, data);if (ret.code == 0 && ret.result.return) {ret.result = JSON.parse(ret.result.return);}return ret;}return PJYSDK;
})();

效果图

参考文章

.

所属软件

声明

部分内容来自网络
本教程仅用于学习, 禁止用于其他用途

QQ群

698307198
扫一扫二维码,加入群聊.QQ

说明:
本文提供的代码仅供参考。
有些地方可能在最新版本的Auto.js上面需要做修改,才能运行的.如果不理解,可以加群询问.

Auto.js简介
Auto.js是利用安卓系统的“辅助功能”实现类似于按键精灵,触摸精灵.懒人精灵等一样,可以通过代码模拟一系列界面动作的辅助工作。
而与“按键精灵”不同的是,它的模拟动作并不是简单的使用在界面定坐标点来实现,而是类似与win一般,找窗口句柄来实现的。通过控件点击可以实现全分辨率的模拟人工点击效果

Auto.js使用JavaScript作为脚本语言,目前使用Rhino 1.7.7.2作为脚本引擎,支持ES5与部分ES6特性。新的autojs pro9系列可以使用node.js开发

开发文档
Auto.js Pro开发文档:点击这里

文档尚在完善中,可能有文档描述和代码实际行为有出入的情况。

为什么要使用Auto.js Pro开发脚本,有什么特点?

吸引我使用Auto.js Pro的原因有很多。最主要的几个原因是:

  1. Auto.js Pro能开发免ROOT的安卓脚本 Auto.js Pro基于节点操作,能开发全分辨率的脚本,自动适配各种安卓机型
  2. 可以使用手机开发,这使得开发者更多,有更多代码可以参考学习.在此也欢迎加入九黎的vip群,目前已经收集或者开发了大概4000余代码,覆盖各个分类.
  3. Auto.js Pro丰富的UI组件,能自定义各种样式的安卓界面 Auto.js.并且可以使用原生xml
  4. Pro使用的javascript的语法比较优雅,代码可读性强 Auto.js Pro的命令库非常的丰富,接口比较多 Auto.js
  5. Pro脚本文件体积比较小。1000行的代码,打包后的apk文件只有3-5M,还没有广告
    相关教程
    点击这里看更多 Auto.js Pro教程

autojs安卓10,11泡椒云提示无法读取imei码解决方案相关推荐

  1. 魅族X8可以更新Android10吗,【魅族】Note8/X8永远停在了安卓9 无缘安卓10 11更是遥遥无期...

    原标题:[魅族]Note8/X8永远停在了安卓9 无缘安卓10 11更是遥遥无期 在5月举行的魅族17系列发布会上魅族曾预热旗下机型正在适配Android 10,6月份官方预告了除魅族17系列外其他机 ...

  2. mac os x 10.11 php7,mac osx 10.11.2安装PHP7提示“configure: error: libcrypto not found!”

    刚升级到了最新的系统OS X 10.11.2,在安装PHP7时 ./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/lo ...

  3. vivo OPPO iQOO 一加 真我 手撕 安卓10 11 12手撕方案

    OPPO Find N|Find X5 Pro|Find X5|Find X5 Pro 天玑版|Find X3 Pro|Find X3|Find X2|Reno8 Pro+|Reno8 Pro|Ren ...

  4. Android 11.0 根据包名授予读取IMEI权限

    目录 1.概述 2.根据包名授予读取IMEI权限的核心类 3.根据包名授予读取IMEI权限的核心功能实现和分析

  5. 11 Halcon 点云平面交线计算

    /******************************************************************************* @文档名称: 基于点云的平面交线计算. ...

  6. 红米8a的android版本是多少,小米Redmi 8A推送最新MIUI 11稳定版 基于安卓10大版本

    剑客网7月28日消息 据网友反馈一款小米去年发布的入门机小米Redmi 8A现在获得基于安卓10大版本的MIUI 11最新稳定版更新,此次更新并没有太多的新增内容和改进,更新的版本号为版本号为V11. ...

  7. 谷歌首提Android11,谷歌官方首次提及Android 11系统 谷歌推动安卓10.0系统下载

    10月11日消息,谷歌此前全力推动Android 10 的采用,2019年Android开发者峰会将于本月晚些时候正式拉开帷幕.有趣的是, 在会议日程中谷歌官方首次提到了Android 11,谷歌下一 ...

  8. coloros11跟Android,安卓10与安卓11究竟差异在哪里?我们拿这两台新机试了一下

    9 月 24 日,OPPO 带着全新的 ColorOS 11 与我们正式见面,这一基于安卓 11 底层深度打造的新系统给我们带来了不少新特性.而就在 ColorOS 11 发布的前些天,华为也为我们带 ...

  9. android10和11,安卓10与安卓11究竟差异在哪里?我们拿这两台新机试了一下

    原标题:安卓10与安卓11究竟差异在哪里?我们拿这两台新机试了一下 9 月 24 日,OPPO 带着全新的 ColorOS 11 与我们正式见面,这一基于安卓 11 底层深度打造的新系统给我们带来了不 ...

最新文章

  1. bing浏览器_微软推出全新 Edge 浏览器,这 3 大特色亮点 Chrome 都没有
  2. 下载了一堆mysql_干掉一堆mysql数据库,仅需这样一个shell脚本
  3. php session不生效_php 验证session无效问题解决办法
  4. Android换肤逻辑
  5. 8个JavaScript库可更好地处理本地存储
  6. windows 禁用ipv6服务_在 Windows 7 中禁用IPv6协议/IPv6隧道
  7. 实例14:python
  8. php无限评论回复_php实现无限级评论功能_后端开发
  9. 谷粒商城高级篇爬坑笔记--错误异常信息乱码问题
  10. java map 对象作为key_Java 将自定义的对象作为HashMap的key
  11. js 数字格式化,只能输入正负整数,小数
  12. 新增对象Products 的流程说明
  13. C# AForge视频录像
  14. lora终端连接云服务器_一种LoRa服务器及其数据传输方法与流程
  15. CentOS 安装SVN以及可视化管理工具iF.SVNAdmin
  16. 70周年国庆,34个省级行政区前来祝贺
  17. 如何查看、检测Windows XP-Windows10系统是否为正版
  18. vue 数组 unshift push shift pop
  19. 【不忘初心】经典珍藏 LTSB|1709|1809|LTSC 四版集合八合一[纯净精简版]2020.07.20
  20. RxSwift核心逻辑

热门文章

  1. 精简指令集结构(Reduced Instruction Set Computer,RISC)
  2. x86汇编_短路求值-AND / OR运算符_笔记_39
  3. MOSS SDK学习(3)
  4. react-next 引入阿里云iconfont 图标(适用所有)
  5. 软连接ln -s 创建以及删除
  6. 浙江理工c语言复试试题,2016年浙江理工大学信息学院C语言程序设计复试笔试最后押题五套卷...
  7. node.js 后台代码怎么部署到服务器上?
  8. Android Studio在项目文件夹/build/intermediates/下找不到bundles文件夹和packaged-classes文件夹
  9. 蜂鸟E200模块分析——IFU:Simple-BPU
  10. 简单的人工智能背景调查