Import "Cjson.lua"
Import "ShanHai.lua"
Thread.SetShareVar "请求地址", "https://api.yankami.cn/"
Thread.SetShareVar "项目ID", ""
Thread.SetShareVar "项目秘钥", ""
Thread.SetShareVar "卡密", ""
Thread.SetShareVar "设备编号", GetDeviceID()
换绑机器码()
Function 换绑机器码()
Dim timeStamp = Time()
Dim sign = Encode.Md5(Thread.GetShareVar("项目ID")&Thread.GetShareVar("项目秘钥")&timeStamp)
Dim 请求返回 = URL.Get(Thread.GetShareVar("请求地址")&"jqm?xmid="&Thread.GetShareVar("项目ID")&"&km="&Thread.GetShareVar("卡密")&"&jqm="&Thread.GetShareVar("设备编号")&"&timeStamp="&timeStamp&"&sign="&sign,5)
TracePrint "换绑机器码:"&请求返回
Dim jqmResponse
If InStr(1, 请求返回, "code") <> 0 Then
jqmResponse = Cjson.Decode(请求返回)
End If
If jqmResponse And jqmResponse["code"] = 200 Then
TracePrint "换绑成功"
Dialog.MsgBox("\t\t\t\t\t\t\t\t 提示:换绑成功!",0)
Else
TracePrint "换绑失败"
Dialog.MsgBox("\t\t\t\t\t\t\t\t 提示:换绑失败!",0)
End If
EndScript//停止辅助
End Function
Dim 项目ID,项目秘钥,卡密,设备编号
项目ID = ""
项目秘钥 = ""
卡密 = ""
设备编号 = CStr(Plugin.Sys.GetHDDSN())
Call 换绑机器码()
Function 换绑机器码()
Dim timeStamp,sign,请求地址,请求URL,响应内容,状态
timeStamp = getTime()
sign = Plugin.Encrypt.Md5String(项目ID&项目秘钥&timeStamp)
请求地址 = "http://api.yankami.cn/jqm"
请求URL = 请求地址&"?xmid="&项目ID&"&km="&卡密&"&jqm="&设备编号&"&timeStamp="&timeStamp&"&sign="&sign
TracePrint "换绑机器码 URL:"&请求URL
响应内容 = Lib.网络.获得网页源文件_增强版(请求URL,"utf-8")
TracePrint "响应内容:"&响应内容
If InStr(1, 响应内容, "{") <> 1 or InStr(1, 响应内容, "code") = 0 Then
TracePrint "提示:换绑失败!"
MessageBox "提示:换绑失败!"
ExitScript//停止辅助
Else
状态 = json解析(响应内容, "code")
TracePrint "状态:"&状态
If 状态 <> 200 Then
TracePrint "提示:换绑失败!"
MessageBox "提示:换绑失败!"
Else
TracePrint "提示:换绑成功!"
MessageBox "提示:换绑成功!"
End If
ExitScript//停止辅助
End If
End Function
Function json解析(resp,json路径)
Set sc = CreateObject("MSScriptControl.ScriptControl")
sc.Language = "JScript"
sc.AddCode "var tmp = " & resp & ";"
json解析 = sc.Eval("tmp." & json路径)
End Function
Function getTime()
Dim 年, 月, 天, 小时, 分钟, 秒, dataTime
dataTime = Plugin.GetSysInfo.GetDateTime()
年 = Year(dataTime)
月 = Month(dataTime) - 2
天 = Day(dataTime) - 1
小时 = Hour(dataTime)
分钟 = Minute(dataTime)
秒 = Second(dataTime)
If 月 < 0 Then
月 = 月 + 12
年 = 年 - 1
End If
getTime = (((((Round((年 - 1) * 365 + 年 / 4 - 年 / 100 + 年 / 400) + Int((((367 * 月) / 12) - 30) + 59) + 天 - 719162) * 24 + (小时 - 8)) * 60) + 分钟) * 60 + 秒)
End Function
local 请求地址 = "https://api.yankami.cn/"
local 项目ID = ""
local 项目秘钥 = ""
local 卡密 = ""
local 设备编号 = "LanRen" .. os.time()
function 换绑机器码()
local timeStamp = os.time()
local sign = MD5(项目ID .. 项目秘钥 .. timeStamp);
local ret, code = httpPost(请求地址 .. "jqm", "xmid=" .. 项目ID .. "&km=" .. 卡密 .. "&jqm=" .. 设备编号 .. "&timeStamp=" .. timeStamp .. "&sign=" .. sign)
print("换绑机器码:" .. ret)
if code == 200 and isJsonStr(ret) then
ret = jsonLib.decode(ret)
end
if code ~= 200 or ret.code ~= 200 then
print("换绑失败,请重试!")
toast("换绑失败,请重试!")
else
print("换绑成功,请重新运行!")
toast("换绑成功,请重新运行!")
end
end
换绑机器码()
var 请求地址 = "https://api.yankami.cn/"
var 项目ID = ""
var 项目秘钥 = ""
var 卡密 = ""
var 设备编号 = DeviceWrapper.prototype.getAndroidId()
换绑机器码()
function 换绑机器码() {
var timeStamp = parseInt(new Date().getTime() / 1000)
console.log("timeStamp:" + timeStamp)
var sign = UtilsWrapper.prototype.dataMd5(项目ID + 项目秘钥 + timeStamp)
请求返回 = sendGet(请求地址 + "jqm?xmid=" + 项目ID + "&km=" + 卡密 + "&jqm=" + 设备编号 + "&timeStamp=" + timeStamp + "&sign=" + sign)
console.log("换绑机器码:" + 请求返回)
if (!请求返回.startsWith("{") || !请求返回.endsWith("}")) {
console.log("换绑失败!")
toast("换绑失败!")
} else {
var json = JSON.parse(请求返回)
if (json["code"] != 200) {
toast("换绑失败!")
} else {
toast("换绑成功!")
}
}
}