Authored by 邱骏

修改appSecret

@@ -7,16 +7,15 @@ const xlsx = require('xlsx'); @@ -7,16 +7,15 @@ const xlsx = require('xlsx');
7 const mail = require('nodemailer'); 7 const mail = require('nodemailer');
8 const moment = require('moment'); 8 const moment = require('moment');
9 const smtpTransport = require('nodemailer-smtp-transport'); 9 const smtpTransport = require('nodemailer-smtp-transport');
10 -const depart_names = ['创意', '活动', '技术', '零售', '媒体', '品牌', '上游资源', '市场会员', '运维', '战略发展']; 10 +const depart_names = ['活动', '技术', '零售', '媒体', '品牌', '上游资源', '市场会员', '运维', '战略发展'];
11 const ActivityModel = require('../../admin/models/activity'); 11 const ActivityModel = require('../../admin/models/activity');
12 12
13 -let results = [[], [], [], [], [], [], [], [], [], []]; 13 +let results = [[], [], [], [], [], [], [], [], []];
14 14
15 let loadExcel = function(path) { 15 let loadExcel = function(path) {
16 let workbook = xlsx.readFile(path); 16 let workbook = xlsx.readFile(path);
17 const sheetNames = workbook.SheetNames; 17 const sheetNames = workbook.SheetNames;
18 const worksheet = workbook.Sheets[sheetNames[0]]; 18 const worksheet = workbook.Sheets[sheetNames[0]];
19 -  
20 return Promise.resolve(xlsx.utils.sheet_to_json(worksheet)); 19 return Promise.resolve(xlsx.utils.sheet_to_json(worksheet));
21 }; 20 };
22 21
@@ -76,9 +75,9 @@ const excelLoader = { @@ -76,9 +75,9 @@ const excelLoader = {
76 * @returns {Promise.<T>|*} 75 * @returns {Promise.<T>|*}
77 */ 76 */
78 excelToXml(req, res, next) { 77 excelToXml(req, res, next) {
79 - return loadExcel('public/docs/user.xlsx').then(ret => { 78 + return loadExcel('public/docs/users2019.xlsx').then(ret => {
80 _.each(ret, item => { 79 _.each(ret, item => {
81 - let depart_1 = item.depart_1; // 第一级部门 80 + let depart_1 = item.block; // 第一级部门
82 81
83 for (let i = 0; i < depart_names.length; i++) { // 按部门归入相应的数组 82 for (let i = 0; i < depart_names.length; i++) { // 按部门归入相应的数组
84 if (depart_1.indexOf(depart_names[i]) >= 0) { 83 if (depart_1.indexOf(depart_names[i]) >= 0) {
@@ -92,7 +91,8 @@ const excelLoader = { @@ -92,7 +91,8 @@ const excelLoader = {
92 '\t<data>\n'; 91 '\t<data>\n';
93 92
94 _.each(results, item_arr => { 93 _.each(results, item_arr => {
95 - let xml_dep_f = '\t\t<department depid="0" name="' + item_arr[0].depart_1 + 94 + console.log(item_arr.length);
  95 + let xml_dep_f = '\t\t<department depid="0" name="' + item_arr[0].block +
96 '" total="' + item_arr.length + '" prizes="0">\n'; 96 '" total="' + item_arr.length + '" prizes="0">\n';
97 let xml_person = ''; 97 let xml_person = '';
98 98
@@ -101,14 +101,14 @@ const excelLoader = { @@ -101,14 +101,14 @@ const excelLoader = {
101 let xml_person_e = '\t\t\t</person>\n'; 101 let xml_person_e = '\t\t\t</person>\n';
102 let depart_arr = []; 102 let depart_arr = [];
103 103
104 - if (item.depart_1) {  
105 - depart_arr.push(item.depart_1); 104 + if (item.block) {
  105 + depart_arr.push(item.block);
106 } 106 }
107 - if (item.depart_2) {  
108 - depart_arr.push(item.depart_2); 107 + if (item.center) {
  108 + depart_arr.push(item.center);
109 } 109 }
110 - if (item.depart_3) {  
111 - depart_arr.push(item.depart_3); 110 + if (item.depart) {
  111 + depart_arr.push(item.depart.replace(/\d/g, ''));
112 } 112 }
113 if (item.depart_4) { 113 if (item.depart_4) {
114 depart_arr.push(item.depart_4); 114 depart_arr.push(item.depart_4);
@@ -125,7 +125,6 @@ const excelLoader = { @@ -125,7 +125,6 @@ const excelLoader = {
125 '\t\t\t\t<level>0</level>\n'; 125 '\t\t\t\t<level>0</level>\n';
126 126
127 xml_person += xml_person_f + xml_person_content + xml_person_e; 127 xml_person += xml_person_f + xml_person_content + xml_person_e;
128 -  
129 }); 128 });
130 129
131 let xml_dep_e = '\t\t</department>\n'; 130 let xml_dep_e = '\t\t</department>\n';
@@ -140,7 +139,7 @@ const excelLoader = { @@ -140,7 +139,7 @@ const excelLoader = {
140 }, 139 },
141 getExcelData(req, res) { 140 getExcelData(req, res) {
142 console.log(req); 141 console.log(req);
143 - return loadExcel('public/docs/user.xlsx').then(ret => { 142 + return loadExcel('public/docs/users2019.xlsx').then(ret => {
144 res.json(ret); 143 res.json(ret);
145 }); 144 });
146 }, 145 },
@@ -147,7 +147,6 @@ class ActWheelSurfModelRedis extends global.yoho.BaseModel { @@ -147,7 +147,6 @@ class ActWheelSurfModelRedis extends global.yoho.BaseModel {
147 async goPrize(obj) { 147 async goPrize(obj) {
148 try { 148 try {
149 // 校验有效活动时间 149 // 校验有效活动时间
150 -  
151 // 兼容线上活动 150 // 兼容线上活动
152 if (+obj.act_id !== 44) { 151 if (+obj.act_id !== 44) {
153 try { 152 try {
@@ -27,7 +27,7 @@ router.post('/prize/getNewPrize', prize.getNewPrize); @@ -27,7 +27,7 @@ router.post('/prize/getNewPrize', prize.getNewPrize);
27 router.post('/prize/updatePrize', prize.updatePrize); 27 router.post('/prize/updatePrize', prize.updatePrize);
28 router.post('/info/saveUserInfo', prize.saveUserInfo); 28 router.post('/info/saveUserInfo', prize.saveUserInfo);
29 29
30 -// router.get('/excel/xml', excel.excelToXml); 30 +router.get('/excel/xml', excel.excelToXml);
31 // router.get('/excel/sendMail', excel.sendMail); 31 // router.get('/excel/sendMail', excel.sendMail);
32 router.get('/excel/load', excel.getExcelData); 32 router.get('/excel/load', excel.getExcelData);
33 router.get('/excel/loady100', excel.getY100Data); 33 router.get('/excel/loady100', excel.getY100Data);
@@ -608,9 +608,6 @@ const article = { @@ -608,9 +608,6 @@ const article = {
608 const voteCase = req.body.vcase || 0; 608 const voteCase = req.body.vcase || 0;
609 let vote_num = 1; 609 let vote_num = 1;
610 610
611 - console.log(actId, articleId);  
612 -  
613 -  
614 let vote = function() { 611 let vote = function() {
615 if (voteCase) { 612 if (voteCase) {
616 vote_num = 1 + Math.floor(Math.random() * 3); 613 vote_num = 1 + Math.floor(Math.random() * 3);
@@ -40,6 +40,7 @@ module.exports = { @@ -40,6 +40,7 @@ module.exports = {
40 corsAllowOrigin: [ 40 corsAllowOrigin: [
41 'http://localhost:8081', 41 'http://localhost:8081',
42 'http://localhost:8888', 42 'http://localhost:8888',
  43 + 'http://localhost:8080',
43 'http://localhost:1234', 44 'http://localhost:1234',
44 'http://localhost:63342', 45 'http://localhost:63342',
45 'http://huodong.yoho.cn', 46 'http://huodong.yoho.cn',
@@ -135,6 +136,9 @@ module.exports = { @@ -135,6 +136,9 @@ module.exports = {
135 wechatLogin: { 136 wechatLogin: {
136 appID: 'wxb785b12717bc31e9', 137 appID: 'wxb785b12717bc31e9',
137 appSecret: 'fb0bc348577b1e38576c6fe654da5135', 138 appSecret: 'fb0bc348577b1e38576c6fe654da5135',
  139 + token: 'weixin',
  140 + prefix: 'https://api.weixin.qq.com/cgi-bin/',
  141 + mpPrefix: 'https://api.weixin.qq.com/cgi-bin/',
138 } 142 }
139 }; 143 };
140 144
No preview for this file type