Authored by huangyi

领券

@@ -147,6 +147,24 @@ const couponController = { @@ -147,6 +147,24 @@ const couponController = {
147 next; 147 next;
148 } 148 }
149 }, 149 },
  150 + downloadTpl(req, res) {
  151 + let conf = {
  152 + name: 'mysheet',
  153 + cols: [
  154 + {
  155 + caption: 'couponNo',
  156 + type: 'String'
  157 + }
  158 + ],
  159 + rows: []
  160 + };
  161 + let exportFile = excelExport.execute(conf);
  162 +
  163 + res.setHeader('Content-Type', 'application/vnd.openxmlformats');
  164 + res.setHeader('Content-Disposition', 'attachment; filename=couponNoTpl.xlsx');
  165 + res.end(exportFile, 'binary');
  166 +
  167 + },
150 downloadNoList(req, res, next) { 168 downloadNoList(req, res, next) {
151 const couponId = req.query.id; 169 const couponId = req.query.id;
152 170
@@ -67,6 +67,7 @@ router.post('/api/coupon/modify', coupon.modifyCoupon); @@ -67,6 +67,7 @@ router.post('/api/coupon/modify', coupon.modifyCoupon);
67 router.post('/api/coupon/batchAddNo', mutilpartMiddleware, coupon.loadCouponNoList); 67 router.post('/api/coupon/batchAddNo', mutilpartMiddleware, coupon.loadCouponNoList);
68 router.get('/api/coupon/downloadNo', coupon.downloadNoList); 68 router.get('/api/coupon/downloadNo', coupon.downloadNoList);
69 router.get('/api/coupon/delete', coupon.deleteCoupon); 69 router.get('/api/coupon/delete', coupon.deleteCoupon);
  70 +router.get('/api/coupon/downloadTpl', coupon.downloadTpl);
70 71
71 // 用户管理[ajax] 72 // 用户管理[ajax]
72 router.post('/api/user/delete', user.deleteUser); 73 router.post('/api/user/delete', user.deleteUser);
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 <div class="x_panel"> 6 <div class="x_panel">
7 <div class="x_title"> 7 <div class="x_title">
8 <a href="/admin/coupon/option" class="btn btn-primary">创建券</a> 8 <a href="/admin/coupon/option" class="btn btn-primary">创建券</a>
  9 + <a href="/admin/api/coupon/downloadTpl" class="btn btn-primary">下载导入券码模版</a>
9 <div class="btn-group" style="vertical-align: top"> 10 <div class="btn-group" style="vertical-align: top">
10 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 11 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
11 <span id="dropdown-toggle-txt">全部 </span> <span class="caret"></span> 12 <span id="dropdown-toggle-txt">全部 </span> <span class="caret"></span>
@@ -73,9 +73,9 @@ module.exports = { @@ -73,9 +73,9 @@ module.exports = {
73 }, 73 },
74 redis: { 74 redis: {
75 connect: { 75 connect: {
76 - // host: '127.0.0.1', 76 + host: '127.0.0.1',
77 77
78 - host: '192.168.102.49', 78 + //host: '192.168.102.49',
79 port: '6379', 79 port: '6379',
80 enable_offline_queue: false, 80 enable_offline_queue: false,
81 retry_strategy(options) { 81 retry_strategy(options) {
@@ -95,10 +95,10 @@ module.exports = { @@ -95,10 +95,10 @@ module.exports = {
95 }, 95 },
96 mysql: { 96 mysql: {
97 connect: { 97 connect: {
98 - host: 'localhost', 98 + host: '0.0.0.0',
99 port: '3306', 99 port: '3306',
100 user: 'root', 100 user: 'root',
101 - password: '' 101 + password: '123456'
102 }, 102 },
103 database: 'yoho_activity_platform', 103 database: 'yoho_activity_platform',
104 }, 104 },
@@ -192,10 +192,10 @@ if (isProduction) { @@ -192,10 +192,10 @@ if (isProduction) {
192 useCache: true, 192 useCache: true,
193 mysql: { 193 mysql: {
194 connect: { 194 connect: {
195 - host: 'localhost', 195 + host: '0.0.0.0',
196 port: '3306', 196 port: '3306',
197 user: 'root', 197 user: 'root',
198 - password: '' 198 + password: '123456'
199 }, 199 },
200 database: 'yoho_activity_platform', 200 database: 'yoho_activity_platform',
201 } 201 }