Authored by hf

do modify product detail call service to api

@@ -38,10 +38,6 @@ class DetailData @@ -38,10 +38,6 @@ class DetailData
38 $param['client_secret'] = Sign::getSign($param); 38 $param['client_secret'] = Sign::getSign($param);
39 39
40 return Yohobuy::post(Yohobuy::API_URL, $param); 40 return Yohobuy::post(Yohobuy::API_URL, $param);
41 -  
42 -// return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array(  
43 -// 'param' => intval($productId), 'userId' => intval($uid)  
44 -// ));  
45 } 41 }
46 42
47 /** 43 /**
@@ -52,7 +48,12 @@ class DetailData @@ -52,7 +48,12 @@ class DetailData
52 */ 48 */
53 public static function sizeInfo($productSkn) 49 public static function sizeInfo($productSkn)
54 { 50 {
55 - return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn))); 51 + $param = Yohobuy::param();
  52 + $param['method'] = 'h5.product.intro';
  53 + $param['productskn'] = $productSkn;
  54 + $param['client_secret'] = Sign::getSign($param);
  55 +
  56 + return Yohobuy::post(Yohobuy::API_URL, $param);
56 } 57 }
57 58
58 /** 59 /**
@@ -65,11 +66,14 @@ class DetailData @@ -65,11 +66,14 @@ class DetailData
65 */ 66 */
66 public static function consultList($productId, $pageNum, $pageSize) 67 public static function consultList($productId, $pageNum, $pageSize)
67 { 68 {
68 - return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_CONSULT_LIST, array(  
69 - 'productId' => intval($productId),  
70 - 'pageNum' => intval($pageNum),  
71 - 'pageSize' => intval($pageSize),  
72 - )); 69 + $param = Yohobuy::param();
  70 + $param['method'] = 'h5.consult.li';
  71 + $param['product_id'] = $productId;
  72 + $param['page'] = $pageNum;
  73 + $param['limit'] = $pageSize;
  74 + $param['client_secret'] = Sign::getSign($param);
  75 +
  76 + return Yohobuy::post(Yohobuy::API_URL, $param);
73 } 77 }
74 78
75 /** 79 /**
@@ -82,25 +86,22 @@ class DetailData @@ -82,25 +86,22 @@ class DetailData
82 */ 86 */
83 public static function commentList($productId, $pageNum, $pageSize) 87 public static function commentList($productId, $pageNum, $pageSize)
84 { 88 {
85 - return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_COMMENT_LIST, array(  
86 - 'productId' => intval($productId),  
87 - 'pageNum' => intval($pageNum),  
88 - 'pageSize' => intval($pageSize),  
89 - )); 89 + // 暂未提供提口
90 } 90 }
91 91
92 /** 92 /**
93 * 为你优选的商品列表 93 * 为你优选的商品列表
94 * 94 *
95 - * @todo 需要替换成JAVA接口  
96 * @param int $productSkn 商品SKN号 95 * @param int $productSkn 商品SKN号
97 * @return array 96 * @return array
98 */ 97 */
99 - public static function preference($productSkn) 98 + public static function preference($productSkn, $channel, $brandId)
100 { 99 {
101 $param = Yohobuy::param(); 100 $param = Yohobuy::param();
102 - $param['method'] = 'app.product.topreference';  
103 - $param['product_skn'] = $productSkn; 101 + $param['method'] = 'h5.preference.Search';
  102 + $param['productskn'] = $productSkn;
  103 + $param['yhchannel'] = $channel;
  104 + $param['brandId'] = $brandId;
104 $param['client_secret'] = Sign::getSign($param); 105 $param['client_secret'] = Sign::getSign($param);
105 106
106 return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 缓存1小时 107 return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 缓存1小时
@@ -116,7 +117,7 @@ class DetailData @@ -116,7 +117,7 @@ class DetailData
116 public static function addConsult($uid, $productId, $content) 117 public static function addConsult($uid, $productId, $content)
117 { 118 {
118 $param = Yohobuy::param(); 119 $param = Yohobuy::param();
119 - $param['method'] = 'app.consult.add'; 120 + $param['method'] = 'h5.consult.add';
120 $param['product_id'] = $productId; 121 $param['product_id'] = $productId;
121 $param['content'] = $content; 122 $param['content'] = $content;
122 $param['uid'] = $uid; 123 $param['uid'] = $uid;
@@ -23,7 +23,7 @@ class OrderModel @@ -23,7 +23,7 @@ class OrderModel
23 { 23 {
24 $result = array(); 24 $result = array();
25 //调用接口获得数据 25 //调用接口获得数据
26 - $data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, 7394907); 26 + $data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
27 // 判断是否还有数据, 没有数据则返回空 27 // 判断是否还有数据, 没有数据则返回空
28 if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) { 28 if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
29 return $result; 29 return $result;
@@ -146,6 +146,8 @@ class DetailModel @@ -146,6 +146,8 @@ class DetailModel
146 'storeName' => $baseInfo['brand']['brandName'], 146 'storeName' => $baseInfo['brand']['brandName'],
147 'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain']) 147 'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
148 ); 148 );
  149 + // 为你优选的链接
  150 + $result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']));
149 } 151 }
150 152
151 // 商品信息 153 // 商品信息
@@ -448,12 +450,12 @@ class DetailModel @@ -448,12 +450,12 @@ class DetailModel
448 * @param int $productSkn 商品SKN 450 * @param int $productSkn 商品SKN
449 * @return array 451 * @return array
450 */ 452 */
451 - public static function getPreference($productSkn) 453 + public static function getPreference($productSkn, $channel, $brandId)
452 { 454 {
453 $result = array(); 455 $result = array();
454 456
455 if (is_numeric($productSkn)) { 457 if (is_numeric($productSkn)) {
456 - $preference = DetailData::preference($productSkn); 458 + $preference = DetailData::preference($productSkn, $channel, $brandId);
457 if (!empty($preference['data'])) { 459 if (!empty($preference['data'])) {
458 foreach ($preference['data'] as $value) { 460 foreach ($preference['data'] as $value) {
459 $result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false); 461 $result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
@@ -182,7 +182,9 @@ class DetailController extends AbstractAction @@ -182,7 +182,9 @@ class DetailController extends AbstractAction
182 182
183 if ($this->isAjax()) { 183 if ($this->isAjax()) {
184 $productSkn = $this->get('productSkn'); // 50000058 184 $productSkn = $this->get('productSkn'); // 50000058
185 - $result = \Product\DetailModel::getPreference($productSkn); 185 + $brandId = $this->get('brandId');
  186 + $channel = Helpers::getChannelByCookie();
  187 + $result = \Product\DetailModel::getPreference($productSkn, $channel, $brandId);
186 } 188 }
187 189
188 if (empty($result)) { 190 if (empty($result)) {