Authored by 郝肖肖

post 是 body接收

... ... @@ -64,12 +64,10 @@ let search = (req, res, next) => {
};
let param = {
uid: req.user.uid,
channel: req.query.channel || '1'
};
indexModel.branchSearch(param).then(result => {
res.render('brand/search', Object.assign(responseData, result));
}).catch(next);
... ... @@ -83,7 +81,7 @@ let addBrandSearch = (req, res, next) => {
let uid = req.user.uid;
let brandName = req.query.brandName;
let brandName = req.body.brandName;
let timestamp = Date.parse(new Date());
... ... @@ -113,22 +111,27 @@ let delBrandHistory = (req, res, next) => {
res.json(result);
}).catch(next);
};
/**
* [品牌搜索异步数据]
*/
let searchAsync = (req, res, next) => {
let uid = req.user.uid;
if (!req.xhr) {
return next();
}
let uid = req.user.uid;
if (!uid) {
return res.json({code: 200, data: {}})
return res.json({code: 200, data: {}});
}
return indexModel.branchSearchHistoryAsync(uid).then((result) => {
return res.json({code: 200, data: { history: result }})
})
return res.json({code: 200, data: { history: result }});
});
};
}
module.exports = {
index,
search,
... ...