权朗网络API3.0

权朗网络API3.0


aiwork

<pre><code class="language-javascript">var http = new okHttp(); // var LocalStorage = storages.create(&amp;#039;quanlang&amp;#039;); var center_id = &amp;#039;id&amp;#039;;//在后台左上角,或者APP【我的】中的【VID】 var api_password = &amp;#039;密码&amp;#039;;//在后台的设置,或者APP的通用设置里面找 var software = &amp;#039;软件名&amp;#039;;//这里是后台的软件名 var needle = &amp;#039;&amp;#039;, 失败原因 = null let cards = null; //心跳函数,不能去掉,这里会实时更新一些内容,酌情取用 function card_ping() { var ping_result = ql_request(&amp;#039;apiv3/card_ping&amp;#039;, { card: card, needle: needle }); if (ping_result[0] == 1) { //心跳成功 卡密剩余时间 = ping_result[1][&amp;#039;endtime&amp;#039;] 卡密到期时间 = ping_result[1][&amp;#039;less_time&amp;#039;] console.log(&amp;#039;最新的卡密到期时间:&amp;#039; + 卡密剩余时间); console.log(&amp;#039;最新的卡密剩余时间:&amp;#039; + 卡密到期时间); // sleep.millisecond( ping_result[1][&amp;#039;heartbeat_second&amp;#039;]*1000 );//这里指的是心跳间隔根据后台设置的走,尽量不要改这个 // card_ping();//这块也不要改, return true } else { //心跳失败,有异常 console.log(&amp;#039;心跳失败,失败原因是:&amp;#039; + ping_result[1]); 失败原因 = ping_result[1] // threads.shutDownAll(); return false } } //卡密登录 var card_login_result = ql_request(&amp;#039;apiv3/card_login&amp;#039;, { card: card }); printl(card_login_result) if (card_login_result[0] == 1) { //卡密登录成功,这里取出来几个常用信息供参考,更多信息请看接入文档。 console.log(&amp;#039;卡密到期时间:&amp;#039; + card_login_result[1][&amp;#039;endtime&amp;#039;]); console.log(&amp;#039;卡密剩余时间:&amp;#039; + card_login_result[1][&amp;#039;less_time&amp;#039;]); console.log(&amp;#039;卡密类型为:&amp;#039; + card_login_result[1][&amp;#039;type&amp;#039;]); //下面是开启心跳线程,一定要有 // LocalStorage.put(&amp;#039;card_login_needle&amp;#039;,card_login_result[1][&amp;#039;needle&amp;#039;]); needle = card_login_result[1][&amp;#039;needle&amp;#039;]; // threads.start(function() { // card_ping(); 卡密剩余时间 = card_login_result[1][&amp;#039;less_time&amp;#039;] 卡密到期时间 = card_login_result[1][&amp;#039;endtime&amp;#039;] toast.showLong(&amp;#039; 激活:【&amp;#039; + card_login_result[1][&amp;#039;type&amp;#039;] + &amp;#039;卡】 成功 \n 卡密剩余时间:\n&amp;#039; + 卡密剩余时间 + &amp;#039;\n&amp;#039; + &amp;quot;卡密到期时间:\n&amp;quot; + 卡密到期时间) sleep.millisecond(1000) if (cards !== null) { clearInterval(cards); } cards = setInterval(() =&amp;gt; { // console.log(&amp;quot;这个函数每 2 秒执行一次&amp;quot;); // printl(cards) // printl(typeof (cards)) if (card_ping()) { // printl(&amp;quot;心跳检测通过&amp;quot;) } else { clearInterval(cards) JsAlert.confirm(&amp;#039;心跳失败 卡密验证失败:&amp;#039; + 失败原因) stopAll() printl(&amp;quot;脚本停止 &amp;quot; + 失败原因) } }, 600000) } else { //卡密登录失败 console.log(&amp;#039;卡密登录失败,失败原因是:&amp;#039; + card_login_result[1]); JsAlert.confirm(&amp;#039;卡密验证失败:&amp;#039; + card_login_result[1]) stopAll() printl(&amp;quot;脚本停止 &amp;quot; + card_login_result[1]) } //发送权朗请求(带加密) function ql_request(api, param) { var api_complete_path = &amp;#039;&amp;#039;; var api_list = [&amp;#039;你的IP地址&amp;#039;]; var connect_server_times = 0; var server_return_json = &amp;#039;&amp;#039;; param[&amp;#039;center_id&amp;#039;] = center_id; param[&amp;#039;software&amp;#039;] = software; do { if (connect_server_times &amp;gt; 0) sleep.millisecond(6000); if (connect_server_times &amp;gt; 20) { console.log(&amp;#039;连接服务器失败,请检查网络或联系管理员&amp;#039;); return [false, &amp;#039;连接服务器失败,请检查网络或联系管理员&amp;#039;]; } api_complete_path = api_list[parseInt(Math.random() * (api_list.length), 10)] + api; console.log(&amp;#039;尝试第【&amp;#039; + (++connect_server_times) + &amp;#039;】次连接服务器&amp;#039;); timestamp = get_net_timestamp(&amp;#039;pdd&amp;#039;)//不想用淘宝的话这里可以改成pdd(拼多多),world(世界时间),local(本地时间),不会改就不要动就行了 param[&amp;#039;timestamp&amp;#039;] = timestamp; param[&amp;#039;sign&amp;#039;] = hex_md5(api_password + timestamp); try { server_return_json = http.postForm(api_complete_path, objToQuery(param)); } catch (e) { server_return_json = &amp;#039;&amp;#039;; console.log(e) } //console.log( &amp;#039;服务器返回结果:&amp;#039; + server_return_json );//调试时候可以打开看看。 } while (server_return_json.substring(2, 6) != &amp;quot;code&amp;quot;); var server_return_data = JSON.parse(server_return_json); if (server_return_data[&amp;#039;code&amp;#039;] == 0) return [false, server_return_data[&amp;#039;msg&amp;#039;]]; //验证签名是否正确 if (hex_md5(server_return_data[&amp;#039;timestamp&amp;#039;] + api_password) != server_return_data[&amp;#039;sign&amp;#039;] || Math.abs(timestamp - server_return_data[&amp;#039;timestamp&amp;#039;] &amp;gt; 600)) return [false, &amp;#039;算法验证错误,请联系管理员&amp;#039;];//这里一般后台没有改api密码,不会出现这个情况,改了api密码,或者有人尝试破解你的软件,会出现这个情况。 return [true, server_return_data[&amp;#039;data&amp;#039;]]; } function objToQuery(obj) { var arr = []; for (var key in obj) { if (obj.hasOwnProperty(key)) { arr.push(encodeURIComponent(key) + &amp;quot;=&amp;quot; + encodeURIComponent(obj[key])); } } return arr.join(&amp;quot;&amp;amp;&amp;quot;); } //获取网络时间戳 function get_net_timestamp(platform) { switch (platform) { case &amp;#039;taobao&amp;#039;: try { return_json = http.get(&amp;#039;https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp&amp;#039;); obj = JSON.parse(return_json) } catch (e) { return_json = &amp;#039;&amp;#039;; obj = false; } if (return_json == &amp;#039;&amp;#039; || obj[&amp;#039;data&amp;#039;] == undefined) { console.log(&amp;#039;获取淘宝时间戳失败,开始获取拼多多时间戳&amp;#039;); return get_net_timestamp(&amp;#039;pdd&amp;#039;) } else { console.log(&amp;#039;获取淘宝时间戳成功&amp;#039;) return obj[&amp;#039;data&amp;#039;][&amp;#039;t&amp;#039;].slice(0, 10) } break; case &amp;#039;pdd&amp;#039;: try { return_json = http.get(&amp;#039;https://api.pinduoduo.com/api/server/_stm&amp;#039;); obj = JSON.parse(return_json) } catch (e) { return_json = &amp;#039;&amp;#039;; obj = false; } if (return_json == &amp;#039;&amp;#039; || obj[&amp;#039;server_time&amp;#039;] == undefined) { console.log(&amp;#039;获取拼多多时间戳失败,开始获取世界时间戳&amp;#039;); return get_net_timestamp(&amp;#039;world&amp;#039;) } else { console.log(&amp;#039;获取拼多多时间戳成功&amp;#039;) return obj[&amp;#039;server_time&amp;#039;].toString().slice(0, 10) } break; case &amp;#039;world&amp;#039;: try { return_json = http.get(&amp;#039;https://worldtimeapi.org/api/timezone/Asia/Shanghai&amp;#039;); obj = JSON.parse(return_json) } catch (e) { return_json = &amp;#039;&amp;#039;; obj = false } if (return_json == &amp;#039;&amp;#039; || obj[&amp;#039;unixtime&amp;#039;] == undefined) { console.log(&amp;#039;获取世界时间戳失败,开始获取本地时间戳&amp;#039;); return get_net_timestamp(&amp;#039;local&amp;#039;) } else { console.log(&amp;#039;获取世界时间戳成功&amp;#039;) return obj[&amp;#039;unixtime&amp;#039;] } break; default: console.log(&amp;#039;获取本地时间戳&amp;#039;) return Math.floor(Date.now() / 1000); } } //-------MD5--------------------- function hex_md5(s) { return binl2hex(core_md5(str2binl(s), s.length * 8)); } function core_md5(x, len) { x[len &amp;gt;&amp;gt; 5] |= 0x80 &amp;lt;&amp;lt; ((len) % 32); x[(((len + 64) &amp;gt;&amp;gt;&amp;gt; 9) &amp;lt;&amp;lt; 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (var i = 0; i &amp;lt; x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); } function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b &amp;amp; c) | ((~b) &amp;amp; d), a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b &amp;amp; d) | (c &amp;amp; (~d)), a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); } function core_hmac_md5(key, data) { var bkey = str2binl(key); if (bkey.length &amp;gt; 16) bkey = core_md5(bkey, key.length * 8); var ipad = Array(16), opad = Array(16); for (var i = 0; i &amp;lt; 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * 8); return core_md5(opad.concat(hash), 512 + 128); } function safe_add(x, y) { var lsw = (x &amp;amp; 0xFFFF) + (y &amp;amp; 0xFFFF); var msw = (x &amp;gt;&amp;gt; 16) + (y &amp;gt;&amp;gt; 16) + (lsw &amp;gt;&amp;gt; 16); return (msw &amp;lt;&amp;lt; 16) | (lsw &amp;amp; 0xFFFF); } function bit_rol(num, cnt) { return (num &amp;lt;&amp;lt; cnt) | (num &amp;gt;&amp;gt;&amp;gt; (32 - cnt)); } function str2binl(str) { var bin = Array(); var mask = (1 &amp;lt;&amp;lt; 8) - 1; for (var i = 0; i &amp;lt; str.length * 8; i += 8) bin[i &amp;gt;&amp;gt; 5] |= (str.charCodeAt(i / 8) &amp;amp; mask) &amp;lt;&amp;lt; (i % 32); return bin; } function binl2hex(binarray) { var hex_tab = 0 ? &amp;quot;0123456789ABCDEF&amp;quot; : &amp;quot;0123456789abcdef&amp;quot;; var str = &amp;quot;&amp;quot;; for (var i = 0; i &amp;lt; binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i &amp;gt;&amp;gt; 2] &amp;gt;&amp;gt; ((i % 4) * 8 + 4)) &amp;amp; 0xF) + hex_tab.charAt((binarray[i &amp;gt;&amp;gt; 2] &amp;gt;&amp;gt; ((i % 4) * 8)) &amp;amp; 0xF); } return str; } function binl2b64(binarray) { var tab = &amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&amp;quot;; var str = &amp;quot;&amp;quot;; for (var i = 0; i &amp;lt; binarray.length * 4; i += 3) { var triplet = (((binarray[i &amp;gt;&amp;gt; 2] &amp;gt;&amp;gt; 8 * (i % 4)) &amp;amp; 0xFF) &amp;lt;&amp;lt; 16) | (((binarray[i + 1 &amp;gt;&amp;gt; 2] &amp;gt;&amp;gt; 8 * ((i + 1) % 4)) &amp;amp; 0xFF) &amp;lt;&amp;lt; 8) | ((binarray[i + 2 &amp;gt;&amp;gt; 2] &amp;gt;&amp;gt; 8 * ((i + 2) % 4)) &amp;amp; 0xFF); for (var j = 0; j &amp;lt; 4; j++) { if (i * 8 + j * 6 &amp;gt; binarray.length * 32) str += b64pad; else str += tab.charAt((triplet &amp;gt;&amp;gt; 6 * (3 - j)) &amp;amp; 0x3F); } } return str; } function cache(key, val) { if (null === val) return LocalStorage.get(key); return LocalStorage.put(key, val); } </code></pre>

页面列表

ITEM_HTML