Showing
3 changed files
with
18 additions
and
2 deletions
@@ -609,4 +609,20 @@ class SearchData | @@ -609,4 +609,20 @@ class SearchData | ||
609 | 609 | ||
610 | return Yohobuy::get(API_URL, $param); | 610 | return Yohobuy::get(API_URL, $param); |
611 | } | 611 | } |
612 | + | ||
613 | + public static function webSearchByCondition(array $condition, $isOnlyUrl = false) { | ||
614 | + $result = array(); | ||
615 | + if(!empty($condition)) { | ||
616 | + $param = Yohobuy::param(); | ||
617 | + $param['method'] = 'web.search.search'; | ||
618 | + $param += $condition; | ||
619 | + $param['client_secret'] = Sign::getSign($param); | ||
620 | + | ||
621 | + if($isOnlyUrl) { | ||
622 | + return Yohobuy::httpBuildQuery(API_URL, $param); | ||
623 | + } | ||
624 | + $result = Yohobuy::get(API_URL, $param); | ||
625 | + } | ||
626 | + return $result; | ||
627 | + } | ||
612 | } | 628 | } |
@@ -229,7 +229,7 @@ class InfoModel | @@ -229,7 +229,7 @@ class InfoModel | ||
229 | $arr[$val['id']]=$val['src']; | 229 | $arr[$val['id']]=$val['src']; |
230 | } | 230 | } |
231 | if (!empty($productSkn)) { | 231 | if (!empty($productSkn)) { |
232 | - $product = SearchData::searchElasticByCondition(array('query'=> implode(',', $productSkn))); | 232 | + $product = SearchData::webSearchByCondition(array('query'=> implode(',', $productSkn), 'viewNum' => 100)); |
233 | if (isset($product['data']['product_list'])) { | 233 | if (isset($product['data']['product_list'])) { |
234 | $result = self::formatProduct($product['data']['product_list'], $arr); | 234 | $result = self::formatProduct($product['data']['product_list'], $arr); |
235 | } | 235 | } |
@@ -66,7 +66,7 @@ class IndexModel | @@ -66,7 +66,7 @@ class IndexModel | ||
66 | //新品上架 | 66 | //新品上架 |
67 | $productParam['new'] = 'Y'; | 67 | $productParam['new'] = 'Y'; |
68 | $productParam['viewNum'] = 10; | 68 | $productParam['viewNum'] = 10; |
69 | - $url['new'] = SearchData::getProductUrl($productParam); | 69 | + $url['new'] = SearchData::webSearchByCondition($productParam, true); |
70 | //调用接口数据 | 70 | //调用接口数据 |
71 | $data = Yohobuy::getMulti($url); | 71 | $data = Yohobuy::getMulti($url); |
72 | //格式化数据 | 72 | //格式化数据 |
-
Please register or login to post a comment