函数库,必看
<p>//任何代码都要使用函数库,先复制函数库到你的代码中,再复制其他代码
`</p>
<pre><code class="language-lua">//-------------------------------------------这里是需要修改的参数
Function Request(api, 参数)
dim API密码 = &quot;xxxx&quot;//在后台的设置,或者APP的通用设置里面找
dim 开发者ID = &quot;1130&quot;//在后台左上角,或者APP【我的】中的【VID】
//--------------------------------------------------------------
Randomize
dim ApiList = array(&quot;https://napi.2cccc.cc/&quot;, &quot;http://api2.2cccc.cc/&quot;, &quot;http://api3.2cccc.cc/&quot;)
Dim connect_times = 0
dim 时间戳 = timestamp(0)
TracePrint 时间戳
dim 签名 = Encode.Md5(API密码 &amp; 时间戳)
dim common_params = &quot;center_id=&quot; &amp; 开发者ID &amp; &quot;&amp;tmstamp=&quot; &amp; 时间戳 &amp; &quot;&amp;sign=&quot; &amp; 签名
dim JSON = &quot;&quot;
connect_times = 0
Do While Mid(JSON, 3, 4) &lt;&gt; &quot;code&quot;
dim Host = ApiList( Int((UBound(ApiList)-0+1)*Rnd()+0) )
JSON = URL.Get(Host &amp; api &amp; &quot;?&quot; &amp; common_params &amp; &quot;&amp;&quot; &amp; 参数)
connect_times = connect_times + 1
If Mid(JSON, 3, 4) &lt;&gt; &quot;code&quot; and connect_times &gt; 1 Then
TracePrint &quot;连接服务器失败,尝试重连&quot;
Delay 10000
End If
If connect_times &gt; 50 Then
Request = Array(0, &quot;连接服务器失败(请注意,复制卡密的时候当心将换行符也复制了,会导致连接服务器失败)&quot;)
Exit Do
End If
Loop
If Mid(JSON, 3, 4) = &quot;code&quot; Then
dim Res = Encode.JsonToTable(JSON)
If Res[&quot;code&quot;] = &quot;1&quot; Then
If UCase(Encode.Md5( Res[&quot;timestamp&quot;] &amp; API密码)) = Ucase(Res[&quot;sign&quot;]) and Abs(clng(时间戳) - clng(Res[&quot;timestamp&quot;])) &lt; 600 Then
Request = array(1, Res[&quot;data&quot;])
Else
Request = array(0,&quot;请检查API密码是否填写正确&quot;)
End If
Else
Request = array(0,Res[&quot;msg&quot;])
End If
End If
End Function
Function timestamp(times)
If times = 0 Then
Dim 淘宝时间戳JSON = URL.Get(&quot;https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp&quot;)
Dim 淘宝时间戳 = encode.jsontotable(淘宝时间戳JSON)
If 淘宝时间戳 &lt;&gt; null Then
TracePrint &quot;获取淘宝时间戳成功&quot;
timestamp = Left(淘宝时间戳[&quot;data&quot;][&quot;t&quot;], 10)
Else
TracePrint &quot;获取淘宝时间戳失败,开始获取拼多多时间戳&quot;
timestamp = timestamp(times + 1)
End If
End If
If times = 1 Then
Dim 拼多多时间戳JSON = URL.Get(&quot;https://api.pinduoduo.com/api/server/_stm&quot;)
Dim 拼多多时间戳 = encode.jsontotable(拼多多时间戳JSON)
If 拼多多时间戳 &lt;&gt; null Then
TracePrint &quot;获取拼多多时间戳成功&quot;
timestamp = Left(拼多多时间戳[&quot;server_time&quot;], 10)
Else
TracePrint &quot;获取拼多多时间戳失败,开始获取世界时间&quot;
timestamp = timestamp(times + 1)
End If
End If
If times = 2 Then
Dim 世界时间戳JSON = URL.Get(&quot;https://worldtimeapi.org/api/timezone/Asia/Shanghai&quot;)
Dim 世界时间戳 = encode.jsontotable(世界时间戳JSON)
If 世界时间戳 &lt;&gt; null Then
TracePrint &quot;获取世界时间戳成功&quot;
timestamp = Left(世界时间戳[&quot;unixtime&quot;], 10)
Else
TracePrint &quot;获取世界时间戳失败,开始获取本地时间&quot;
timestamp = timestamp(times + 1)
End If
End If
If times = 3 Then
TracePrint &quot;获取本地时间戳&quot;
timestamp = time()
End If
End Function</code></pre>
<p>`</p>