浏览代码

Update mysql funcs

HonorLee 7 年之前
父节点
当前提交
1c89da22ee
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 11 3
      system/lib/core/view.js

+ 11 - 3
system/lib/core/view.js

@@ -4,15 +4,23 @@ var View = function(src,params){
     this.html = '';
     this.params = params?params:{};
 
+    let viewPath = src;
     if(!src.match(Core.Path.View)){
-        src = Core.Path.View + src + '.html';
+        viewPath = Core.Path.View + '/' + src + '.html';
+    }
+    try{
+        FILE.statSync(viewPath);
+    }catch(e){
+        LOGGER.error('No such view template ['+src+']');
+        return null;
     }
 
     try{
-        FILE.statSync(src);
-        var data = FILE.readFileSync(src,'UTF-8');
+        var data = FILE.readFileSync(viewPath,'UTF-8');
         this.html = EJS.render(data,this.params);
     }catch(e){
+        LOGGER.error('View template render error ['+src+']');
+        LOGGER.error(e);
         return null;
     }