Kaynağa Gözat

deepcoin 签名

xiao.qiang 10 ay önce
ebeveyn
işleme
83269664c5
1 değiştirilmiş dosya ile 24 ekleme ve 21 silme
  1. 24 21
      client/deepcoin.test.js

+ 24 - 21
client/deepcoin.test.js

@@ -267,6 +267,12 @@ describe('deepcoin站点测试', () => {
 
     test('签名', (done) => {
 
+            // TODO 不知道哪来的
+            let info = {
+                'i': 547798,
+                's': '61dd6c49529a05569900e71f49a0cd87',
+            }
+
             function randomStr (e) {
                 e = e || 32
                 var t = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
@@ -277,32 +283,29 @@ describe('deepcoin站点测试', () => {
                 return n
             }
 
-            // TODO 不知道哪来的
-            let info = {
-                'i': 547798,
-                's': '61dd6c49529a05569900e71f49a0cd87',
-            }
-
+            // 替换到params中
             let timestamp = +new Date,
                 convertPOST = 1,
                 randomstr = randomStr(6),
                 appid = info.i
 
+
             let params = {
-                "ExchangeID": "DeepCoin",
-                "InstrumentID": "1BTCUSD",
-                "MemberID": "9313134",
-                "ActionType": "1",
-                "AccountID": "9313134",
-                "IsCrossMargin": 1,
-                "TradeUnitID": "9313134",
-                "LongLeverage": 32,
-                "ShortLeverage": 32,
-                "UserID": "9313134",
-                "appid": 547798,
-                "randomstr": "yw4d6k",
-                "timestamp": 1734787294762,
-                "convertPOST": convertPOST
+                'ExchangeID': 'DeepCoin',
+                'InstrumentID': '1BTCUSD',
+                'MemberID': '9313134',
+                'ActionType': '1',
+                'AccountID': '9313134',
+                'IsCrossMargin': 1,
+                'TradeUnitID': '9313134',
+                'LongLeverage': 32,
+                'ShortLeverage': 32,
+                'UserID': '9313134',
+
+                'appid': 547798,
+                'randomstr': 'yw4d6k',
+                'timestamp': 1734787294762,
+                'convertPOST': convertPOST,
             }
 
             let CryptoJS = require('crypto-js')
@@ -322,7 +325,7 @@ describe('deepcoin站点测试', () => {
                 appid,
                 convertPOST,
                 randomstr,
-                'timestamp': Date.now(),
+                timestamp,
                 ...params,
             }