Authored by weiqingting

提交

... ... @@ -14,10 +14,11 @@ exports.search = function (req, res) {
params.push(key + "=" + encodeURI(req.body[key]));
}
var url = searchDomain + "/search.json?viewNum=" + size + "&" + params.join('&');
console.log(url);
request({url: url}, function (error, response, body) {
request({url: url}, function (error, httpResponse, body) {
var data = {};
data.list = [];
if (!error && httpResponse.statusCode == 200) {
try{
body = JSON.parse(body);
var dataList = body.data.product_list;
var goodslist = [];
... ... @@ -40,6 +41,12 @@ exports.search = function (req, res) {
data.nums = data.list.length;//记录每一页数据量
//console.log("最终data", data);
res.json({data: {data: data, code: 200}});
}catch(ex){
res.json({data: {data: data, code: 500}});
}
}else{
res.json({data: {data: data, code: 500}});
}
});
};
... ...