EasyClick常见拓展函数及应用

 十天学会从入门到实战游戏脚本开发教程--EassyClick入门教程:2024 十天学会EasyClick从入门到实战,自动化脚本,游戏脚本开发系列教程_哔哩哔哩_bilibili2024 十天学会EasyClick从入门到实战,自动化脚本,游戏脚本开发系列教程共计32条视频,包括:学习EasyClick的目的和官网简介、EC开发工具安装与破解、创建第一个项目等,UP主更多精彩视频,请关注UP账号。icon-default.png?t=N7T8https://www.bilibili.com/video/BV1RJ4m1K7A4/?spm_id_from=333.337.search-card.all.click&vd_source=27c8ea1c143ecfe9f586177e5e7027cf

easyclick与十八罗汉的故事故事纯属虚构,仅此娱乐

easyclick自动化游戏脚本的世界中,有一个达阵,他的名字叫做十八罗汉。这个方阵进可攻、退可守,每一次利用节点和图色按键都像是一次次魔法的释放,让游戏中的角色变得更加智慧、更加灵活。

魔法键盘师曾经听说过一个传说,关于十八罗汉的故事。据说,在游戏的深处,有一批EC的函数库,被称为十八罗汉,他们拥有无比强大的力量,掌握着游戏世界的秘密。

一天,魔法键盘师决定挑战自己,探索十八罗汉的奥秘。他编写了一个特殊的EasyClick函数,希望能够解开这个传说的谜团。通过无数次的尝试和调试,他终于成功了。

当他操控着这个函数,在游戏的虚拟世界中跳跃穿梭时,他感受到了一股前所未有的力量。他遇到了挑战,遇到了困难,但是他从未放弃。最终,在探索的尽头,他见到了十八罗汉,他们是如此强大,如此神秘,仿佛游戏世界的守护者。

魔法键盘师与十八罗汉进行了交流,学到了许多游戏世界的奥秘和技巧。他的编程技能得到了前所未有的提升,他的人生也因此而更加丰富多彩。

从那以后,魔法键盘师成为了数字王国中的传奇人物,他的名字被载入了游戏史册。他用自己的勇气和智慧,改变了整个游戏世界的格局,成为了无数玩家心中的英雄,那么接下来让我们了解一下这十八罗汉吧!!!

一、节点类:

/*** @author 查老师 QQ群:958240961* @description 查找节点并点击* @param {S} selector 选择器* @param {Boolean?} isClick 是否点击* @param {Boolean?} pointer 是否指针点击* @return {Boolean} true/false;全局jsonObj  g_ret;* @example* findNode(text("aaa").id("bbb"),true)*/
function findNode(selector, isClick, pointer) {if (typeOf(selector) !== "S") {logw("友情提示,findNode,传参类型不对:" + selector)return false;}g_ret = selector.getOneNodeInfo(0);if (g_ret) {if (isClick) {if (pointer) {g_ret.click();sleep(random(500, 1000));} else {findClickEx(g_ret)}}return true;}return false;
}/*** @author 查老师 QQ:1099542875* @description 查找可用父点击节点并无指针点击* @param {NodeInfo?} node 全局node返回值* @param {Boolean?} isNoClick 是否不点击* @return {Boolean} true/false;* @example* findClickEx(g_ret)*/
function findClickEx(node, isNoClick) {let tmp_ret = falsenode = node || g_retif (typeOf(node) !== "NodeInfo") {logw("友情提示,findClickEx,传参类型不对:" + node)return false;}//4次找不到就算了try {for (let i = 0; i <= 3; i++) {if (!node) return falseif (node.clickable) {tmp_ret = !isNoClick ? node.clickEx() : node!isNoClick && sleep(random(500, 1000));return tmp_ret}node = node.parent()}} catch (e) {loge(e);}return false
}/*** @description 查找可用父滚动节点并滚动* @param {NodeInfo?} node 全局node返回值* @param {Boolean?} isNoScroll 是否不滚动* @return {Boolean} true/false;* @example*/
function findScrollableP(node, isNoScroll) {let tmp_ret = falsenode = node || g_retif (typeOf(node) !== "NodeInfo") {logw("友情提示,findClickEx,传参类型不对:" + node)return false;}//11次找不到就算了try {for (let i = 0; i <= 10; i++) {if (!node) return falseif (node.scrollable) {tmp_ret = !isNoScroll ? node.scrollForward() : node!isNoScroll && sleep(random(500, 1000));return tmp_ret}node = node.parent()}} catch (e) {loge(e);}return false
}/*** @description 获取节点x中心点* @param node {NodeInfo?} 节点对象* @returns {number}*/
function centerX(node) {node = node || g_retreturn (node.bounds.left + node.bounds.right) / 2
}/*** @description 获取节点y中心点* @param node {NodeInfo?}节点对象* @returns {number}*/
function centerY(node) {node = node || g_retreturn (node.bounds.top + node.bounds.bottom) / 2
}/*** @description 在节点一半的范围内随机按压* @param node {NodeInfo?} 节点对象* @param timeMin {number?} 最小时长,默认1s* @param timeMax {number?} 最大时长,默认同最小*/
function pressHalf(node, timeMin, timeMax) {node = node || g_rettimeMin = timeMin * 1000 || 1000timeMax = timeMax * 1000 || timeMinlet x1 = ~~((node.bounds.right - node.bounds.left) / 4 + node.bounds.left)let y1 = ~~((node.bounds.bottom - node.bounds.top) / 4 + node.bounds.top)let x2 = ~~((node.bounds.right - node.bounds.left) / 4 * 3 + node.bounds.left)let y2 = ~~((node.bounds.bottom - node.bounds.top) / 4 * 3 + node.bounds.top)return press(random(x1, x2), random(y1, y2), random(timeMin, timeMax))
}/*** @description 判断数据类型* @param arg{any}* @return {string|null|undefined}*/
function typeOf(arg) {if (arg === null) return null;if (arg === undefined) return undefined;return arg.constructor.name;
}/*** @description 判断数组是否不为空* @param arr {Array} 数组* @return {boolean}*/
function isNotEmptyArray(arr) {if (!arr) return false;return arr.length !== 0;
}/*** @description getRunningPkg替代* @return {null|*|string}*/
function getRunningPkgEx() {let node = bounds(100, 200, device.getScreenWidth(), device.getScreenHeight() - 100).getOneNodeInfo(0)return node ? node.pkg : ""
}/*** @description 返回并等待* @param times {number?} 返回次数,默认1次* @param delay {number?} 延迟毫秒数,默认1000*/
function backs(times, delay) {times = times || 1delay = delay || 1000for (let i = 0; i < times; i++) {back()sleep(delay)}
}/*** @description 返回桌面并等待* @param times{number?} 等待秒数*/
function homes(times) {times = times * 1000 || 1000home()sleep(times)
}/*** @description 随机点击节点* @param nodeInfo {NodeInfo?}节点信息,默认g_ret* @param noDelay {boolean?}不加延迟,默认false,加延迟*/
function clickPointBounds(nodeInfo, noDelay) {nodeInfo = nodeInfo || g_retclickPoint(random(nodeInfo.bounds.left + 2, nodeInfo.bounds.right - 2), random(nodeInfo.bounds.top + 2, nodeInfo.bounds.bottom - 2))if (!noDelay) {sleep(random(500, 1000))}
}/*** @description 随机点击范围* @param x1 {number}* @param y1{number}* @param x2{number}* @param y2{number}* @param noDelay {boolean?}不加延迟,默认false,加延迟*/
function clickPointRnd(x1, y1, x2, y2, noDelay) {clickPoint(random(x1, x2), random(y1, y2))if (!noDelay) {sleep(random(500, 1000))}
}/*** @description 随机点击数组* @param arr1 {Array} bounds左上坐标 [12,2224]* @param arr2{Array} bounds右下坐标 [195,2340]* @param noDelay {boolean?}不加延迟,默认false,加延迟*/
function clickPointArr(arr1, arr2, noDelay) {clickPoint(random(arr1[0], arr2[0]), random(arr1[1], arr2[1]))if (!noDelay) {sleep(random(500, 1000))}
}/*** @description 多点比色 配合德林取色* @param points {string}* @param threshold {floaty?} 0.0 ~ 1.0* @returns {boolean} true/false*/
function cmpColor(points, threshold) {threshold = threshold || 1.0return image.cmpColorEx(points, threshold, 0, 0, 0, 0)
}/*** @description multitouch方法进行点击* @param node {NodeInfo?} 节点信息,默认g_ret*/function tapExR(node) {node = node || g_retlet x = random(node.bounds.left, node.bounds.right)let y = random(node.bounds.top, node.bounds.bottom)let touch1 = MultiPoint.get().action(0).x(x).y(y).pointer(1).delay(1).next().action(2).x(x).y(y).pointer(1).delay(1).next().action(1).x(x).y(y).pointer(1).delay(1);multiTouch(touch1, null, null, 300);}

二、APP类

/*** @description 打开app设置页* @param {String} pkgName 包名* @return {Boolean} true/false*/lz.app.openAppSetting = function (pkgName) {return utils.openActivity({"action": "android.settings.APPLICATION_DETAILS_SETTINGS","uri": "package:" + pkgName});}/*** @description shell强制关闭app* @param {String} pkgName 包名* @return {Boolean} true/false*/lz.app.forceKillApp = function (pkgName) {return !!shell.execCommand("am force-stop " + pkgName)}/*** @description shell清理app数据* @param {String} pkgName 包名* @return {Boolean} true/false*/lz.app.cleanApp = function (pkgName) {shell.execCommand("pm clear  " + pkgName)}/*** @description 包名是否在前台* @param pkgName{string} 包名* @return {boolean} true/false*/lz.app.isRunningPkg = function (pkgName) {return !!pkg(pkgName).getOneNodeInfo(0)}/*** @description 无障碍关闭app数据[华为/小米]* @param {String} pkgName 包名* @return {Boolean} true/false*/lz.app.accKillApp = function (pkgName) {logi(">>accKillApp")homes();this.openAppSetting(pkgName);sleep(1000);let timeOut = 0while (true) {if (findNode(textMatch("^强行停止$|^强行结束$|^结束运行$"))) {logd("强行停止");if (g_ret.enabled) {findClickEx()timeOut++;if (timeOut >= 5) {backs();return false}} else {backs();return true}} else if (findNode(text("确定"), true)) {logd("确定");} else if (findNode(desc("打开设置。").pkg("com.android.systemui"))) {logd("打开了设置框");backs();}}}/*** @description 获取apk图标bitmap* @param pkgName {string} apk包名* @return {ImageBitmap}  图标bitmap*/lz.app.getBitmap = function (pkgName) {let packageManager, applicationInfo;try {packageManager = context.getApplicationContext().getPackageManager();applicationInfo = packageManager.getApplicationInfo(pkgName, 0);} catch (e) {return null;}return packageManager.getApplicationIcon(applicationInfo).getBitmap();}

三、数据类

 /*** @description 数组去重,函数方法* @param arr {any[]} 待去重数组* @return {any[]} 去重后数组*/lz.arr.unique = function (arr) {return Array.from(new Set(arr))}/*** @description 数组去重,原型方法*/Array.prototype.unique = function () {let tmpS = new Set(this), i = 0for (let tmp of tmpS) {this[i] = tmpi++}this.length = i}

四、警告类

/*** @description 暂停脚本并弹窗提示* @param title {string} 标题* @param msg {string?}  内容 可空,默认标题* @return {boolean} 选择了是/否*/lz.Alert.dialog = function (title, msg) {msg = msg || titlelet p = {"title": title,"msg": msg,"cancelable": false,"cancelText": "否","okText": "是"};let a = 0ui.alert(p,function (dialog) {//让对话消失掉dialog.doDismiss();a = 1return true;},function (dialog) {//让对话消失掉dialog.doDismiss();a = 2return true;},function () {return true;});while (a === 0) {sleep(200)}return a === 1}/***@description 暂停脚本并弹窗等待输入* @param title{string}  标题* @param msg {string}?  内容 可空,默认标题* @return {string} 输入的内容*/lz.Alert.input = function (title, msg) {msg = msg || titlelet p = {"title": title,"msg": msg,"cancelable": false,"cancelText": "否","okText": "是"};let text_ret = ""let a = 0ui.inputDialog(p,function (dialog, v, text) {//让对话消失掉dialog.doDismiss();a = 1text_ret = textreturn true;},function (dialog) {//让对话消失掉dialog.doDismiss();a = 2return true;},function () {a = 2return true;});while (a === 0) {sleep(200)}return text_ret}

五、字节类

/*** @description base64解密,返回bytes* @param {String} str "YWJj"* @return {bytes[]} bytes*/lz.Bytes.base64Decode = function (str) {importClass(android.util.Base64)return Base64.decode(str, Base64.DEFAULT)}/*** @description 对bytes进行base64加密,返回base64结果* @param {bytes[]} bytes [B@8a3bd58 待加密的字节集* @return {String} base64编码文字 "YWJj"*/lz.Bytes.base64Encode = function (bytes) {importClass(android.util.Base64)return Base64.encodeToString(bytes, Base64.DEFAULT);}/*** @description 创建空的bytes字节数组* @param {number} length 数组长度,默认10* @return {bytes[]} 空的bytes字节数组*/lz.Bytes.createBytes = function (length) {length = length || 10if (length > 127) length = 127let bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, length);for (let i = 0; i < bytes.length; i++) {bytes[i] = i;}return bytes}

六、时间相关

/*** @description Format 为Date时间类加入格式化功能* @param {string?} fmt 时间格式 默认 yyyy/MM/dd HH:mm:ss* @return {string} 格式化后的时间*/Date.prototype.Format = function (fmt) {fmt = fmt || "yyyy/MM/dd hh:mm:ss"let o = {"M+": this.getMonth() + 1, //月份"d+": this.getDate(), //日"h+": this.getHours(), //小时"m+": this.getMinutes(), //分"s+": this.getSeconds(), //秒"q+": Math.floor((this.getMonth() + 3) / 3), //季度"S": this.getMilliseconds() //毫秒};if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));for (let k in o)if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));return fmt;}/*** @description getTimeStamp 获取时间戳* @param {String?} time 时间/可为空 2020-06-20 16:16:34或 2020/06/20 16:16:34* @return {number} 时间戳*/lz.Date.getTimeStamp = function (time) {if (time) {return ~~(String((new Date(time.replace(/-/g, '/'))).getTime()).slice(0, -3));} else {return ~~(String((new Date()).getTime()).slice(0, -3));}}/*** @description 时间戳转时间* @param timestamp {number} 时间戳* @return {string} 时间*/lz.Date.timestampToTime = function (timestamp) {if ((timestamp + "").length === 10) {timestamp = timestamp * 1000}let date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000//Y + M + D + h + m + sreturn date.getFullYear() + '-'+ (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'+ date.getDate() + ' '+ date.getHours() + ':'+ date.getMinutes() + ':'+ date.getSeconds()}

七:设备相关

/*** @description 获取设备横竖屏方向* @return {Boolean} true 竖屏 false 横屏*/lz.Device.isRotate = function () {return !context.getResources().getConfiguration().orientation === android.content.res.Configuration.ORIENTATION_PORTRAIT}/*** @description 设备是否是模拟器* @return {Boolean} true 模拟器 false 非模拟器*/lz.Device.isSimulator = function () {return android.os.Build.CPU_ABI + "" === "x86"}

八:EC节点相关

/*** @description 初始化EC节点服务*/lz.EC.init = function () {for (let i = 0; i < 3; i++) {logi("第" + (i + 1) + "次启动服务结果: " + startEnv());if (isServiceOk()) {daemonEnv(true)return true;}}toast("自动化服务启动失败,无法执行脚本");loge("自动化服务启动失败,无法执行脚本")exit();}lz.EC.ecVersion = function (index) {let version = lz.getVersion()return version.split(".")[index]}/*** @description 初始化EC图色服务* @param {number?} timeout 找图超时,默认1s* @param initOpenCV 初始化opencv*/lz.EC.initImage = function (timeout,initOpenCV) {timeout = timeout * 1000 || 1000image.setInitParam({"action_timeout": timeout})if (initOpenCV) {if (lz.EC.ecVersion(0) >= 7) {if (lz.EC.ecVersion(1) >= 15) {if (!image.initOpenCV()) {loge("初始化opencv失败,结束脚本程序");exit()}lz.isInitImage = truelogd("初始化opencv成功")}}}//先释放截图权限image.releaseScreenCapture();sleep(10);let request = image.requestScreenCapture(10000, 0);if (!request) {request = image.requestScreenCapture(10000, 0);}logi("申请截图权限结果... " + request)if (!request) {toast("申请截图权限失败,结束脚本");loge("申请截图权限失败,结束脚本");exit()}sleep(1000)}/*** @description 初始化开发分辨率* @param initX {number} 开发设备的宽值* @param initY {number} 开发设备的高值*/lz.EC.initScale = function (initX, initY) {if (!initX || !initY) {loge("未传入开发分辨率,停止脚本");exit()}this.ratioX = device.getScreenWidth() / initXthis.ratioY = device.getScreenHeight() / initY}/*** @ 获取计算后的分辨率* @param x {number}x坐标* @param y{number} y坐标* @return {null|{x: number, y: number}}*/lz.EC.scale = function (x, y) {if (!this.ratioX) {loge("未初始化开发分辨率,停止脚本");exit()}if (!x || !y) return nullreturn {x: ~~(x * this.ratioX),y: ~~(y * this.ratioY)}}

九:Face相关

lz.face.dy = function () {let str = ["[一起加油]", "[戴口罩]", "[勤洗手]", "[iloveyou]", "[巧克力]", "[戒指]", "[微笑]", "[色]", "[酷拽]", "[抠鼻]", "[流泪]","[呲牙]", "[睡]", "[害羞]", "[调皮]", "[晕]", "[衰]", "[闭嘴]", "[机智]", "[赞]", "[鼓掌]", "[感谢]", "[哈欠]", "[大笑]", "[打脸]","[耶]", "[灵机一动]", "[来看我]", "[送心]", "[困]", "[疑问]", "[泣不成声]", "[小鼓掌]", "[大金牙]", "[偷笑]", "[思考]", "[吐血]","[可怜]", "[嘘]", "[撇嘴]", "[坏笑]", "[憨笑]", "[得意]", "[奸笑]", "[笑哭]", "[尴尬]", "[抓狂]", "[泪奔]", "[钱]", "[亲亲]","[恐惧]", "[愉快]", "[快哭了]", "[翻白眼]", "[我想静静]", "[委屈]", "[舔屏]", "[鄙视]", "[不失礼貌的微笑]", "[绝望的凝视]", "[拥抱]","[紫薇别走]", "[再见]", "[飞吻]", "[吐舌]", "[绿帽子]", "[吃瓜群众]", "[不看]","[皱眉]", "[红脸]", "[尬笑]", "[擦汗]", "[强]", "[如花]", "[大哭]", "[加好友]", "[嘿哈]", "[惊恐]", "[囧]", "[难过]", "[斜眼]", "[比心]", "[悠闲]","[阴险]", "[OK]", "[勾引]", "[拳头]", "[胜利]", "[嘴唇]", "[给力]", "[爱心]", "[心碎]", "[玫瑰]", "[18禁]", "[玫瑰]", "[蛋糕]"]return str[random(0, 95)]}

十:文件相关

/*** @description 写入文本到文件* @param {String} fileName 文件名* @param {String} data 写入内容* @param {String?} encoding 编码* @return {boolean}*/lz.files.writeFile = function (fileName, data, encoding) {importClass(java.io.File)importClass(java.io.FileOutputStream)try {let op = new FileOutputStream(new File(fileName))op.write(new java.lang.String(data).getBytes(encoding ? encoding : "utf-8"));op.close();return true} catch (e) {loge("writeFile:" + e);return false}}/*** @description 写入bytes字节集到文本* @param {String} fileName 文件名* @param {bytes[]} bytes bytes字节流* @param {Boolean?} append 是否追加模式,默认不追加* @return {boolean}*/lz.files.writeFileBytes = function (fileName, bytes, append) {importClass(java.io.FileOutputStream);importClass(java.io.BufferedOutputStream);let out = null;append = append || false;//append必须给参数,不然报错try {out = new BufferedOutputStream(new FileOutputStream(fileName, append));out.write(bytes);out.close();return true} catch (e) {loge("writeFileBytes" + e);} finally {if (out != null) {out.close();}}return false}/*** @description 读取文本bytes数据* @param {String} fileName 文件名* @return {bytes[]} 文本bytes数据*/lz.files.readFileBytes = function (fileName) {importClass(java.io.File)importClass(java.io.FileInputStream)importClass(java.nio.ByteBuffer)importClass(java.nio.channels.FileChannel)try {let f = new File(fileName);let channel, fs;fs = new FileInputStream(f);channel = fs.getChannel();let byteBuffer = ByteBuffer.allocate(channel.size())while ((channel.read(byteBuffer)) > 0) {}fs.close()channel.close()return byteBuffer.array();} catch (e) {return null;}}/*** @description 读取文件到Base64数据* @param {String} fileName 文件名* @return {String} 文件的Base64数据*/lz.files.readFileBase64 = function (fileName) {importClass(Base64)return android.util.Base64.encodeToString(this.readFileBytes(fileName), Base64.DEFAULT);}/*** @description 写入Base64数据到文件* @param {String} fileName 文件名* @param {String} base64 Base64数据* @return {boolean} true/false*/lz.files.writeFileBase64 = function (fileName, base64) {importClass(android.util.Base64)return this.writeFileBytes(fileName, Base64.decode(base64, Base64.DEFAULT), false)}/*** @description 移动或重命名文件* @param {String} srcPath 初始文件名* @param {String} desPath 目标文件名* @return {boolean}true/false*/lz.files.moveOrRenameFile = function (srcPath, desPath) {importClass(java.io.File)try {new File(srcPath).renameTo(new File(desPath))return true} catch (e) {logd(e);}return false}

十一:Http相关

/*** @description httpGet* @param {String} url 请求链接* @param {Object?} params 请求参数{"a":1}* @param {String?} dataType 默认json string/json* @param {number?} timeout 请求超时 默认 10秒* @param {Object?} headers  UA {"a":1}* @return {JSON|null|string}*/lz.http.get = function (url, params, dataType, timeout, headers) {timeout = timeout * 1000 || 10 * 1000dataType = dataType || "json"let data = http.httpGet(url, params, timeout, headers);//logd(data);if (data) {// if (data === "404 page not found") {//     return false// }switch (dataType) {case "string":return data;case "json":try {return JSON.parse(data);} catch (e) {loge(e);}return null;default:return data;}}return null;}/*** @description httpPost* @param {String} url 请求链接* @param {Object?} params 请求参数{"a":1}* @param {String?} dataType 默认json string/json* @param {number?} timeout 请求超时 默认 10秒* @param {Object?} headers 请求头信息 {"a":1}* @return {JSON|null|string}*/lz.http.post = function (url, params, dataType, timeout, headers) {timeout = timeout * 1000 || 10 * 1000dataType = dataType || "json"let data = http.httpPost(url, params, null, timeout, headers);// logd(data);if (data) {// if (data === "404 page not found") {//     return false// }switch (dataType) {case "string":return data;case "json":try {return JSON.parse(data);} catch (e) {loge(e);}return null;default:return data;}}return null;}/*** @description httpPost* @param {String} url 请求链接* @param {Object?} params 请求参数json{"a":1}* @param {String?} dataType 默认json string/json* @param {number?} timeout 请求超时 默认 10秒* @param {Object?} header header {"a":1}* @return {JSON|null|string}*/lz.http.postJson = function (url, params, dataType, timeout, header) {timeout = timeout * 1000 || 10 * 1000dataType = dataType || "json"let data = http.postJSON(url, params, timeout, header);// logd(data);if (data) {// if (data === "404 page not found") {//     return false// }switch (dataType) {case "string":return data;case "json":try {return JSON.parse(data);} catch (e) {loge(e);}return null;default:return data;}}return null;}/*** @description 获取当前IP的地址* @return {string}*/lz.http.getIpLocation = function () {let ipUrl = "http://www.baidu.com/s?ie=UTF-8&wd=ip%E5%BD%92%E5%B1%9E%E5%9C%B0%E6%9F%A5%E8%AF%A2";let r = this.get(ipUrl, "", "string");if (r) {r = r.match(/本机IP: \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}<\/span>([\s\S]*?)<\/td/);if (r) return r[1].replace(/\s{2,}/, "");}return "";}/*** @description 获取网络IP* @return {string}*/lz.http.getNetIp = function () {let ipList = ["http://ddns.oray.com/checkip","http://pv.sohu.com/cityjson",]for (let i = 0; i < ipList.length; i++) {let r = this.get(ipList[i], "", "string");if (r) {r = r.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/);if (r) return r[0]}}return "0.0.0.0";}/*** @description 获取10位网络时间戳* @return {number} 10位网络时间戳*/lz.http.getNetTimeStamp = function () {//k780接口let res = this.get("http://api.k780.com/?app=life.time&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json")if (res && res.success === "1") {return ~~res.result.timestamp}return 0}/*** @description 随机UA* @return {string}随机UA*/lz.http.randomUA = function () {let user_agent = ["Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60","Opera/8.0 (Windows NT 5.1; U; en)","Mozilla/5.0 (Windows NT 5.1; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.50","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.50","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0","Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10",// Safari"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",// chrome"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11","Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.133 Safari/534.16",// 360"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",// 淘宝浏览器"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11",// 猎豹浏览器"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.71 Safari/537.1 LBBROWSER","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; LBBROWSER)","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E; LBBROWSER)",// QQ浏览器"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; QQBrowser/7.0.3698.400)","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E)",// sogou浏览器"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.84 Safari/535.11 SE 2.X MetaSr 1.0","Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SV1; QQDownload 732; .NET4.0C; .NET4.0E; SE 2.X MetaSr 1.0)",// maxthon浏览器"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.3.4000 Chrome/30.0.1599.101 Safari/537.36",// UC浏览器"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 UBrowser/4.0.3214.0 Safari/537.36",//各种移动端// IPhone"Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5",// IPod"Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5",// IPAD"Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5","Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5",// Android"Mozilla/5.0 (Linux; U; Android 2.2.1; zh-cn; HTC_Wildfire_A3333 Build/FRG83D) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",// QQ浏览器 Android版本"MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",// Android Opera Mobile"Opera/9.80 (Android 2.3.4; Linux; Opera Mobi/build-1107180945; U; en-GB) Presto/2.8.149 Version/11.10",// Android Pad Moto Xoom"Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13",// BlackBerry"Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.337 Mobile Safari/534.1+",// WebOS HP Touchpad"Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.0; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/233.70 Safari/534.6 TouchPad/1.0",// Nokia N97"Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/20.0.019; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.1.18124",// Windows Phone Mango"Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; HTC; Titan)",// UC浏览器"UCWEB7.0.2.37/28/999","NOKIA5700/ UCWEB7.0.2.37/28/999",// UCOpenwave"Openwave/ UCWEB7.0.2.37/28/999",// UC Opera"Mozilla/4.0 (compatible; MSIE 6.0; ) Opera/UCWEB7.0.2.37/28/999","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1","Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6","Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6","Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/19.77.34.5 Safari/537.1","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5","Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.36 Safari/536.5","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3","Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1062.0 Safari/536.3","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1062.0 Safari/536.3","Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3","Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3","Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.0 Safari/536.3","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.24 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24","Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.24 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24","ApiPOST Runtime +https://www.apipost.cn",]return user_agent[random(0, user_agent.length - 1)]}/*** @description 网站是否可连通* @param hostAddress {string?} 网站地址,可空,空则为测试本机网络连通性* @return {boolean} true/false*/lz.http.isConnectAble = function (hostAddress) {hostAddress = hostAddress || "www.baidu.com"hostAddress = hostAddress.replace(/http:\/\/|https:\/\//g, "")return java.lang.Runtime.getRuntime().exec("ping -c 2 " + hostAddress).waitFor() === 0}

十二:Intent相关

/***@description 默认浏览器打开网址* @param {string} url 网址链接* @return {boolean}*/lz.intent.openUrl = function (url) {utils.openActivity({action: "android.intent.action.VIEW",uri: url,})}/*** @description 用其他浏览器打开网址,默认via* @param url {string}* @param pkg {string}* @param className {string}* @return {boolean}*/lz.intent.openUrlEx = function (url, pkg, className) {pkg = pkg || "mark.via"className = className || "mark.via.ui.activity.BrowserActivity"return utils.openActivity({action: "android.intent.action.VIEW",uri: url,pkg: pkg,className: className})}/*** @description 打开应用设置页* @param pkgName {string} 包名* @return {boolean}*/lz.intent.openAppSetting = function (pkgName) {importClass(android.content.Intent);return utils.openActivity({action: "android.settings.APPLICATION_DETAILS_SETTINGS",uri: pkgName,flag: Intent.FLAG_ACTIVITY_NEW_TASK})}/*** @description intent安装apk,调起安装页面* @param path {string} apk安装包路径* @return {boolean}*/lz.intent.installApp = function (path) {return utils.openActivity({"action": "android.intent.action.VIEW","uri": "file://" + path,"type": "application/vnd.android.package-archive"})}/*** @description 打开qq群资料页* @param qqGroup {string} QQ群号* @return {boolean}*/lz.intent.openQQGroupCard = function (qqGroup) {return utils.openActivity({action: "android.intent.action.VIEW",uri: "mqqapi://card/show_pslcard?src_type=internal&version=1&uin=" + qqGroup + "&card_type=group&source=qrcode",pkg: "com.tencent.mobileqq",})}/*** @description 打开qq聊天页* @param QQ {string} QQ号* @return {boolean}*/lz.intent.openQQChat = function (QQ) {return utils.openActivity({action: "android.intent.action.VIEW",uri: "mqq://im/chat?chat_type=wpa&version=1&src_type=web&uin=" + QQ,pkg: "com.tencent.mobileqq",})}/***@description 图库打开图片* @param path{string} 图片路径* @return {boolean}*/lz.intent.openPic = function (path) {return utils.openActivity({action: "android.intent.action.VIEW",uri: "file://" + path,type: "image/png",pkg: "com.android.gallery3d",className: "com.android.gallery3d.app.GalleryActivity"})}/***@description 打开APP的activety页面* @param pkgName{string} 包名* @param className{string} 类名* @return {boolean}*/lz.intent.openActivity = function (pkgName, className) {return utils.openActivity({pkg: pkgName,className: className})}

十三:Jsoup相关

/*** @description jsoup.get主要用来下载bytes流* @param {String} url 请求链接* @param {number?} timeout 超时,默认30s* @param {String?} retType 返回值格式 string/byte/json/stream  默认string* @return {any}*/lz.jsoup.get = function (url, timeout, retType) {importClass(org.jsoup.Connection);importClass(org.jsoup.Jsoup);timeout = timeout * 1000 || 30 * 1000let filename = nulllet connect = Jsoup.connect(url).ignoreContentType(true)//忽略类型错误.ignoreHttpErrors(true)//忽略http错误.method(Connection.Method.GET)//访问方式.timeout(timeout).maxBodySize(0)//防止下载数据丢失.execute()if (connect.header("Content-Disposition")) {filename = connect.header("Content-Disposition").split("=")[1]}switch (retType) {case "string":return connect.body();case "byte":return {bytes: connect.bodyAsBytes(),filename: filename};case "json":return JSON.parse(connect.body());case "stream":return connect.bodyStream();default:return connect.body();}}/*** @description jsoup.post主要用来直接请求data数据* @param {String} url 请求链接* @param {string} data 请求数据* @param {number?} timeout 超时,默认30s* @param {String?} retType 返回值格式 string/byte/json/stream  默认string* @return {any}*/lz.jsoup.post = function (url, data, timeout, retType) {importClass(org.jsoup.Connection);importClass(org.jsoup.Jsoup);timeout = timeout * 1000 || 30 * 1000let filename = nulllet connect = Jsoup.connect(url).ignoreContentType(true)//忽略类型错误.ignoreHttpErrors(true)//忽略http错误.method(Connection.Method.POST)//访问方式.timeout(timeout).requestBody(data).maxBodySize(0)//防止下载数据丢失.execute()switch (retType) {case "string":return connect.body();case "byte":return connect.bodyAsBytes()case "json":return JSON.parse(connect.body());case "stream":return connect.bodyStream();default:return connect.body();}}

十四:随机数相关

/*** @description 计算数学几率* @param odds {number} 几率* @return {boolean} true/false*/lz.Rnd.odds = function (odds) {return random(1, 100) <= Number(odds);}/*** @description 延迟随机时间并提示* @param {number} startTime 起始时长,毫秒* @param {number}endTime 结束时长,毫秒* @param {string?}msg 提示信息*/lz.Rnd.sleep = function (startTime, endTime, msg) {endTime = endTime || startTimelet tmp, tmp_inttmp = random(~~(startTime), ~~(endTime));tmp_int = ~~(tmp / 1000);if (msg) {logd(msg + "倒计时:" + tmp_int + "秒");toast(msg + "倒计时:" + tmp_int + "秒")}for (let d = tmp_int; d >= 0; d--) {sleep(1000);}sleep(tmp - tmp_int * 1000);}/*** @description lz随机字符串功能类*/lz.RndStr = {};/*** @description 随机_大写字母* @param {number?} count 随机个数,默认1个* @return {String} 随机结果*/lz.RndStr.upperCase = function (count) {count = count || 1let text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ret = '';for (let i = 0, len = text.length - 1; i < count; i++) {ret += text[random(0, len)];}return ret;}/*** @description 随机_小写字母* @param {number?} count 随机个数,默认1个* @return {String} 随机结果*/lz.RndStr.lowerCase = function (count) {count = count || 1let text = 'abcdefghijklmnopqrstuvwxyz', ret = '';for (let i = 0, len = text.length - 1; i < count; i++) {ret += text[random(0, len)];}return ret;}/*** @description 随机_字母* @param {number?} count 随机个数,默认1个* @return {String} 随机结果*/lz.RndStr.cases = function (count) {count = count || 1let text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', ret = '';for (let i = 0, len = text.length - 1; i < count; i++) {ret += text[random(0, len)];}return ret;}/*** @description 随机_数字字符串* @param {number?} count 随机个数,默认1个* @return {String} 随机结果*/lz.RndStr.numStr = function (count) {count = count || 1let text = '0123456789', ret = '';for (let i = 0, len = text.length - 1; i < count; i++) {ret += text[random(0, len)];}return ret;}/*** @description 随机_小写字母,数字* @param {number?} count 随机个数,默认1个* @return {String} 随机结果*/lz.RndStr.lowerCaseAndNum = function (count) {count = count || 1let text = 'abcdefghijklmnopqrstuvwxyz0123456789', ret = '';for (let i = 0, len = text.length - 1; i < count; i++) {ret += text[random(0, len)];}return ret;}/*** @description 随机_大小写字母,数字,符号* @param {number?} count 随机个数,默认1个* @return {String} 随机结果*/lz.RndStr.caseAndNum = function (count) {count = count || 1let text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+=-@#~,.[]()!%^*$', ret = '';for (let i = 0, len = text.length - 1; i < count; i++) {ret += text[random(0, len)];}return ret;}/*** @description 随机_全部中文* @param {number?} count 随机个数,默认1个* @return {String} 随机结果*/lz.RndStr.chineseAll = function (count) {count = count || 1let ret = "";for (let i = 0; i < count; i++) {ret += String.fromCharCode(random(19968, 26032));}return ret;}/*** @description 随机_手机号* @return {String} 随机_手机号*/lz.RndStr.getMobile = function () {let start = ["130", "131", "132", "133", "134", "135", "137", "138","170", "187", "189", "199", "198", "156", "166", "175", "186", "184", "146", "139", "147","150", "151", "152", "157", "158", "159", "178", "182", "183", "187", "188", "133", "153","149", "173", "177", "180", "181", "189"]return start[random(0, start.length - 1)] + this.numStr(8)}/*** @description 随机_名字* @param {string?} gender 性别,可空 男,女,全部随机* @return {String} 随机_手机号*/lz.RndStr.getName = function (gender) {//以下字库可自行添加let familyNames = ["赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "楮", "卫", "蒋", "沈", "韩", "杨","朱", "秦", "尤", "许", "何", "吕", "施", "张", "孔", "曹", "严", "华", "金", "魏", "陶", "姜","戚", "谢", "邹", "喻", "柏", "水", "窦", "章", "云", "苏", "潘", "葛", "奚", "范", "彭", "郎","鲁", "韦", "昌", "马", "苗", "凤", "花", "方", "俞", "任", "袁", "柳", "酆", "鲍", "史", "唐","费", "廉", "岑", "薛", "雷", "贺", "倪", "汤", "滕", "殷", "罗", "毕", "郝", "邬", "安", "常","乐", "于", "时", "傅", "皮", "卞", "齐", "康", "伍", "余", "元", "卜", "顾", "孟", "平", "黄","和", "穆", "萧", "尹", "姚", "邵", "湛", "汪", "祁", "毛", "禹", "狄", "米", "贝", "明", "臧","计", "伏", "成", "戴", "谈", "宋", "茅", "庞", "熊", "纪", "舒", "屈", "项", "祝", "董", "梁","杜", "阮", "蓝", "闽", "席", "季", "麻", "强", "贾", "路", "娄", "危", "江", "童", "颜", "郭","梅", "盛", "林", "刁", "锺", "徐", "丘", "骆", "高", "夏", "蔡", "田", "樊", "胡", "凌", "霍","虞", "万", "支", "柯", "昝", "管", "卢", "莫", "经", "房", "裘", "缪", "干", "解", "应", "宗","丁", "宣", "贲", "邓", "郁", "单", "杭", "洪", "包", "诸", "左", "石", "崔", "吉", "钮", "龚","程", "嵇", "邢", "滑", "裴", "陆", "荣", "翁", "荀", "羊", "於", "惠", "甄", "麹", "家", "封","芮", "羿", "储", "靳", "汲", "邴", "糜", "松", "井", "段", "富", "巫", "乌", "焦", "巴", "弓","牧", "隗", "山", "谷", "车", "侯", "宓", "蓬", "全", "郗", "班", "仰", "秋", "仲", "伊", "宫","宁", "仇", "栾", "暴", "甘", "斜", "厉", "戎", "祖", "武", "符", "刘", "景", "詹", "束", "龙","叶", "幸", "司", "韶", "郜", "黎", "蓟", "薄", "印", "宿", "白", "怀", "蒲", "邰", "从", "鄂","索", "咸", "籍", "赖", "卓", "蔺", "屠", "蒙", "池", "乔", "阴", "郁", "胥", "能", "苍", "双","闻", "莘", "党", "翟", "谭", "贡", "劳", "逄", "姬", "申", "扶", "堵", "冉", "宰", "郦", "雍","郤", "璩", "桑", "桂", "濮", "牛", "寿", "通", "边", "扈", "燕", "冀", "郏", "浦", "尚", "农","温", "别", "庄", "晏", "柴", "瞿", "阎", "充", "慕", "连", "茹", "习", "宦", "艾", "鱼", "容","向", "古", "易", "慎", "戈", "廖", "庾", "终", "暨", "居", "衡", "步", "都", "耿", "满", "弘","匡", "国", "文", "寇", "广", "禄", "阙", "东", "欧", "殳", "沃", "利", "蔚", "越", "夔", "隆","师", "巩", "厍", "聂", "晁", "勾", "敖", "融", "冷", "訾", "辛", "阚", "那", "简", "饶", "空","曾", "毋", "沙", "乜", "养", "鞠", "须", "丰", "巢", "关", "蒯", "相", "查", "后", "荆", "红","游", "竺", "权", "逑", "盖", "益", "桓", "公", "仉", "督", "晋", "楚", "阎", "法", "汝", "鄢","涂", "钦", "岳", "帅", "缑", "亢", "况", "后", "有", "琴", "归", "海", "墨", "哈", "谯", "笪","年", "爱", "阳", "佟", "商", "牟", "佘", "佴", "伯", "赏","万俟", "司马", "上官", "欧阳", "夏侯", "诸葛", "闻人", "东方", "赫连", "皇甫", "尉迟", "公羊","澹台", "公冶", "宗政", "濮阳", "淳于", "单于", "太叔", "申屠", "公孙", "仲孙", "轩辕", "令狐","锺离", "宇文", "长孙", "慕容", "鲜于", "闾丘", "司徒", "司空", "丌官", "司寇", "子车", "微生","颛孙", "端木", "巫马", "公西", "漆雕", "乐正", "壤驷", "公良", "拓拔", "夹谷", "宰父", "谷梁","段干", "百里", "东郭", "南门", "呼延", "羊舌", "梁丘", "左丘", "东门", "西门", "南宫"]let givenNames = ["子璇", "淼", "国栋", "夫子", "瑞堂", "甜", "敏", "尚", "国贤", "贺祥", "晨涛","昊轩", "易轩", "益辰", "益帆", "益冉", "瑾春", "瑾昆", "春齐", "杨", "文昊","东东", "雄霖", "浩晨", "熙涵", "溶溶", "冰枫", "欣欣", "宜豪", "欣慧", "建政","美欣", "淑慧", "文轩", "文杰", "欣源", "忠林", "榕润", "欣汝", "慧嘉", "新建","建林", "亦菲", "林", "冰洁", "佳欣", "涵涵", "禹辰", "淳美", "泽惠", "伟洋","涵越", "润丽", "翔", "淑华", "晶莹", "凌晶", "苒溪", "雨涵", "嘉怡", "佳毅","子辰", "佳琪", "紫轩", "瑞辰", "昕蕊", "萌", "明远", "欣宜", "泽远", "欣怡","佳怡", "佳惠", "晨茜", "晨璐", "运昊", "汝鑫", "淑君", "晶滢", "润莎", "榕汕","佳钰", "佳玉", "晓庆", "一鸣", "语晨", "添池", "添昊", "雨泽", "雅晗", "雅涵","清妍", "诗悦", "嘉乐", "晨涵", "天赫", "玥傲", "佳昊", "天昊", "萌萌", "若萌","惠宁", "雅欣", "奕雯", "佳琪", "永怡", "璐瑶", "娟秀", "天佳", "晓华", "妍丽", "璇菡","嘉禾", "忆辰", "妍彤", "眉萱", "秀辰", "怡熹", "思琦", "弦娇", "青淑", "宣淑", "和静","雪涵", "美嘉", "佳涵", "旭和", "丽娇", "雨晨", "文惠", "雅馥", "雨嘉", "亦婷", "秀慧","俊颖", "亭清", "思涵", "珂嘉", "蒂莲", "秀娟", "晋仪", "玮菁", "慧琳", "丽帆", "思辰","宇纯", "美瑞", "蕊清", "秀敏", "家维", "宁致", "婷方", "燕晨", "子琳", "雪菲", "泓锦","佳妮", "初晨", "芷菡", "奕可", "莉姿", "杏菏", "韵彩", "姝慧", "雪华", "珊娜", "秀丽","箫辉", "盈初", "语楚", "青秋", "梓菁", "宝萱"]let mans = "刚伟勇毅俊峰强军平保东文辉力明永健世广志义兴良海山仁波宁贵福生龙元全国胜学祥才发武新利清" +"飞彬富顺信子杰涛昌成康星光天达安岩中茂进林有坚和彪博诚先敬震振壮会思群豪心邦承乐绍功松善厚庆磊民友裕" +"河哲江超浩亮政谦亨奇固之轮翰朗伯宏言若鸣朋斌梁栋维启克伦翔旭鹏泽晨辰士以建家致树炎德行时泰盛雄琛钧冠策腾楠榕风航弘"let womens = "秀娟英华慧巧美娜静淑惠珠翠雅芝玉萍红娥玲芬芳燕彩春菊兰凤洁梅琳素云莲真环雪荣爱妹霞香月莺媛艳" +"瑞凡佳嘉琼勤珍贞莉桂娣叶璧璐娅琦晶妍茜秋珊莎锦黛青倩婷姣婉娴瑾颖露瑶怡婵雁蓓纨仪荷丹蓉眉君琴蕊薇菁梦岚苑婕馨瑗琰韵" +"融园艺咏卿聪澜纯毓悦昭冰爽琬茗羽希宁欣飘育滢馥筠柔竹霭凝鱼晓欢霄枫芸菲寒伊亚宜可姬舒影荔枝思丽墨"switch (gender) {case "男":return familyNames[random(0, familyNames.length - 1)] + mans[random(0, mans.length - 1)];case "女":return familyNames[random(0, familyNames.length - 1)] + womens[random(0, womens.length - 1)];default:switch (random(0, 2)) {case 0:return familyNames[random(0, familyNames.length - 1)] + mans[random(0, mans.length - 1)];case 1:return familyNames[random(0, familyNames.length - 1)] + womens[random(0, womens.length - 1)];case 2:return familyNames[random(0, familyNames.length - 1)] + givenNames[random(0, givenNames.length - 1)];}}}/*** @description 随机_身份证号* @return {String} 随机_身份证号*/lz.RndStr.getIdCard = function () {let cnNewID = function (idcard) {let arrExp = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; // 加权因子let arrValid = [1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2]; // 校验码let sum = 0;for (let j = 0; j < 17; j++) {// 对前17位数字与权值乘积求和sum += parseInt(idcard[j], 10) * arrExp[j];}return arrValid[sum % 11];}let idcard = '';for (let i = 0; i < 18; i++) {if (i < 6) {idcard += random(0, 9)} else if (i === 6) {idcard += random(1, 2) //年份第一位仅支持1和2} else if (i === 7) {idcard += idcard[6] === '1' ? 9 : 0;//两位年份规则,仅支持19和20} else if (i === 8) {idcard += idcard[6] === '1' ? random(3, 7) : random(0, 1); //三位年份规则,仅支持193-199、200、201这些值} else if (i === 9) {idcard += random(0, 9) //四位年份规则,0-9} else if (i === 10) {idcard += random(0, 1);//首位月份规则} else if (i === 11) {idcard += idcard[10] === '0' ? random(1, 9) : random(0, 2);//末位月份规则} else if (i === 12) {let maxDays = new Date(~~idcard.substr(6, 4), ~~idcard.substr(10, 2), 0).getDate(); // 获取当月最大天数let day = random(1, maxDays)idcard += day < 10 ? ('0' + day) : day;i++} else if (i > 13 && i < 17) {idcard += random(0, 9)} else if (i === 17) {idcard += cnNewID(idcard);}}return idcard;}/*** @description 随机插入字符串* @param srcStr {string} 源字符串* @param str {string} 待插入字符串* @return {string} 结果*/lz.RndStr.insertStr = function (srcStr, str) {srcStr = srcStr.split("")srcStr.splice(random(0, srcStr.length - 1), 0, str)return srcStr.join("")}

十五:Shell命令相关

/*** @description 开启飞行模式,需要root*/lz.shell.openAirMode = function () {return shell.sudo("settings put global airplane_mode_on 1 && am broadcast -a android.intent.action.AIRPLANE_MODE" +" --ez state true")}/*** @description 关闭飞行模式,需要root*/lz.shell.closeAirMode = function () {return shell.sudo("settings put global airplane_mode_on 0 && am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false")}/***@description shell安装apk,代理模式* @param path {string} apk路径* @return {string}*/lz.shell.installApp = function (path) {return shell.execCommand("pm install -r " + path)}/***@description shell卸载apk,代理模式* @param pkgName {string}包名* @return {string}*/lz.shell.uninstallApp = function (pkgName) {return shell.execCommand("pm uninstall  " + pkgName)}/***@description 打开APP的activity页面* @param pkgName{string} 包名* @param className{string} 类名* @return {string}*/lz.shell.openActivity = function (pkgName, className) {return shell.execCommand("am start -n " + pkgName + "/" + className)}/*** @description 跳转scheme,需要root* @param scheme {string} scheme* @return {string}*/lz.shell.openScheme = function (scheme) {return shell.sudo("am start -a android.intent.action.VIEW -d '" + scheme + "'")}/*** @description 获取顶层应用包名与组件名* @param mode{number?} 默认不填,如果默认获取不到可切换0/1* @return {string}  bin.mt.plus/.Main*/lz.shell.getRunningActivity = function (mode) {let ret = shell.execCommand("dumpsys activity top")if (ret) {if (mode) {if (mode === 0) {ret = ret.match(/ACTIVITY ([^/]+)/)} else {ret = ret.match(/ACTIVITY .-\/([^ ]+)/)}} else {ret = ret.match(/ACTIVITY ([^ ]+)/)}if (ret) return ret[1]}return ""}/***@description shell获取cpu核心温度* @return {number} cpu核心温度*/lz.shell.getCpuTemp = function () {let list = ["/sys/devices/system/cpu/cpu0/cpufreq/cpu_temp","/sys/devices/system/cpu/cpu0/cpufreq/FakeShmoo_cpu_temp","/sys/class/thermal/thermal_zone0/temp","/sys/class/i2c-adapter/i2c-4/4-004c/temperature","/sys/devices/platform/tegra-i2c.3/i2c-4/4-004c/temperature","/sys/devices/platform/omap/omap_temp_sensor.0/temperature","/sys/devices/platform/tegra_tmon/temp1_input","/sys/kernel/debug/tegra_thermal/temp_tj","/sys/devices/platform/s5p-tmu/temperature","/sys/class/thermal/thermal_zone1/temp","/sys/class/hwmon/hwmon0/device/temp1_input","/sys/devices/virtual/thermal/thermal_zone1/temp","/sys/devices/virtual/thermal/thermal_zone0/temp","/sys/class/thermal/thermal_zone3/temp","/sys/class/thermal/thermal_zone4/temp","/sys/class/hwmon/hwmonX/temp1_input","/sys/devices/platform/s5p-tmu/curr_temp"]for (let i = 0; i < list.length; i++) {let tmp = ~~shell.execCommand("cat " + list[i]) / 1000if (tmp) {// logd(list[i]);return ~~tmp}}return 0}/*** @description shell获取电池温度* @return {number}电池温度*/lz.shell.getBatteryTemp = function () {let tmp = shell.execCommand("dumpsys battery")if (tmp) return ~~lz.String.getMiddleText(tmp, "temperature: ", "technology") / 10return 0}

十六:字符串相关

/*** @description 开启飞行模式,需要root*/lz.shell.openAirMode = function () {return shell.sudo("settings put global airplane_mode_on 1 && am broadcast -a android.intent.action.AIRPLANE_MODE" +" --ez state true")}/*** @description 关闭飞行模式,需要root*/lz.shell.closeAirMode = function () {return shell.sudo("settings put global airplane_mode_on 0 && am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false")}/***@description shell安装apk,代理模式* @param path {string} apk路径* @return {string}*/lz.shell.installApp = function (path) {return shell.execCommand("pm install -r " + path)}/***@description shell卸载apk,代理模式* @param pkgName {string}包名* @return {string}*/lz.shell.uninstallApp = function (pkgName) {return shell.execCommand("pm uninstall  " + pkgName)}/***@description 打开APP的activity页面* @param pkgName{string} 包名* @param className{string} 类名* @return {string}*/lz.shell.openActivity = function (pkgName, className) {return shell.execCommand("am start -n " + pkgName + "/" + className)}/*** @description 跳转scheme,需要root* @param scheme {string} scheme* @return {string}*/lz.shell.openScheme = function (scheme) {return shell.sudo("am start -a android.intent.action.VIEW -d '" + scheme + "'")}/*** @description 获取顶层应用包名与组件名* @param mode{number?} 默认不填,如果默认获取不到可切换0/1* @return {string}  bin.mt.plus/.Main*/lz.shell.getRunningActivity = function (mode) {let ret = shell.execCommand("dumpsys activity top")if (ret) {if (mode) {if (mode === 0) {ret = ret.match(/ACTIVITY ([^/]+)/)} else {ret = ret.match(/ACTIVITY .-\/([^ ]+)/)}} else {ret = ret.match(/ACTIVITY ([^ ]+)/)}if (ret) return ret[1]}return ""}/***@description shell获取cpu核心温度* @return {number} cpu核心温度*/lz.shell.getCpuTemp = function () {let list = ["/sys/devices/system/cpu/cpu0/cpufreq/cpu_temp","/sys/devices/system/cpu/cpu0/cpufreq/FakeShmoo_cpu_temp","/sys/class/thermal/thermal_zone0/temp","/sys/class/i2c-adapter/i2c-4/4-004c/temperature","/sys/devices/platform/tegra-i2c.3/i2c-4/4-004c/temperature","/sys/devices/platform/omap/omap_temp_sensor.0/temperature","/sys/devices/platform/tegra_tmon/temp1_input","/sys/kernel/debug/tegra_thermal/temp_tj","/sys/devices/platform/s5p-tmu/temperature","/sys/class/thermal/thermal_zone1/temp","/sys/class/hwmon/hwmon0/device/temp1_input","/sys/devices/virtual/thermal/thermal_zone1/temp","/sys/devices/virtual/thermal/thermal_zone0/temp","/sys/class/thermal/thermal_zone3/temp","/sys/class/thermal/thermal_zone4/temp","/sys/class/hwmon/hwmonX/temp1_input","/sys/devices/platform/s5p-tmu/curr_temp"]for (let i = 0; i < list.length; i++) {let tmp = ~~shell.execCommand("cat " + list[i]) / 1000if (tmp) {// logd(list[i]);return ~~tmp}}return 0}/*** @description shell获取电池温度* @return {number}电池温度*/lz.shell.getBatteryTemp = function () {let tmp = shell.execCommand("dumpsys battery")if (tmp) return ~~lz.String.getMiddleText(tmp, "temperature: ", "technology") / 10return 0}

十七:字符串相关

/*** @description String拓展替换所有* @param searchValue {string} 待替换数据* @param replaceValue {string?} 替换数据,默认""* @return {string} 替换后的数据*/String.prototype.replaceAll = function (searchValue, replaceValue) {return this.replace(new RegExp(searchValue, "gm"), replaceValue ? replaceValue : "")}/*** @description 格式化字符串(文本替换)* @param {String} str 源字符串。如:'确定要{0}单据【{1}】吗?'* @param {*} args 要替换的参数,支持多参。如:'删除', 'QZYDYJZB201901300002'* @return {String} 如:'确定要删除单据【QZYDYJZB201901300002】吗?'*/lz.String.format = function (str, args) {for (let i = 1, len = arguments.length; i < len; i++) {let reg = new RegExp('\\{' + (i - 1) + '\\}', 'gm');arguments[0] = arguments[0].replace(reg, arguments[i]);}return arguments[0];}/*** @description 取中间文本* @param str {string}源字符串* @param start {string}起始字符串* @param end {string} 末尾字符串* @param retain {boolean?} 是否保留截取字符,默认false* @return {string} 取出的中间文本*/lz.String.getMiddleText = function (str, start, end, retain) {if (!str || !start || !end) return ""let a = str.indexOf(start)if (a !== -1) {a += start.length;let e = str.indexOf(end, a);if (e > a) {return retain ? str.substring(a - start.length, e + end.length) : str.substring(a, e)}}return ""}/*** @description 取中间文本,最大匹配* @param str {string}源字符串* @param start {string}起始字符串* @param end {string} 末尾字符串* @param retain {boolean?} 是否保留截取字符,默认false* @return {string} 取出的中间文本*/lz.String.getMiddleTextBig = function (str, start, end, retain) {if (!str || !start || !end) return ""let a = str.indexOf(start)if (a !== -1) {a += start.length;let e = str.lastIndexOf(end);if (e > a) {return retain ? str.substring(a - start.length, e + end.length) : str.substring(a, e)}}return ""}/*** @description 取前面文本* @param srcStr {string} 源字符串* @param str{string} 定位字符串* @return {string} 取前面文本*/lz.String.getBeforeText = function (srcStr, str) {if (!srcStr || !str) return ""return srcStr.substring(0, srcStr.indexOf(str))}/*** @description 取后面文本* @param srcStr {string}源字符串* @param str {string}定位字符串* @return {string} 取后面文本*/lz.String.getAfterText = function (srcStr, str) {if (!srcStr || !str) return ""return srcStr.substring(srcStr.indexOf(str) + str.length)}/*** @description 判断字符串是否以指定字符串开头* @param {String} str 源字符串* @param {String} searchString 要查询的字符串* @param {Boolean?} ignoreCase 是否忽略大小写,默认false* @return {Boolean}*/lz.String.isStartWith = function (str, searchString, ignoreCase) {if (str === null || str === undefined) return false;let preSubStr = str.substring(0, searchString.length) + '';if (ignoreCase) {preSubStr = preSubStr.toLowerCase();searchString = (searchString + '').toLowerCase();}return preSubStr === searchString;}/*** @description 判断字符串是否以指定字符串结束* @param {String} str 源字符串* @param {String} searchString 要查询的字符串* @param {Boolean?} ignoreCase 是否忽略大小写,默认false* @return {Boolean}*/lz.String.isEndWith = function (str, searchString, ignoreCase) {if (str === null || str === undefined) return false;let lastSubStr = str.substring(str.length - searchString.length, str.length) + '';if (ignoreCase) {lastSubStr = lastSubStr.toLowerCase();searchString = (searchString + '').toLowerCase();}return lastSubStr === searchString;}/*** @description 首字母大写* @param {String} str 源字符串* @return {String}*/lz.String.firstUpperCase = function (str) {if (typeOf(str) !== "String") return '';return str.replace(/^\S/, function (s) {return s.toUpperCase()});}/*** @description 首字母小写* @param {String} str 源字符串* @return {String}*/lz.String.firstLowerCase = function (str) {if (typeOf(str) !== "String") return '';return str.replace(/^\S/, function (s) {return s.toLowerCase()});}/*** @description 反转字符串的元素顺序* @param {String} str 源字符串* @return {String}*/lz.String.reverse = function (str) {if (typeOf(str) !== "String") return '';let newStr = '';for (let i = str.length - 1; i >= 0; i--) {newStr += str[i];}return newStr;}/*** @description 字母和数字混合的编号自加1(以数字结尾)* @param {String} code 编号。例:'XM0001'* @return {String} 编号+1。例:'XM0002'*/lz.String.getNext = function (code) {let part1, part2;if (/[a-z]/i.test(code)) {let x = code.match(/[a-z]/ig);part1 = x.join('');part2 = code.substring(x.length);} else {part1 = '';part2 = code;}let int = parseInt(part2);let zero = (part2 + '.').split(int + '.')[0];let newPart2 = zero + (int + 1).toString();return part1 + newPart2;}/*** @description 数字颜色转hex* @param {String} color 数字颜色。例:'-156654'* @return {String} hex 0xffffff*/lz.String.getHexString = function (color) {let s = "0x";let colorStr = (color & 0xff000000) | (color & 0x00ff0000) | (color & 0x0000ff00) | (color & 0x000000ff);s += java.lang.Integer.toHexString(colorStr);return s;}/*** @description 字符串转bytes* @param {String} str 源字符串 "abc"* @return {bytes[]} bytes [B@8a3bd58*/lz.String.stringToBytes = function (str) {return new java.lang.String(str).getBytes()}/*** @description bytes转字符串* @param {bytes[]} bytes [B@8a3bd58* @return {String} string  "abc"*/lz.String.byteToString = function (bytes) {return new java.lang.String(bytes)}/*** @description base64加密* @param {String} str "abc"* @return {String} string "YWJj"*/lz.String.base64Encode = function (str) {importClass(android.util.Base64)return Base64.encodeToString(this.stringToBytes(str), Base64.NO_WRAP)}/*** @description base64解密,返回字符串* @param {String} str "YWJj"* @return {String} string "abc"*/lz.String.base64Decode = function (str) {importClass(android.util.Base64)return this.byteToString(Base64.decode(str, Base64.DEFAULT))}/*** 解码 URL Safe base64 -> base64* @description: URL Safe base64* '-' -> '+'* '_' -> '/'* 字符串长度%4,补'='* @param {string} base64Str* @return: Base64 string;*/lz.String.urlSafeBase64Decode = function (base64Str) {if (!base64Str) return;let safeStr = base64Str.replace(/-/g, '+').replace(/_/g, '/');let num = safeStr.length % 4;return safeStr + '===='.substring(0, num);}/*** 编码 base64 -> URL Safe base64* @description: base64* '+' -> '-'* '/' -> '_'* '=' -> ''* @param {string} base64Str* @return: URL Safe base64 string;*/lz.String.urlSateBase64Encode = function (base64Str) {if (!base64Str) return;return base64Str.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');// const UriSafe = (src: string) => src.replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_').replace(/=+$/m, ‘');}

十八:Key键盘相关

/*** @description KeyStr 代理模拟键盘输入,主要数字英文* @param {String} str 字符串* @param {number?} delay 延迟,默认50ms*/lz.Key.KeyStr = function (str, delay) {delay = delay || 50for (let i = 0; i < str.length; i++) {agentEvent.pressKeyCode(str[i].charCodeAt())sleep(delay)}}/*** @description 小米6lineageOS键盘查找节点点击输入* @param str {string}字符串* @param delay {number?}延迟,默认100ms*/lz.Key.KeyStrNode = function (str, delay) {delay = delay || 100for (let i = 0; i < str.length; i++) {while (true) {if (findNode(desc(str[i]).clz("com.android.inputmethod.keyboard.Key").pkg("com.android.inputmethod.latin"))) {g_ret.click()break;}}sleep(delay)}

如果你觉得对你有用,记得点赞加收藏啊!!!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/1425012.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

Redis-Redis事务

Redis事务 Redis事务简介 Redis事务是一组命令的集合&#xff0c;一个事务中的所有命令都将被序列化&#xff0c;按照一次性、顺序性、排他 性的执行队列系列的命令。Redis单条命令保证原子性&#xff0c;但是事务不保证原子性&#xff0c;且没有回滚。事务中任意命令执行失败…

DBeaver如何csv导入数据

简言之先要创建任务&#xff0c;任务还需要去执行&#xff0c;只有执行之后才是执行真的导入了 那个保存任务真的很误导人啊 1.首先点击你要被导入的表&#xff0c;右键选择导入数据然后选择直接点击下一步,这个地方需要修改格式&#xff0c;否则会乱码 如果你导入的没有标题…

GPT-4o API 全新版本发布:提升性能,增加性价比

5月13日&#xff0c;OpenAI 发布了全新ChatGPT模型 GPT-4o&#xff0c;它在响应速度和多媒体理解上都有显著提升。在这篇文章中&#xff0c;我们将介绍 GPT-4o 的主要特点及其 API 集成方式。 什么是 GPT-4o&#xff1f; GPT-4o 是 OpenAI 于5月13日发布的最新多模态 AI 模型…

职业生涯第一课---“Redis分布式锁优化:确保唯一性与效率“

前言 最近因为刚入职公司开启自己的实习生涯&#xff0c;工作和毕设论文同步进行&#xff0c;导致有段时间没更新博客了&#xff0c;今天来分享一下最近学到的一些知识。 场景介绍 BOSS让我写一些接口&#xff0c;他提出这样一个需求&#xff0c;该接口的参数有多个&#xf…

ubuntu下不生成core dumped

1、先用ulimit -c&#xff0c;如果看到0&#xff0c;说明没有开core dump。 所以我们输入ulimit -c unlimited&#xff0c;打开core dump。 再次用ulimit -c&#xff0c;看到unlimited了&#xff0c;说明core dump打开了。 注意这句ulimit -c unlimited只对当前会话有效。要永…

酷开科技的智能电视操作系统—酷开系统,带来更加舒适的观看体验

酷开科技的智能电视操作系统——酷开系统&#xff0c;通过大数据和人工智能技术的结合&#xff0c;会根据会员的观看历史和收视行为偏好&#xff0c;刻画出“消费者群体画像”&#xff0c;然后将内容进行“人工编辑智能推荐”的方式推送到消费者面前&#xff0c;不仅省去了消费…

在Python中防止某些字段被Pickle序列化

在Python中&#xff0c;如果你想防止某些字段被pickle序列化&#xff0c;可以使用__reduce__()方法来自定义pickle行为。__reduce__()方法允许你返回一个元组&#xff0c;其中包含要在对象被pickle时调用的函数以及传递给该函数的参数。下面就是我遇到的问题以及最终解决方案。…

Verdaccio私服搭建

前言 Verdaccio是一个轻量级的私有npm注册表&#xff0c;由Node.js创建&#xff0c;并且是sinopia1.4.0的衍生版本&#xff0c;与其100%向后兼容。Verdaccio的名称来源于意大利中世纪晚期fresco绘画中流行的一种绿色。 Verdaccio的主要功能是在本地环境中管理和共享npm软件包。…

鸿蒙应用开发之调用C++开发代码库3

接着下来,我们仔细分析C++代码的实现,要理解怎么样把ArkTS类型转换为C++类型,并且返回参数值时,怎么从C++的类型转换为ArkTS类型。 要想在ArkTS调用C++的代码,需要把上面的编译器信息打包到应用程序HAP里,当运行的时候,就可以找到加载的对应的声明信息。 我们从JS调用框…

framework ‘CoreAudioTypes‘ not found

几天前我升级Xcode15之后遇到了这个问题。关于“CoreAudioTypes”的信息完全是误导。在我的例子中&#xff0c;原因是在删除一些旧代码时&#xff0c;我不小心删除了仍然需要的类。然而&#xff0c;在构建时弹出的唯一消息是关于“CoreAudioTypes”——当我恢复丢失的类时&…

基于区块链的Web 3.0关键技术研讨会顺利召开

基于区块链的Web3.0关键技术研讨会 2024年4月23日&#xff0c;由国家区块链技术创新中心主办的“基于区块链的web3.0关键技术研讨会”召开。Web3.0被用来描述一个运行在“区块链”技术之上的“去中心化”的互联网&#xff0c;该网络上的主体掌握自己数据所有权和使用权&#xf…

使用OpenCV GUI清理数据集 | 为目标检测模型创建更好的数据集

点击下方卡片&#xff0c;关注“小白玩转Python”公众号 在深度学习中有几件重要的事情&#xff0c;我认为数据是最关键的。如果没有合适的数据&#xff0c;要取得好的结果是非常困难的。即使你用强大的预训练模型和GPU训练模型&#xff0c;你的模型也可能表现不佳。在本文中&a…

Kotlin核心编程知识点-02-面向对象

文章目录 1.类和构造方法1.1.Kotlin 中的类及接口1.1.1.Kotlin 中的类1.1.2.可带有属性和默认方法的接口 1.2.更简洁地构造类的对象1.2.1.构造方法默认参数1.2.2.init 语句块1.2.3.延迟初始化&#xff1a;by lazy 和 lateinit 1.3.主从构造方法 2.不同的访问控制原则2.1.限制修…

Apifox接口报错401,msg:“未授权”

Apifox接口报错401&#xff0c;msg:“未授权” 报错&#xff1a; 原因&#xff1a;Apifox接口好像两小时token就过期了&#xff0c;得重新获取 一、打开登录接口&#xff0c;找到token 二、打开根目录找到token&#xff0c;将登录的token值拷贝过来&#xff0c;点击保存 三…

Milvus的系统架构

简介 Milvus的构建在许多知名的向量搜索库比如Faiss, HNSW, DiskANN, SCANN等之上的&#xff0c;它针对稠密向量数据集的相似搜索而设计&#xff0c;能支持百万、十亿甚至万亿级别的向量搜索。 Milvus支持数据分片&#xff0c;流式数据插入&#xff0c;动态schema&#xff0c…

JVM运行时内存:虚拟机栈

文章目录 1. 概述2. 栈针3. 栈针内部结构3.1 局部变量表3.2 操作数栈3.3 动态链接3.4 方法返回地址3.5 一些附加信息 运行时内存整体结构如下图所示: 1. 概述 如何理解栈管运行&#xff0c;堆管存储&#xff1f; 角度一&#xff1a;GC;OOM角度二&#xff1a;栈、堆执行效率角…

电子合同怎么盖章的

数字证书盖章&#xff1a;利用个人或企业的数字证书进行盖章。数字证书作为数字身份证明&#xff0c;确保了电子签名和盖章的可信度。通过加密技术&#xff0c;确保合同内容不被篡改&#xff0c;盖章过程完成后&#xff0c;合同具有法律效力。 时间戳盖章&#xff1a;在电子合…

STM32 HAL TM1638读取24个按键

本文分享一下天微电子的另一款数码管按键驱动芯片TM1638的单片机C语言驱动程序。 笔者采用的MCU是STM32单片机&#xff0c;STM32CubeMX Keil5开发&#xff0c;使用了HAL库。 一、TM1638介绍 1、基础信息 TM1638属于一款LED驱动控制专用电路&#xff0c;其特性如下&#xf…

析构函数详解

目录 析构函数概念特性对象的销毁顺序 感谢各位大佬对我的支持,如果我的文章对你有用,欢迎点击以下链接 &#x1f412;&#x1f412;&#x1f412; 个人主页 &#x1f978;&#x1f978;&#x1f978; C语言 &#x1f43f;️&#x1f43f;️&#x1f43f;️ C语言例题 &…

两步将 CentOS 6.0 原地升级并迁移至 RHEL 7.9

《OpenShift / RHEL / DevSecOps 汇总目录》 说明 本文介绍如何将一个 CentOS 6.0 的系统升级并转换迁移到 RHEL 7.9。 本文是《在离线环境中将 CentOS 7.X 原地升级并迁移至 RHEL 7.9》阶进篇。 所有被测软件的验证操作可参见上述前文中对应章节的说明。 准备 CentOS 6.…