Kaynağa Gözat

新增登录保存用户信息

cheny 4 yıl önce
ebeveyn
işleme
3460c9e2ce
1 değiştirilmiş dosya ile 14 ekleme ve 0 silme
  1. 14 0
      app/service/login.js

+ 14 - 0
app/service/login.js

@@ -69,6 +69,20 @@ class LoginService extends CrudService {
     user.menus = JSON.stringify(_menus);
     const token = await this.createJwt(user);
     await this.app.redis.set(key, token, 'EX', 60 * 60 * 24);
+
+    const operationlogdata = { login_id: user.id, login_name: user.name, login_role: user.role, type: '0', operation_edit: '登录' };
+    const url = 'http://127.0.0.1:9004/api/market/operationlog/';
+    const operationlog = await this.ctx.curl(url, {
+      method: 'post',
+      headers: {
+        'content-type': 'application/json',
+      },
+      dataType: 'json',
+      data: JSON.stringify(operationlogdata),
+    });
+    if (operationlog.data.errcode === 0) {
+      console.log('1234');
+    }
     return { key };
   }