Authored by 姜敏

yohosearch 接口url中文转码

@@ -29,7 +29,7 @@ var config = { @@ -29,7 +29,7 @@ var config = {
29 //domain:'http://192.168.102.216:8180/platform', //李健2 29 //domain:'http://192.168.102.216:8180/platform', //李健2
30 //domain: 'http://172.16.6.243:8088/platform', //谭玲 30 //domain: 'http://172.16.6.243:8088/platform', //谭玲
31 //domain: 'http://172.16.6.204:8088/platform', //陆斌斌 31 //domain: 'http://172.16.6.204:8088/platform', //陆斌斌
32 - yohoSearch: 'http://192.168.102.208:8087/yohosearch', 32 + yohoSearch: 'http://192.168.10.64:8080/yohosearch',
33 loggers: { 33 loggers: {
34 api: { 34 api: {
35 level: 'verbose' 35 level: 'verbose'
@@ -49,7 +49,7 @@ var config = { @@ -49,7 +49,7 @@ var config = {
49 }, 49 },
50 apiKey: 'sd4H1ecAqlp', 50 apiKey: 'sd4H1ecAqlp',
51 domain: 'http://192.168.102.202:8088/platform', 51 domain: 'http://192.168.102.202:8088/platform',
52 - yohoSearch: 'http://192.168.102.208:8087/yohosearch', 52 + yohoSearch: 'http://192.168.10.64:8080/yohosearch',
53 logsFile: '/Data/logs/node/yohobuy-portal-log/', 53 logsFile: '/Data/logs/node/yohobuy-portal-log/',
54 loggers: { 54 loggers: {
55 api: { 55 api: {
@@ -70,7 +70,7 @@ var config = { @@ -70,7 +70,7 @@ var config = {
70 }, 70 },
71 apiKey: 'sd4H1ecAqlp', 71 apiKey: 'sd4H1ecAqlp',
72 domain: 'http://192.168.102.202:8081/platform', 72 domain: 'http://192.168.102.202:8081/platform',
73 - yohoSearch: 'http://192.168.102.208:8087/yohosearch', 73 + yohoSearch: 'http://192.168.10.64:8080/yohosearch',
74 logsFile: '/Data/logs/node/yohobuy-portal-log/', 74 logsFile: '/Data/logs/node/yohobuy-portal-log/',
75 loggers: { 75 loggers: {
76 api: { 76 api: {
@@ -91,7 +91,7 @@ var config = { @@ -91,7 +91,7 @@ var config = {
91 }, 91 },
92 apiKey: 'sd4H1ecAqlp', 92 apiKey: 'sd4H1ecAqlp',
93 domain: 'http://192.168.81.6:8189/yoho-admin-portal', 93 domain: 'http://192.168.81.6:8189/yoho-admin-portal',
94 - yohoSearch: 'http://192.168.102.208:8087/yohosearch', 94 + yohoSearch: 'http://192.168.10.64:8080/yohosearch',
95 logsFile: '/Data/logs/node/yohobuy-portal-log/', 95 logsFile: '/Data/logs/node/yohobuy-portal-log/',
96 loggers: { 96 loggers: {
97 api: { 97 api: {
@@ -4,18 +4,17 @@ var fs = require('fs'); @@ -4,18 +4,17 @@ var fs = require('fs');
4 var searchDomain = require('../../config/common.js').yohoSearch; 4 var searchDomain = require('../../config/common.js').yohoSearch;
5 5
6 exports.brandlist = function (req, res) { 6 exports.brandlist = function (req, res) {
7 - request.get(searchDomain+"/brand/list.json").pipe(res); 7 + request.get(searchDomain + "/brand/list.json").pipe(res);
8 }; 8 };
9 9
10 exports.search = function (req, res) { 10 exports.search = function (req, res) {
11 var size = 10;//每页数据量 11 var size = 10;//每页数据量
12 var params = []; 12 var params = [];
13 for (var key in req.body) { 13 for (var key in req.body) {
14 - params.push(key + "=" + req.body[key]); 14 + params.push(key + "=" + encodeURI(req.body[key]));
15 } 15 }
16 - console.log("params",params);  
17 - var url = searchDomain+"/search.json?viewNum=" + size + "&"+params.join('&');  
18 - console.log("请求url",url); 16 + var url = searchDomain + "/search.json?viewNum=" + size + "&" + params.join('&');
  17 + //console.log("请求url",url);
19 request({url: url}, function (error, response, body) { 18 request({url: url}, function (error, response, body) {
20 var data = {}; 19 var data = {};
21 data.list = []; 20 data.list = [];
@@ -31,13 +30,12 @@ exports.search = function (req, res) { @@ -31,13 +30,12 @@ exports.search = function (req, res) {
31 for (var i = 0; i < goodslist.length; i++) { 30 for (var i = 0; i < goodslist.length; i++) {
32 goodslist1[i] = _.assign({}, goodslist[i].a, goodslist[i].b); 31 goodslist1[i] = _.assign({}, goodslist[i].a, goodslist[i].b);
33 } 32 }
34 - //data.list=body.data.product_list;  
35 data.list = goodslist1.concat();//显示数据 33 data.list = goodslist1.concat();//显示数据
36 data.page = body.data.page;//页码 34 data.page = body.data.page;//页码
37 data.totalPage = body.data.page_total; 35 data.totalPage = body.data.page_total;
38 data.nums = data.list.length;//记录每一页数据量 36 data.nums = data.list.length;//记录每一页数据量
39 //console.log("最终data", data); 37 //console.log("最终data", data);
40 - res.json({data: {data: data,code:200}}); 38 + res.json({data: {data: data, code: 200}});
41 }); 39 });
42 }; 40 };
43 41
@@ -155,7 +155,7 @@ @@ -155,7 +155,7 @@
155 <div class="rows"> 155 <div class="rows">
156 <div class="form-group"> 156 <div class="form-group">
157 <div class="panel-col2"> 157 <div class="panel-col2">
158 - <input class="form-control" id="skns" placeholder="输入SKN(多个skn以逗号分隔)" /> 158 + <input class="form-control" id="skns" placeholder="输入SKN(多个skn以逗号分隔)或产品名称" />
159 </div> 159 </div>
160 <div class="panel-col"> 160 <div class="panel-col">
161 <input type="number" id="beginPrice" name="begin_price" class="form-control" 161 <input type="number" id="beginPrice" name="begin_price" class="form-control"