浏览代码

使用etag协商缓存

MaiXinRong 5 年之前
父节点
当前提交
c7e71eb946
共有 6 个文件被更改,包括 12 次插入2 次删除
  1. 0 1
      app/middleware/auto_logger.js
  2. 0 1
      app/view/layout/layout.ejs
  3. 6 0
      config/config.default.js
  4. 2 0
      config/config.qa.js
  5. 3 0
      config/plugin.js
  6. 1 0
      package.json

+ 0 - 1
app/middleware/auto_logger.js

@@ -18,7 +18,6 @@ module.exports = options => {
                 return ctx.getLogger('stage');
             }
             return ctx.getLogger('mixed');
-
         }
         if (this.session.sessionUser) {
             const bLogger = getBussinessLogger(this);

+ 0 - 1
app/view/layout/layout.ejs

@@ -4,7 +4,6 @@
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <meta http-equiv="x-ua-compatible" content="ie=edge">
     <title><%= ctx.menu.name === undefined ? '主页' : ctx.menu.name %>-计量支付</title>
     <link rel="stylesheet" href="/public/css/bootstrap/bootstrap.min.css">
     <link rel="stylesheet" href="/public/css/main.css">

+ 6 - 0
config/config.default.js

@@ -100,6 +100,8 @@ module.exports = appInfo => {
         app: true,
     };
 
+    config.filePath = '/etc/calc_file/';
+
     // 上传设置
     config.multipart = {
         whitelist: ['.json', '.txt',
@@ -146,5 +148,9 @@ module.exports = appInfo => {
         formLimit: '10mb',
     };
 
+    config.etag = {
+        weak: false,
+    };
+
     return config;
 };

+ 2 - 0
config/config.qa.js

@@ -43,6 +43,8 @@ module.exports = appInfo => {
         version: '1.0.0',
     };
 
+    config.filePath = appInfo.baseDir + '/app/public/';
+
     // session配置
     config.session = {
         key: 'ZHC_SESS',

+ 3 - 0
config/plugin.js

@@ -29,4 +29,7 @@ exports.sessionRedis = {
 exports.jsValidator = {
     enable: true,
     package: 'egg-js-validator',
+};
+exports.etag = {
+    package: 'egg-etag',
 };

+ 1 - 0
package.json

@@ -8,6 +8,7 @@
     "bignumber.js": "^8.1.1",
     "decimal.js": "^10.2.0",
     "egg": "^1.13.0",
+    "egg-etag": "^1.1.0",
     "egg-js-validator": "^1.0.2",
     "egg-multipart": "^2.7.1",
     "egg-mysql": "^3.0.0",