yohosearch.js 662 Bytes
var request = require('request');
var _ = require('lodash');
var fs = require('fs');
var searchDomain = require('../../config/common.js').yohoSearch;

exports.getJSONFile=function(req,res){
    request.get("http://192.168.10.64:8080/yohosearch/brand/list.json").pipe(res);
}

exports.search=function(req,res){
	var url="http://192.168.10.64:8080/yohosearch/search.json?viewNum=15&query=51022754,51178582";
	request({url: url}, function (error, response, body) {
		var data={};
		body=JSON.parse(body);
		data.list=body.data.product_list;
		data.totalPage=body.data.total;
		data.page=body.data.page;
		// console.log(data);
		res.json({data:{data:data}});
	});
}