Browse Source

dsk接口jwt更改token检验

ellisran 5 months ago
parent
commit
dbb02792b7
1 changed files with 4 additions and 1 deletions
  1. 4 1
      app/lib/dsk.js

+ 4 - 1
app/lib/dsk.js

@@ -9,6 +9,8 @@
  */
 const crypto = require('crypto');
 const moment = require('moment');
+const jwt = require('jsonwebtoken');
+const privateKey = 'zhzhjwtqwerty';
 class DSK {
 
     /**
@@ -24,7 +26,8 @@ class DSK {
     }
 
     getToken() {
-        return crypto.createHash('md5').update(crypto.createHash('md5').update(this.tokenKey).digest('hex') + moment().format('DD-HH')).digest('hex');
+        // return crypto.createHash('md5').update(crypto.createHash('md5').update(this.tokenKey).digest('hex') + moment().format('DD-HH')).digest('hex');
+        return jwt.sign({ iat: Date.now() }, privateKey);
     }
 
     async sendSms(mobile) {