Authored by 刘传洋

search bug

@@ -7,6 +7,10 @@ @@ -7,6 +7,10 @@
7 const api = global.yoho.API; 7 const api = global.yoho.API;
8 const favApi = global.yoho.FavAPI; 8 const favApi = global.yoho.FavAPI;
9 9
  10 +const _ = require('lodash');
  11 +
  12 +const favoriteApi = require('./favorite-api');
  13 +
10 const isFavoriteAsync = (uid, pid) => { 14 const isFavoriteAsync = (uid, pid) => {
11 let onNewApi = false; 15 let onNewApi = false;
12 16
@@ -27,23 +31,8 @@ const isFavoriteAsync = (uid, pid) => { @@ -27,23 +31,8 @@ const isFavoriteAsync = (uid, pid) => {
27 } 31 }
28 }; 32 };
29 33
30 -const createAsync = (uid, pid) => {  
31 - return api.get('', {  
32 - method: 'app.favorite.add',  
33 - id: pid,  
34 - uid: uid,  
35 - type: 'product'  
36 - });  
37 -};  
38 -  
39 -const deleteAsync = (uid, pid) => {  
40 - return api.get('', {  
41 - method: 'app.favorite.cancel',  
42 - fav_id: pid,  
43 - uid: uid,  
44 - type: 'product'  
45 - });  
46 -}; 34 +const createAsync = _.partial(favoriteApi.addFavAsync, _, _, 'product');
  35 +const deleteAsync = _.partial(favoriteApi.cancelFavAsync, _, _, 'product');
47 36
48 module.exports = { 37 module.exports = {
49 isFavoriteAsync, 38 isFavoriteAsync,
@@ -4,6 +4,6 @@ @@ -4,6 +4,6 @@
4 4
5 'use strict'; 5 'use strict';
6 6
7 -const favoriteProductAPI = require('./favorite-api'); 7 +const favoriteProductAPI = require('./favorite-product-api');
8 8
9 module.exports = favoriteProductAPI; 9 module.exports = favoriteProductAPI;
@@ -37,7 +37,18 @@ const getProductList = (params) => { @@ -37,7 +37,18 @@ const getProductList = (params) => {
37 limit: 60 37 limit: 60
38 }; 38 };
39 39
40 - Object.assign(finalParams, params); 40 + let nparams = {};
  41 +
  42 + if(params && params.price) {
  43 + let mp = params.price.split(',');
  44 + let nmp = [];
  45 +
  46 + nmp[0] = (mp && mp[0]) || 0;
  47 + nmp[1] = (mp && mp[1]) || 99999;
  48 + nparams.price = nmp.join(',');
  49 + }
  50 +
  51 + Object.assign(finalParams, params, nparams);
41 return yohoApi.get('', finalParams); 52 return yohoApi.get('', finalParams);
42 }; 53 };
43 54
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 "uuid": "^2.0.2", 59 "uuid": "^2.0.2",
60 "winston": "^2.2.0", 60 "winston": "^2.2.0",
61 "winston-daily-rotate-file": "^1.1.4", 61 "winston-daily-rotate-file": "^1.1.4",
62 - "yoho-node-lib": "0.0.47" 62 + "yoho-node-lib": "0.0.49"
63 }, 63 },
64 "devDependencies": { 64 "devDependencies": {
65 "autoprefixer": "^6.3.6", 65 "autoprefixer": "^6.3.6",
@@ -778,4 +778,4 @@ function actionAddKeyWords() { @@ -778,4 +778,4 @@ function actionAddKeyWords() {
778 } 778 }
779 779
780 actionCover(); 780 actionCover();
781 -actionAddKeyWords(); 781 +actionAddKeyWords();