Browse Source

fix: 注释掉archiver的依赖

lanjianrong 4 năm trước cách đây
mục cha
commit
b776d28bf7
4 tập tin đã thay đổi với 132 bổ sung131 xóa
  1. 1 0
      app/controller/stage_controller.js
  2. 1 0
      app/public/js/stage.js
  3. 37 37
      app/service/stage_att.js
  4. 93 94
      package.json

+ 1 - 0
app/controller/stage_controller.js

@@ -1390,6 +1390,7 @@ module.exports = app => {
                     }
                 } catch (err) {
                     this.log(err);
+                    console.log(err);
                     this.setMessage(err.toString(), this.messageType.ERROR);
                 }
             }

+ 1 - 0
app/public/js/stage.js

@@ -3148,6 +3148,7 @@ $(document).ready(() => {
 
     // 获取附件信息
     $('body').on('click', '.list-table a', function () {
+        console.log($(this))
         const fid = $(this).attr('file-id');
         if ($('#showAttachment').attr('file-id') === fid && !$('#showAttachment').is(":hidden")) {
             return;

+ 37 - 37
app/service/stage_att.js

@@ -8,7 +8,7 @@
  * @version
  */
 
-const archiver = require('archiver');
+// const archiver = require('archiver');
 const path = require('path');
 const fs = require('fs');
 module.exports = app => {
@@ -100,44 +100,44 @@ module.exports = app => {
          * @return {string} 压缩后的zip文件路径
          */
         async compressedFile(fileIds, zipPath) {
-            this.initSqlBuilder();
-            this.sqlBuilder.setAndWhere('id', {
-                value: fileIds,
-                operate: 'in',
-            });
-            const [sql, sqlParam] = this.sqlBuilder.build(this.tableName);
-            const files = await this.db.query(sql, sqlParam);
-            // const paths = files.map(item => {
-            //     return { name: item.filename + item.fileext, path: item.filepath }
-            // })
-            return new Promise(resolve => {
-                // 每次开一个新的archiver
-                const ziparchiver = archiver('zip');
-                const outputPath = fs.createWriteStream(path.resolve(this.app.baseDir, zipPath));
-                ziparchiver.pipe(outputPath);
-                files.forEach(item => {
-                    ziparchiver.file(item.filepath, { name: item.filename + item.fileext });
-                });
+            // this.initSqlBuilder();
+            // this.sqlBuilder.setAndWhere('id', {
+            //     value: fileIds,
+            //     operate: 'in',
+            // });
+            // const [sql, sqlParam] = this.sqlBuilder.build(this.tableName);
+            // const files = await this.db.query(sql, sqlParam);
+            // // const paths = files.map(item => {
+            // //     return { name: item.filename + item.fileext, path: item.filepath }
+            // // })
+            // return new Promise(resolve => {
+            //     // 每次开一个新的archiver
+            //     const ziparchiver = archiver('zip');
+            //     const outputPath = fs.createWriteStream(path.resolve(this.app.baseDir, zipPath));
+            //     ziparchiver.pipe(outputPath);
+            //     files.forEach(item => {
+            //         ziparchiver.file(item.filepath, { name: item.filename + item.fileext });
+            //     });
 
-                // 存档警告
-                ziparchiver.on('warning', function(err) {
-                    if (err.code === 'ENOENT') {
-                        console.warn('stat故障和其他非阻塞错误');
-                    } else {
-                        throw err;
-                    }
-                });
+            //     // 存档警告
+            //     ziparchiver.on('warning', function(err) {
+            //         if (err.code === 'ENOENT') {
+            //             console.warn('stat故障和其他非阻塞错误');
+            //         } else {
+            //             throw err;
+            //         }
+            //     });
 
-                // 存档出错
-                ziparchiver.on('error', function(err) {
-                    console.log(err);
-                    throw err;
-                });
-                ziparchiver.finalize();
-                outputPath.on('close', () => {
-                    resolve(ziparchiver.pointer());
-                });
-            });
+            //     // 存档出错
+            //     ziparchiver.on('error', function(err) {
+            //         console.log(err);
+            //         throw err;
+            //     });
+            //     ziparchiver.finalize();
+            //     outputPath.on('close', () => {
+            //         resolve(ziparchiver.pointer());
+            //     });
+            // });
         }
     }
     return StageAtt;

+ 93 - 94
package.json

@@ -1,96 +1,95 @@
 {
-  "name": "calculation",
-  "version": "1.0.0",
-  "description": "calculation paying frontend",
-  "private": true,
-  "dependencies": {
-    "@alicloud/pop-core": "^1.7.9",
-    "ali-rds": "^3.3.0",
-    "archiver": "^5.0.2",
-    "atob": "^2.1.2",
-    "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",
-    "egg-redis": "^1.0.2",
-    "egg-scripts": "^1.0.0",
-    "egg-session-redis": "^1.0.0",
-    "egg-validate": "^1.0.0",
-    "egg-view": "^1.1.2",
-    "egg-view-ejs": "^1.1.0",
-    "egg-wechat-all": "^0.1.4",
-    "gt3-sdk": "^2.0.0",
-    "gulp": "^4.0.0",
-    "js-xlsx": "^0.8.22",
-    "jszip": "^3.1.3",
-    "koa-is-json": "^1.0.0",
-    "lodash": "^4.17.11",
-    "lz-string": "^1.4.4",
-    "mathjs": "^5.9.0",
-    "moment": "^2.20.1",
-    "node-schedule": "^1.3.2",
-    "node-uuid": "^1.4.8",
-    "node-xlsx": "^0.12.0",
-    "number-precision": "^1.3.1",
-    "qr-image": "^3.2.0",
-    "stream-to-array": "^2.3.0",
-    "stream-wormhole": "^1.1.0",
-    "ua-parser-js": "^0.7.21",
-    "ueditor": "^1.2.3",
-    "uglify-es": "^3.3.9",
-    "uglify-js": "^3.3.27",
-    "xmlreader": "^0.2.3",
-    "zlib": "^1.0.5"
-  },
-  "devDependencies": {
-    "autod": "^2.9.0",
-    "autod-egg": "^1.1.0",
-    "egg-bin": "^4.10.0",
-    "egg-ci": "^1.8.0",
-    "egg-mock": "^3.14.0",
-    "eslint": "^4.17.0",
-    "eslint-config-egg": "^5.0.0",
-    "pdfkit": "^0.8.2",
-    "webstorm-disable-index": "^1.2.0"
-  },
-  "engines": {
-    "node": ">=6.0.0"
-  },
-  "scripts": {
-    "start": "egg-scripts start --daemon --port 7002",
-    "stop": "egg-scripts stop",
-    "start-qa": "set EGG_SERVER_ENV=qa&&egg-scripts start --daemon --port 7002",
-    "dev": "egg-bin dev --port 7002",
-    "dev-local": "set EGG_SERVER_ENV=local&&egg-bin dev --port 7002",
-    "dev-remoteqa": "set EGG_SERVER_ENV=remoteqa&&egg-bin dev --port 7002",
-    "dev-remoteuat": "set EGG_SERVER_ENV=remoteuat&&egg-bin dev --port 7002",
-    "dev-localpro": "set EGG_SERVER_ENV=localpro&&egg-bin dev --port 7002",
-    "dev-temp": "set EGG_SERVER_ENV=temp&&egg-bin dev --port 7002",
-    "dev-qa": "set EGG_SERVER_ENV=qa&&egg-bin dev --port 7002",
-    "dev-test": "set EGG_SERVER_ENV=test&&egg-bin dev --port 7002",
-    "test": "npm run lint -- --fix&&npm run test-local",
-    "test-sim": "egg-bin test",
-    "test-local": "set EGG_SERVER_ENV=local&& egg-bin test",
-    "test-qa": "set EGG_SERVER_ENV=qa&&egg-bin test",
-    "test-auto": "set EGG_SERVER_ENV=autotest&&egg-bin test",
-    "dev-docker": "egg-scripts start --port 7005",
-    "cov": "egg-bin cov",
-    "lint": "eslint .",
-    "ci": "npm run lint && npm run cov",
-    "autod": "autod",
-    "qa": "set EGG_SERVER_ENV=local&&egg-scripts start --deamon --port 7002",
-    "local": "set EGG_SERVER_ENV=local&npm run dev"
-  },
-  "ci": {
-    "version": "6, 8"
-  },
-  "repository": {
-    "type": "git",
-    "url": ""
-  },
-  "author": "olym",
-  "license": "MIT"
+    "name": "calculation",
+    "version": "1.0.0",
+    "description": "calculation paying frontend",
+    "private": true,
+    "dependencies": {
+        "@alicloud/pop-core": "^1.7.9",
+        "ali-rds": "^3.3.0",
+        "atob": "^2.1.2",
+        "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",
+        "egg-redis": "^1.0.2",
+        "egg-scripts": "^1.0.0",
+        "egg-session-redis": "^1.0.0",
+        "egg-validate": "^1.0.0",
+        "egg-view": "^1.1.2",
+        "egg-view-ejs": "^1.1.0",
+        "egg-wechat-all": "^0.1.4",
+        "gt3-sdk": "^2.0.0",
+        "gulp": "^4.0.0",
+        "js-xlsx": "^0.8.22",
+        "jszip": "^3.1.3",
+        "koa-is-json": "^1.0.0",
+        "lodash": "^4.17.11",
+        "lz-string": "^1.4.4",
+        "mathjs": "^5.9.0",
+        "moment": "^2.20.1",
+        "node-schedule": "^1.3.2",
+        "node-uuid": "^1.4.8",
+        "node-xlsx": "^0.12.0",
+        "number-precision": "^1.3.1",
+        "qr-image": "^3.2.0",
+        "stream-to-array": "^2.3.0",
+        "stream-wormhole": "^1.1.0",
+        "ua-parser-js": "^0.7.21",
+        "ueditor": "^1.2.3",
+        "uglify-es": "^3.3.9",
+        "uglify-js": "^3.3.27",
+        "xmlreader": "^0.2.3",
+        "zlib": "^1.0.5"
+    },
+    "devDependencies": {
+        "autod": "^2.9.0",
+        "autod-egg": "^1.1.0",
+        "egg-bin": "^4.10.0",
+        "egg-ci": "^1.8.0",
+        "egg-mock": "^3.14.0",
+        "eslint": "^4.17.0",
+        "eslint-config-egg": "^5.0.0",
+        "pdfkit": "^0.8.2",
+        "webstorm-disable-index": "^1.2.0"
+    },
+    "engines": {
+        "node": ">=6.0.0"
+    },
+    "scripts": {
+        "start": "egg-scripts start --daemon --port 7002",
+        "stop": "egg-scripts stop",
+        "start-qa": "set EGG_SERVER_ENV=qa&&egg-scripts start --daemon --port 7002",
+        "dev": "egg-bin dev --port 7002",
+        "dev-local": "set EGG_SERVER_ENV=local&&egg-bin dev --port 7002",
+        "dev-remoteqa": "set EGG_SERVER_ENV=remoteqa&&egg-bin dev --port 7002",
+        "dev-remoteuat": "set EGG_SERVER_ENV=remoteuat&&egg-bin dev --port 7002",
+        "dev-localpro": "set EGG_SERVER_ENV=localpro&&egg-bin dev --port 7002",
+        "dev-temp": "set EGG_SERVER_ENV=temp&&egg-bin dev --port 7002",
+        "dev-qa": "set EGG_SERVER_ENV=qa&&egg-bin dev --port 7002",
+        "dev-test": "set EGG_SERVER_ENV=test&&egg-bin dev --port 7002",
+        "test": "npm run lint -- --fix&&npm run test-local",
+        "test-sim": "egg-bin test",
+        "test-local": "set EGG_SERVER_ENV=local&& egg-bin test",
+        "test-qa": "set EGG_SERVER_ENV=qa&&egg-bin test",
+        "test-auto": "set EGG_SERVER_ENV=autotest&&egg-bin test",
+        "dev-docker": "egg-scripts start --port 7005",
+        "cov": "egg-bin cov",
+        "lint": "eslint .",
+        "ci": "npm run lint && npm run cov",
+        "autod": "autod",
+        "qa": "set EGG_SERVER_ENV=local&&egg-scripts start --deamon --port 7002",
+        "local": "set EGG_SERVER_ENV=local&npm run dev"
+    },
+    "ci": {
+        "version": "6, 8"
+    },
+    "repository": {
+        "type": "git",
+        "url": ""
+    },
+    "author": "olym",
+    "license": "MIT"
 }