...
|
...
|
@@ -14,6 +14,8 @@ use Api\Yohobuy; |
|
|
class CouponData
|
|
|
{
|
|
|
|
|
|
const API_URL = 'http://api.open.yohobuy.com/';
|
|
|
|
|
|
/**
|
|
|
* 获取领券楼层数据
|
|
|
*
|
...
|
...
|
@@ -23,14 +25,14 @@ class CouponData |
|
|
*/
|
|
|
public static function getCouponRousource($contentCode, $uid)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param = self::param();
|
|
|
$param['method'] = 'app.promotion.queryCouponCenter';
|
|
|
$param['contentCode'] = $contentCode;
|
|
|
if (!empty($uid) && $uid !== '' && $uid !== null) {
|
|
|
$param['uid'] = $uid;
|
|
|
}
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
return Yohobuy::get(self::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -46,6 +48,47 @@ class CouponData |
|
|
$param['couponId'] = $couponId;
|
|
|
$param['uid'] = $uid;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
return Yohobuy::get(self::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得公共的参数
|
|
|
*
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function param()
|
|
|
{
|
|
|
$clientType = self::clientType();
|
|
|
$param = array(
|
|
|
'app_version' => '3.8.2',
|
|
|
'client_type' => $clientType,
|
|
|
'os_version' => 'yohobuy:h5',
|
|
|
'private_key' => Yohobuy::$privateKeyList[$clientType],
|
|
|
'screen_size' => '720x1280',
|
|
|
'v' => '7',
|
|
|
);
|
|
|
return $param;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取得当前的客户端类型
|
|
|
*/
|
|
|
public static function clientType()
|
|
|
{
|
|
|
// 苹果设备
|
|
|
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
|
|
|
return 'iphone';
|
|
|
}
|
|
|
// 苹果IPAD
|
|
|
elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
|
|
|
return 'ipad';
|
|
|
}
|
|
|
elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'android')) {
|
|
|
return 'android';
|
|
|
}
|
|
|
// 其它
|
|
|
else {
|
|
|
return 'web';
|
|
|
}
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|