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
-  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;
   }