Authored by 郭成尧

变换仓库代码迁移

... ... @@ -159,6 +159,23 @@ class CouponFloorProcess
}
/**
* 焦点图
*
* @param $data
* @return mixed
*/
public static function focus($data)
{
$result = array();
$result['isFocus'] = true;
foreach ($data as &$item) {
$item['img'] = Images::getImageUrl($item['src'], 0, 0);
}
$result['list'] = $data;
return $result;
}
/**
*
* 辅助方法 Debug 数据输出
*
... ...
... ... @@ -22,7 +22,7 @@ class CouponController extends AbstractAction
public function floorAction()
{
if(!$this->isApp()){
if (!$this->isApp()) {
$this->setNavHeader('领券中心', true, SITE_MAIN);
}
$receiveData = filter_input_array(INPUT_GET, array(
... ... @@ -30,9 +30,9 @@ class CouponController extends AbstractAction
));
$result = array();
$uid = '';
if($this->isApp()){
if ($this->isApp()) {
$uid = $this->get('uid');
}else{
} else {
$uid = $this->getUid();
}
$resource = CouponData::getCouponRousource($receiveData['code'], $uid);
... ... @@ -60,7 +60,17 @@ class CouponController extends AbstractAction
// 跳转 URl
$playUrl = Helpers::url('/coupon/floor');
// 判断用户是否登录
if ((!$this->getUid() || !is_numeric($this->getUid())) || (!$this->get('uid') || !is_numeric($this->get('uid')))) {
$isLogin = false;
if ($this->isApp()) {
if ($this->get('uid') && is_numeric($this->get('uid'))) {
$isLogin = true;
}
} else {
if ($this->getUid() && is_numeric($this->getUid())) {
$isLogin = true;
}
}
if (!$isLogin) {
// 用户未登录,跳转登录页面
$returnData['noLogin'] = true;
if (!$this->isApp()) {
... ... @@ -97,7 +107,31 @@ class CouponController extends AbstractAction
*/
public function isApp()
{
return (null !== $this->get('app_version'));
$userAgent = $this->getUserAgent();
if (stristr($userAgent, 'ipad')) {
return false;
}
$mobileAgents = array('iphone', 'android', "240x320", "acer", "acoon", "acs-", "abacho", "ahong", "airness", "alcatel", "amoi", "anywhereyougo.com", "applewebkit/525", "applewebkit/532", "asus", "audio", "au-mic", "avantogo", "becker", "benq", "bilbo", "bird", "blackberry", "blazer", "bleu", "cdm-", "compal", "coolpad", "danger", "dbtel", "dopod", "elaine", "eric", "etouch", "fly ", "fly_", "fly-", "go.web", "goodaccess", "gradiente", "grundig", "haier", "hedy", "hitachi", "htc", "huawei", "hutchison", "inno", "ipad", "ipaq", "ipod", "jbrowser", "kddi", "kgt", "kwc", "lenovo", "lg ", "lg2", "lg3", "lg4", "lg5", "lg7", "lg8", "lg9", "lg-", "lge-", "lge9", "longcos", "maemo", "mercator", "meridian", "micromax", "midp", "mini", "mitsu", "mmm", "mmp", "mobi", "mot-", "moto", "nec-", "netfront", "newgen", "nexian", "nf-browser", "nintendo", "nitro", "nokia", "nook", "novarra", "obigo", "palm", "panasonic", "pantech", "philips", "phone", "pg-", "playstation", "pocket", "pt-", "qc-", "qtek", "rover", "sagem", "sama", "samu", "sanyo", "samsung", "sch-", "scooter", "sec-", "sendo", "sgh-", "sharp", "siemens", "sie-", "softbank", "sony", "spice", "sprint", "spv", "symbian", "tablet", "talkabout", "tcl-", "teleca", "telit", "tianyu", "tim-", "toshiba", "tsm", "up.browser", "utec", "utstar", "verykool", "virgin", "vk-", "voda", "voxtel", "vx", "wap", "wellco", "wig browser", "wii", "windows ce", "wireless", "xda", "xde", "zte");
$isMobile = false;
foreach ($mobileAgents as $device) {
if (stristr($userAgent, $device)) {
$isMobile = true;
break;
}
}
return $isMobile;
}
/**
* 获取用户User-Agent
* @return bool
*/
public function getUserAgent()
{
if (!isset($_SERVER['HTTP_USER_AGENT']) || empty($_SERVER['HTTP_USER_AGENT'])) {
return '';
}
return $_SERVER['HTTP_USER_AGENT'];
}
}
\ No newline at end of file
... ...