Authored by Rock Zhang

添加根据手机系统判定限定商品打开app链接的功能

Code Review By Rock Zhang
... ... @@ -335,7 +335,7 @@ class DetailModel
self::procShowStatus($result, $showStatus, $isBeginSale);
$result['cartInfo']['limitProductCode'] = $baseInfo['limitProductCode'];
$result['cartInfo']['limitCodeUrl'] = 'yohobuy://' . Helpers::url('/product', array('skn' => $baseInfo['erpProductId']));
$result['cartInfo']['limitCodeUrl'] = self::getLimitCodeUrl($baseInfo['erpProductId']);
}
// 是否收藏
... ... @@ -897,4 +897,22 @@ class DetailModel
}
}
/**
* 根据设备类型获得限购商品跳转app的url
*
* @param string $skn 商品skn
* @return string 限购商品跳转url
*/
private static function getLimitCodeUrl($skn)
{
$url = 'yohoapp://yoho.app/openwith?product_skn=' . $skn;
// 苹果设备或者苹果IPAD
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
$url = 'yohobuy://' . Helpers::url('/product', array('skn' => $skn));
}
return $url;
}
}
... ...