Authored by hf

do modify product detail call service to api

... ... @@ -38,10 +38,6 @@ class DetailData
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
// return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array(
// 'param' => intval($productId), 'userId' => intval($uid)
// ));
}
/**
... ... @@ -52,7 +48,12 @@ class DetailData
*/
public static function sizeInfo($productSkn)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn)));
$param = Yohobuy::param();
$param['method'] = 'h5.product.intro';
$param['productskn'] = $productSkn;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
... ... @@ -65,11 +66,14 @@ class DetailData
*/
public static function consultList($productId, $pageNum, $pageSize)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_CONSULT_LIST, array(
'productId' => intval($productId),
'pageNum' => intval($pageNum),
'pageSize' => intval($pageSize),
));
$param = Yohobuy::param();
$param['method'] = 'h5.consult.li';
$param['product_id'] = $productId;
$param['page'] = $pageNum;
$param['limit'] = $pageSize;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
... ... @@ -82,25 +86,22 @@ class DetailData
*/
public static function commentList($productId, $pageNum, $pageSize)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_COMMENT_LIST, array(
'productId' => intval($productId),
'pageNum' => intval($pageNum),
'pageSize' => intval($pageSize),
));
// 暂未提供提口
}
/**
* 为你优选的商品列表
*
* @todo 需要替换成JAVA接口
* @param int $productSkn 商品SKN号
* @return array
*/
public static function preference($productSkn)
public static function preference($productSkn, $channel, $brandId)
{
$param = Yohobuy::param();
$param['method'] = 'app.product.topreference';
$param['product_skn'] = $productSkn;
$param['method'] = 'h5.preference.Search';
$param['productskn'] = $productSkn;
$param['yhchannel'] = $channel;
$param['brandId'] = $brandId;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 缓存1小时
... ... @@ -116,7 +117,7 @@ class DetailData
public static function addConsult($uid, $productId, $content)
{
$param = Yohobuy::param();
$param['method'] = 'app.consult.add';
$param['method'] = 'h5.consult.add';
$param['product_id'] = $productId;
$param['content'] = $content;
$param['uid'] = $uid;
... ...
... ... @@ -23,7 +23,7 @@ class OrderModel
{
$result = array();
//调用接口获得数据
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, 7394907);
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
// 判断是否还有数据, 没有数据则返回空
if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
return $result;
... ...
... ... @@ -146,6 +146,8 @@ class DetailModel
'storeName' => $baseInfo['brand']['brandName'],
'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
);
// 为你优选的链接
$result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']));
}
// 商品信息
... ... @@ -448,12 +450,12 @@ class DetailModel
* @param int $productSkn 商品SKN
* @return array
*/
public static function getPreference($productSkn)
public static function getPreference($productSkn, $channel, $brandId)
{
$result = array();
if (is_numeric($productSkn)) {
$preference = DetailData::preference($productSkn);
$preference = DetailData::preference($productSkn, $channel, $brandId);
if (!empty($preference['data'])) {
foreach ($preference['data'] as $value) {
$result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
... ...
... ... @@ -182,7 +182,9 @@ class DetailController extends AbstractAction
if ($this->isAjax()) {
$productSkn = $this->get('productSkn'); // 50000058
$result = \Product\DetailModel::getPreference($productSkn);
$brandId = $this->get('brandId');
$channel = Helpers::getChannelByCookie();
$result = \Product\DetailModel::getPreference($productSkn, $channel, $brandId);
}
if (empty($result)) {
... ...