cheny 4 gadi atpakaļ
vecāks
revīzija
f19e7d4900
2 mainītis faili ar 6 papildinājumiem un 1 dzēšanām
  1. 1 0
      app/controller/product.js
  2. 5 1
      app/service/product.js

+ 1 - 0
app/controller/product.js

@@ -30,6 +30,7 @@ class ProductController extends Controller {
   // 导出测试
   async exportexcel(){
     const data = await this.service.exportexcel(this.ctx.request.body);
+    this.ctx.ok({ data });
   }
 }
 

+ 5 - 1
app/service/product.js

@@ -147,8 +147,12 @@ class ProductService extends CrudService {
           'sheet1': Object.assign({}, output, { '!ref': ref })
       }
   };
+  const nowDate = new Date().getTime()
+  const path = 'D:\\wwwroot\\service\\service-file\\upload\\platform\\' + nowDate + '.xlsx'
+  const respath = 'http://free.liaoningdoupo.com:80/files/platform/'+ nowDate + '.xlsx'
   // 导出 Excel
-  XLSX.writeFile(wb, 'D:/'+new Date().getTime()+'.xlsx');
+  XLSX.writeFile(wb, path);
+  return respath
   }
 }