lrf402788946 4 years ago
parent
commit
0707b61c5c
1 changed files with 4 additions and 1 deletions
  1. 4 1
      app/service/intercept.js

+ 4 - 1
app/service/intercept.js

@@ -55,11 +55,13 @@ class InterceptService extends CrudService {
       if (arr.length <= 2) throw new BusinessError();
       if (arr.length <= 2) throw new BusinessError();
       const _tenant = arr[1];
       const _tenant = arr[1];
       let project = await this.redis.get('project');
       let project = await this.redis.get('project');
-      if (!project) throw new BusinessError(ErrorCode.SERVICE_FAULT, '为设置中间层项目参数');
+      console.log(project);
+      if (!project) throw new BusinessError(ErrorCode.SERVICE_FAULT, '未设置中间层项目参数');
       project = JSON.parse(project);
       project = JSON.parse(project);
       if (!project.includes(_tenant)) throw new BusinessError();
       if (!project.includes(_tenant)) throw new BusinessError();
       const obj = { ip: clientIp, create_time: moment().format('YYYY-MM-DD HH:mm:ss') };
       const obj = { ip: clientIp, create_time: moment().format('YYYY-MM-DD HH:mm:ss') };
       // 访问量的添加
       // 访问量的添加
+      console.log('add visit');
       let hitsList = await this.redis.get(`${_tenant}/hitsList`);
       let hitsList = await this.redis.get(`${_tenant}/hitsList`);
       if (!hitsList) {
       if (!hitsList) {
         hitsList = [{ ...obj, route: url.pathname }];
         hitsList = [{ ...obj, route: url.pathname }];
@@ -73,6 +75,7 @@ class InterceptService extends CrudService {
         }
         }
       }
       }
       // 用户(ip)访问添加
       // 用户(ip)访问添加
+      console.log('add ip');
       let clientList = await this.redis.get(`${_tenant}/clientList`);
       let clientList = await this.redis.get(`${_tenant}/clientList`);
       if (!clientList) {
       if (!clientList) {
         clientList = [ obj ];
         clientList = [ obj ];