Authored by 郝肖肖

post 是 body接收

@@ -64,12 +64,10 @@ let search = (req, res, next) => { @@ -64,12 +64,10 @@ let search = (req, res, next) => {
64 }; 64 };
65 65
66 let param = { 66 let param = {
67 -  
68 uid: req.user.uid, 67 uid: req.user.uid,
69 -  
70 channel: req.query.channel || '1' 68 channel: req.query.channel || '1'
71 -  
72 }; 69 };
  70 +
73 indexModel.branchSearch(param).then(result => { 71 indexModel.branchSearch(param).then(result => {
74 res.render('brand/search', Object.assign(responseData, result)); 72 res.render('brand/search', Object.assign(responseData, result));
75 }).catch(next); 73 }).catch(next);
@@ -83,7 +81,7 @@ let addBrandSearch = (req, res, next) => { @@ -83,7 +81,7 @@ let addBrandSearch = (req, res, next) => {
83 81
84 let uid = req.user.uid; 82 let uid = req.user.uid;
85 83
86 - let brandName = req.query.brandName; 84 + let brandName = req.body.brandName;
87 85
88 let timestamp = Date.parse(new Date()); 86 let timestamp = Date.parse(new Date());
89 87
@@ -113,22 +111,27 @@ let delBrandHistory = (req, res, next) => { @@ -113,22 +111,27 @@ let delBrandHistory = (req, res, next) => {
113 res.json(result); 111 res.json(result);
114 }).catch(next); 112 }).catch(next);
115 }; 113 };
  114 +
116 /** 115 /**
117 * [品牌搜索异步数据] 116 * [品牌搜索异步数据]
118 */ 117 */
119 let searchAsync = (req, res, next) => { 118 let searchAsync = (req, res, next) => {
  119 +
  120 + let uid = req.user.uid;
  121 +
120 if (!req.xhr) { 122 if (!req.xhr) {
121 return next(); 123 return next();
122 } 124 }
123 - let uid = req.user.uid; 125 +
124 if (!uid) { 126 if (!uid) {
125 - return res.json({code: 200, data: {}}) 127 + return res.json({code: 200, data: {}});
126 } 128 }
  129 +
127 return indexModel.branchSearchHistoryAsync(uid).then((result) => { 130 return indexModel.branchSearchHistoryAsync(uid).then((result) => {
128 - return res.json({code: 200, data: { history: result }})  
129 - }) 131 + return res.json({code: 200, data: { history: result }});
  132 + });
  133 +};
130 134
131 -}  
132 module.exports = { 135 module.exports = {
133 index, 136 index,
134 search, 137 search,