日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

如何对接泡椒云,给你的Auto.js脚本增加卡密验证功能?详细教程

發(fā)布時間:2023/12/31 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 如何对接泡椒云,给你的Auto.js脚本增加卡密验证功能?详细教程 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

這篇文章主要講解一下Auto.js開發(fā)者如何通過對接泡椒云sdk,給你自己寫的腳本增加卡密驗證功能。

對接教程:

1、先將下載到的PJYSDK.js文件用編輯器打開,選中所有復(fù)制粘貼到你自己的Autojs代碼文件中。下面就是一段引用PJYSDK.js的Auto.js示例程序:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 /* 將PJYSDK.js文件中的代碼復(fù)制粘貼到下面空白處 */ /* 將PJYSDK.js文件中的代碼復(fù)制粘貼到上面空白處 */ // AppKey 和 AppSecret 在泡椒云開發(fā)者后臺獲取 let pjysdk = new PJYSDK("bnsekoso6itblafodqe6", "m3p0lkODcCUpyf3o6DkktAQSJqqLygeV"); pjysdk._protocol = "https" pjysdk.debug = true; pjysdk.SetCard("mrfzBBIFb295RAE8"); // 監(jiān)聽心跳失敗事件 pjysdk.event.on("heartbeat_failed", function(hret) { ????log("心跳失敗,嘗試重登...") ????sleep(2000); ????let login_ret = pjysdk.CardLogin(); ????if (login_ret.code == 0) { ????????log("重登成功"); ????} else { ????????toastLog(login_ret.message);??//重登失敗 ????????sleep(200); ????????exit();??// 退出腳本 ????} }); // 當(dāng)腳本正常或者異常退出時會觸發(fā)exit事件 events.on("exit", function(){ ????pjysdk.CardLogout(); // 調(diào)用退出登錄 ????log("結(jié)束運行"); }); let login_ret = pjysdk.CardLogin(); if (login_ret.code == 0) { ????// 登錄成功,后面寫你的業(yè)務(wù)代碼 } else { ????// 登錄失敗提示 ????toast(login_ret.message); } // 當(dāng)腳本正常或者異常退出時會觸發(fā)exit事件 events.on("exit", function(){ ????pjysdk.CardLogout(); // 調(diào)用退出登錄 ????log("結(jié)束運行"); });

2、然后根據(jù)文檔(https://docs.paojiaoyun.com/autojs_sdk.html)初始化,開始使用。

3、下面給出了PJYSDK.js源碼,懶得下載的朋友可以直接復(fù)制下面的代碼。

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 //下面是PJYSDK.js源碼 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;??// 是否自動開啟心跳任務(wù) ????????this._heartbeat_gap = 60 * 1000; // 默認(rèn)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 (id == null || id == "" || id == "unknown") { ????????????id = device.getAndroidId(); ????????} ????????if (id == null || id == "" || id == "unknown") { ????????????id = device.getIMEI(); ????????} ????????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 = b ????????????b = 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) { ????????// 構(gòu)建公共參數(shù) ????????params["app_key"] = this._app_key; ????????method = method.toUpperCase(); ????????let url = this._protocol + "://" + this._host + path ????????let max_retries = this._retry_count; ????????let retries_count = 0; ????????let data = {"code": -1, "message": "連接服務(wù)器失敗"}; ????????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 {??// POST ????????????????????resp = 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; ????} ????/* 卡密相關(guān) */ ????PJYSDK.prototype.CardLogin = function() {??// 卡密登錄 ????????if (!this._card) { ????????????return {"code": -4, "message": "請先設(shè)置卡密"}; ????????} ????????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() {??// 卡密心跳,默認(rèn)會自動調(diào)用 ????????if (!this._token) { ????????????return {"code": -2, "message": "請在卡密登錄成功后調(diào)用"}; ????????} ????????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() {??// 開啟卡密心跳任務(wù) ????????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) { // 結(jié)束心跳任務(wù) ????????????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() { // 卡密解綁設(shè)備,需開發(fā)者后臺配置 ????????if (!this._token) { ????????????return {"code": -2, "message": "請在卡密登錄成功后調(diào)用"}; ????????} ????????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) { // 自定義設(shè)置解綁密碼 ????????if (!this._token) { ????????????return {"code": -2, "message": "請在卡密登錄成功后調(diào)用"}; ????????} ????????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) { // 用戶通過解綁密碼解綁設(shè)備 ????????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); ????} ????/* 用戶相關(guān) */ ????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": "請先設(shè)置用戶賬號密碼"}; ????????} ????????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() {??// 用戶心跳,默認(rèn)會自動開啟 ????????if (!this._token) { ????????????return {"code": -2, "message": "請在用戶登錄成功后調(diào)用"}; ????????} ????????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() {??// 開啟用戶心跳任務(wù) ????????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) { // 結(jié)束心跳任務(wù) ????????????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() { // 用戶解綁設(shè)備,需開發(fā)者后臺配置 ????????if (!this._token) { ????????????return {"code": -2, "message": "請在用戶登錄成功后調(diào)用"}; ????????} ????????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); ????} ????/* 配置相關(guān) */ ????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); ????} ????/* 軟件相關(guān) */ ????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() {??// 試用心跳,默認(rèn)會自動調(diào)用 ????????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() {??// 開啟試用心跳任務(wù) ????????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.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": 10407, "message": "試用已到期!"}); ????????????} ????????}, 1000, this); ????} ????PJYSDK.prototype.TrialLogout = function() {??// 試用退出登錄,沒有http請求,只是清理本地記錄 ????????this.is_trial = false; ????????this._heartbeat_ret = {"code": -9, "message": "還未開始驗證"}; ????????if (this._heartbeat_task) { // 結(jié)束心跳任務(wù) ????????????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) { // 獲取遠程數(shù)據(jù) ????????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) { // 創(chuàng)建遠程數(shù)據(jù) ????????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) { // 修改遠程數(shù)據(jù) ????????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) { // 刪除遠程數(shù)據(jù) ????????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) { // 執(zhí)行遠程函數(shù) ????????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; })();

如果你對Auto.js開發(fā)腳本有什么疑問或問題,歡迎加我們的QQ學(xué)員群交流:117236255 (←點此進群)

轉(zhuǎn)載請注明:攢外快網(wǎng)???如何對接泡椒云,給你的Auto.js腳本增加卡密驗證功能?詳細教程

總結(jié)

以上是生活随笔為你收集整理的如何对接泡椒云,给你的Auto.js脚本增加卡密验证功能?详细教程的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。