Type/to search
2
Follow
0
Followers
[Problem mit der Erweiterungs-API der FMZ-Plattform] Die JS-Sprache hat beim Zugriff auf die Erweiterungs-API immer eine falsche Signatur. Ich hätte gern den Rat eines Experten.
Help
Created 2019-10-10 19:31:03  
 6
 1913

Als Beispiel für die Erweiterung der API auf der Plattform werden PY und GO genannt, in denen der Abschnitt über die Signatur beschrieben wird: Zuerst MD5-Verschlüsselung und dann UTF-8-Kodierung, ich sehe, dass PY direkt in die Bibliothek eingeführt wird, aber JS hat keine UTF-8-kodierte Funktion? Die Signatur ist daher immer falsch, und ich weiß nicht, ob die Kodierung falsch ist oder ob die Schreibweise selbst ein Problem hat.

Methods und AccessKey haben jeweils eine Zuteilung vor dem AccessKey.

var d = {
version: '1.0',
access_key: accessKey,
method: method,
args: [],
nonce: _N(UnixNano() / 1000000, 0),
}
var m = d.version + "|" + d.method + "|" + d.args + "|" + d.nonce + "|" + secretKey
d.sign = HMAC("md5", "hex", m, "pass")
var h = JSON.parse(HttpQuery("https://www.fmz.cn/api/v1?access_key="+accessKey+"&nonce="+d.nonce+"&args=[]&sign="+d.sign+"&version=1.0&method="+d.method))

Related Recommendations
Comment
All comments (5)

    写了一个,测试可以访问通了,您参考下:

    function main() { var accessKey = "" var secretKey = "" var method = "GetNodeList" var d = { version: '1.0', access_key: accessKey, method: method, args: "null", nonce: (new Date().getTime()).toString() } var m = d.version + "|" + d.method + "|" + d.args + "|" + d.nonce + "|" + secretKey d.sign = Hash("md5", "hex", m) var ret = HttpQuery("https://www.fmz.com/api/v1?access_key=" + accessKey + "&nonce=" + d.nonce + "&args=null&sign=" + d.sign + "&version=1.0&method=" + d.method) Log(ret) }

    accessKey , secretKey 填写自己的KEY 就可以了。

    7 years ago

    谢谢梦总哈~~~~

    7 years ago

    不客气。

    7 years ago

    这个扩展API 一般是给独立的程序调用的。一般不写在策略里面调用。

    7 years ago

    JS策略中无法调用,因为没有办法引用自己的库,python 的可以,因为python 可以随意引用需要的库。

    7 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)