cheny преди 4 години
родител
ревизия
0d31d52043
променени са 1 файла, в които са добавени 5 реда и са изтрити 5 реда
  1. 5 5
      app/service/login.js

+ 5 - 5
app/service/login.js

@@ -108,11 +108,11 @@ class LoginService extends CrudService {
   }
   }
 
 
   // 创建登录Token
   // 创建登录Token
-  async createJwt(user) {
-    // const { secret, expiresIn = '1d', issuer = role } = this.config.jwt;
-    // const subject = phone;
-    // const res = { uid: id, userid: uid, name, phone, role, menus, openid, remark, deptid, deptname, pid, code };
-    const token = await jwt.sign(user);
+  async createJwt({ id, adminuser, uid, phone, role, remark, deptid, pid, code }) {
+    const { secret, expiresIn = '1d', issuer = role } = this.config.jwt;
+    const subject = phone;
+    const res = { uid: id, userid: uid, adminuser, phone, role, remark, deptid, pid, code };
+    const token = await jwt.sign(res, secret, { expiresIn, issuer, subject });
     return token;
     return token;
   }
   }