public function view()
 {
     $c_id = intval($_REQUEST['c_id']);
     $ccModel = D('TaoCoupon');
     $code = $ccModel->info($c_id);
     $code or die('id invalid.');
     import('@.Com.Util.Ubb');
     $localTimeObj = LocalTime::getInstance();
     if ($code['expiry_type'] == 1) {
         $code['expiry'] = $localTimeObj->local_date($this->_CFG['date_format'], $code['expiry']);
     }
     $fetch_limit_conf = CouponCodeConf::fetch_limit_conf();
     $code['fetch_limit'] = $fetch_limit_conf[$code['data']['fetch_limit']];
     $code['data']['directions'] = Ubb::ubb2html($code['data']['directions']);
     $this->assign('code', $code);
     $this->assign('ur_href', '淘宝优惠券管理 > 优惠券详情');
     $this->display();
 }
Esempio n. 2
0
 public function show()
 {
     $c_id = intval($_REQUEST['id']);
     $c_id or die('id invalid.');
     $ccModel = D('TaoCoupon');
     $detail = $ccModel->info($c_id);
     if (!$detail || $detail['is_active'] == 0) {
         $this->error('该优惠券已下架,请选择商家其他的优惠券');
     }
     $fetch_limit_conf = CouponCodeConf::fetch_limit_conf();
     $ccmService = service('TaoShop');
     $shop = $ccmService->info($detail['s_id']);
     $localTimeObj = LocalTime::getInstance();
     $today = $localTimeObj->local_strtotime(date('Y-m-d 23:59:59'));
     if ($detail['expiry_type'] == 1) {
         $detail['expiry_timestamp'] = $detail['expiry'] + $this->_CFG['timezone'] * 3600;
         if ($detail['expiry'] - $today == 0) {
             $detail['expiry'] = 1;
         } else {
             $detail['expiry'] = $detail['expiry'] - $today > 0 ? ceil(($detail['expiry'] - $today) / (3600 * 24)) : 0;
         }
     }
     $title = '';
     if ($detail['title']) {
         $title .= $detail['title'];
     } else {
         $title .= $shop['title'];
         if ($detail['c_type'] == 1) {
             $title .= '满' . $detail['money_max'] . '减' . $detail['money_reduce'] . '元优惠券';
         } else {
             $title .= $detail['money_amount'] . '元代金券';
         }
     }
     if ($detail['data']['seo_title']) {
         $page_title = $detail['data']['seo_title'];
     } else {
         $page_title = '淘宝优惠券 - ' . $title;
     }
     $detail['title'] = $title;
     import('@.Com.Util.Ubb');
     $detail['data']['directions'] = Ubb::ubb2html($detail['data']['directions']);
     $detail['data']['fetch_limit'] = $fetch_limit_conf[$detail['data']['fetch_limit']];
     $this->assign('detail', $detail);
     $this->assign('shop', $shop);
     $nowtime = LocalTime::getInstance()->gmtime();
     $this->assign('nowtime', $nowtime);
     //其他优惠券
     $keys = array('c_id', 's_title', 'title', 'c_type', 'money_max', 'money_reduce', 'money_amount', 'expiry_type', 'expiry');
     $others = $ccModel->all4mall($detail['s_id'], $keys, $c_id);
     $this->assign('others', $others);
     $this->assign('page_title', $page_title . ' - ');
     $this->assign('page_keywords', $detail['data']['seo_keywords'] ? $detail['data']['seo_keywords'] : $this->_CFG['site_keywords']);
     $this->assign('page_description', $detail['data']['seo_desc'] ? $detail['data']['seo_desc'] : $this->_CFG['site_description']);
     $this->display();
 }
Esempio n. 3
0
 /**
  * 优惠券详情
  *
  */
 public function view()
 {
     $c_id = intval($_REQUEST['id']);
     $c_id or die('id invalid.');
     $ccModel = D('CouponCode');
     $detail = $ccModel->info($c_id);
     if (!$detail) {
         $this->error('该优惠券已下架,请选择商家其他的优惠券');
     }
     if ($detail['is_active'] == 0) {
         $this->error('该优惠券已下架,请选择商家其他的优惠券');
     }
     $ccmService = service('CouponCodeMall');
     $mall = $ccmService->info($detail['m_id']);
     $localTimeObj = LocalTime::getInstance();
     $today = $localTimeObj->local_strtotime(date('Y-m-d 23:59:59'));
     if ($detail['expiry_type'] == 1) {
         $detail['expiry_timestamp'] = $detail['expiry'] + $this->_CFG['timezone'] * 3600;
         if ($detail['expiry'] - $today == 0) {
             $detail['expiry'] = 1;
         } else {
             $detail['expiry'] = $detail['expiry'] - $today > 0 ? ceil(($detail['expiry'] - $today) / (3600 * 24)) : 0;
         }
     }
     $title = '';
     if ($detail['title']) {
         $title .= $detail['title'];
     } else {
         $title .= $mall['name'];
         if ($detail['c_type'] == 1) {
             $title .= '满' . $detail['money_max'] . '减' . $detail['money_reduce'] . '元优惠券';
         } else {
             $title .= $detail['money_amount'] . '元代金券';
         }
     }
     if ($detail['data']['seo_title']) {
         $page_title = $detail['data']['seo_title'];
     } else {
         $page_title = $title;
     }
     $detail['title'] = $title;
     $fetch_limit_conf = CouponCodeConf::fetch_limit_conf();
     $fetch_account_limit_conf = CouponCodeConf::fetch_account_limit_conf();
     $detail['fetch_limit'] = $fetch_limit_conf[$detail['data']['fetch_limit']];
     $detail['fetch_account_limit'] = $fetch_account_limit_conf[$detail['data']['fetch_account_limit']];
     import('@.Com.Util.Ubb');
     $detail['data']['directions'] = Ubb::ubb2html($detail['data']['directions']);
     $detail['data']['prompt'] = Ubb::ubb2html($detail['data']['prompt']);
     $mall['description'] = Ubb::ubb2html($mall['description']);
     $mall['how2use'] = Ubb::ubb2html($mall['how2use']);
     $this->assign('detail', $detail);
     $this->assign('mall', $mall);
     //前100位领取此优惠券的会员
     $cccModel = D('CouponCodeCodes');
     $record_top100 = $cccModel->record_top($c_id, 100);
     $record_top100 = $record_top100 ? $record_top100 : array();
     $this->assign('record_top100', $record_top100);
     $this->assign('record_top_amount', count($record_top100));
     $this->assign('nowtime', $localTimeObj->gmtime() - intval($this->_CFG['code_in_secret']) * 60 + intval($this->_CFG['timezone']) * 3600);
     $this->assign('page_title', $page_title . ' - ');
     $this->assign('page_keywords', $detail['data']['seo_keywords'] ? $detail['data']['seo_keywords'] : $this->_CFG['site_keywords']);
     $this->assign('page_description', $detail['data']['seo_desc'] ? $detail['data']['seo_desc'] : $this->_CFG['site_description']);
     $this->display();
 }