Explorar o código

programID为空时错误, 修改获取IP方法

zhangweicheng %!s(int64=5) %!d(string=hai) anos
pai
achega
d8f6e0fc52

+ 1 - 3
modules/users/controllers/login_controller.js

@@ -287,9 +287,7 @@ class LoginController {
             const userinfo2 = await userModel.findDataByAccount(userData.mobile);
             if (userinfo2.isLoginValid === 1) {
                 // 获取本次访问ip
-                let ip = request.connection.remoteAddress;
-                ip = ip.split(':');
-                ip = ip[3] === undefined ? '' : ip[3];
+                let ip = request.headers["x-real-ip"]? request.headers["x-real-ip"]:"";
                 let logModel = new LogModel();
                 let logCount = await logModel.count();
                 logCount = logCount > 30 ? 30 : logCount;

+ 2 - 1
web/building_saas/main/js/views/main_tree_col.js

@@ -326,7 +326,8 @@ let MainTreeCol = {
         let tips = '';
         if (node.data.programID != null){
           let tpl = projectObj.project.calcProgram.compiledTemplates[node.data.programID];
-          tips = tpl.ID + ' ' + tpl.name + ':' + (tpl.memo ? tpl.memo : '[无]');   // 加个判断保护,兼容旧项目此处空值
+          if(tpl) tips = tpl.ID + ' ' + tpl.name + ':' + (tpl.memo ? tpl.memo : '[无]');   // 加个判断保护,兼容旧项目此处空值
+          
         };
         let dynamicCombo = sheetCommonObj.getTipsCombo(true, tips, setting, node);
         dynamicCombo.itemHeight(10).items(projectObj.project.calcProgram.compiledTemplateNames).editable(false);