/** * 使用方法 * */ public function how2use() { $id = intval($_REQUEST['id']); $ccmService = service('CouponCodeMall'); $mall = $ccmService->info($id); $mall or die('id invliad.'); $localTimeObj = LocalTime::getInstance(); $today = $localTimeObj->local_strtotime(date('Y-m-d 23:59:59')); import('@.Com.Util.Ubb'); $mall['description'] = Ubb::ubb2html($mall['description']); $mall['how2use'] = Ubb::ubb2html($mall['how2use']); $this->assign('mall', $mall); //该商家的优惠券 $cModel = D('CouponCode'); $res = $cModel->all4mall($id); $codes = array(); foreach ($res as $rs) { if ($rs['expiry_type'] == 1) { if ($rs['expiry'] - $today == 0) { $rs['expiry'] = 1; } else { $rs['expiry'] = $rs['expiry'] - $today > 0 ? ceil(($rs['expiry'] - $today) / (3600 * 24)) : 0; } } $codes[] = $rs; } $this->assign('codes', $codes); $this->assign('page_title', $mall['name'] . '优惠券使用方法 - '); $this->assign('page_keywords', $mall['seo_keywords'] ? $mall['seo_keywords'] : $this->_CFG['site_keywords']); $this->assign('page_description', $mall['seo_desc'] ? $mall['seo_desc'] : $this->_CFG['site_description']); $this->display(); }
public function build_html() { $article_id = intval($_REQUEST['article_id']); $time = intval($_REQUEST['time']); $auth = $_REQUEST['auth']; if (time() - $time > 5 || md5($article_id . $time . C('AUTH')) != $auth) { exit; } $aModel = D('Article'); $article = $aModel->info($article_id); if ($article['alias']) { $htmlfile = $article['alias']; } else { $htmlfile = $article_id; } import('@.Com.Util.Ubb'); $article['content'] = Ubb::ubb2html($article['content']); $this->assign('article', $article); //其他文章 $other_articles = $aModel->getByCateId($article['cate_id'], array('article_id', 'title', 'alias')); $this->assign('other_articles', $other_articles); $page_title = $article['title'] . ' - '; $this->assign(array('page_title' => $page_title)); $this->buildHtml($htmlfile, HTML_PATH, 'article'); }
public function view() { $id = intval($_REQUEST['id']); $ccmModel = D('CouponCodeMall'); $mall = $ccmModel->info($id); $mall or die('id invalid'); $cccService = service('CouponCodeCategory'); import('@.Com.Util.Ubb'); $mall['how2use'] = Ubb::ubb2html($mall['how2use']); $cate = $cccService->info($mall['c_id']); $mall['cates'] = $cate['parents']; $this->assign('mall', $mall); $this->assign('ur_href', '商家管理 > 商家详情'); $this->display(); }
public function view() { $id = intval($_REQUEST['id']); $ccmModel = D('MallPromotion'); $promotion = $ccmModel->info(array(), $id); $promotion or die('id invalid'); $cccService = service('CouponCodeCategory'); $cate = $cccService->info($promotion['cate_id']); $promotion['cates'] = $cate['parents']; $promotion['expiry'] = LocalTime::getInstance()->local_date($this->_CFG['date_format'], $promotion['expiry']); import('@.Com.Util.Ubb'); $promotion['detail'] = Ubb::ubb2html($promotion['detail']); $this->assign('promotion', $promotion); $this->assign('ur_href', '促销活动管理 > 活动详情'); $this->display(); }
public function detail() { $id = intval($_REQUEST['id']); $proModel = D('MallPromotion'); $promotion = $proModel->info(array(), $id); $promotion or die('id invliad.'); import('@.Com.Util.Ubb'); $promotion['detail'] = Ubb::ubb2html($promotion['detail']); $promotion['expiry'] = LocalTime::getInstance()->local_date($this->_CFG['date_format'], $promotion['expiry']); //商家分类 $cccService = service('CouponCodeCategory'); $cates = $cccService->getTree(); $this->assign('promotion', $promotion); $this->assign('cates', $cates); $this->assign('page_title', $promotion['title'] . ' - 促销活动 - '); $this->assign('page_keywords', $this->_CFG['site_keywords']); $this->assign('page_description', $this->_CFG['site_description']); $this->display(); }
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(); }
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(); }
/** * 领取的优惠券列表 * */ public function codes() { $page = isset($_REQUEST['p']) && $_REQUEST['p'] >= 1 ? $_REQUEST['p'] : 1; $pageLimit = 10; $localTimeObj = LocalTime::getInstance(); $limit = array('begin' => ($page - 1) * $pageLimit, 'offset' => $pageLimit); import('@.Com.Util.Ubb'); $cccModel = D('CouponCodeCodes'); $res = $cccModel->myCodes($this->_user['user_id'], $limit); $codes = array(); foreach ($res['data'] as $rs) { if ($rs['expiry_type'] == 1) { $rs['expiry'] = $localTimeObj->local_date($this->_CFG['date_format'], $rs['expiry']); } $rs['fetch_time'] = $localTimeObj->local_date($this->_CFG['time_format'], $rs['fetch_time']); $rs['directions'] = Ubb::ubb2html($rs['directions']); $codes[] = $rs; } $this->assign('codes', $codes); $page_url = reUrl(MODULE_NAME . "/" . ACTION_NAME . "?p=[page]"); $page_url = str_replace('%5bpage%5d', '[page]', $page_url); $p = new Page($page, $pageLimit, $res['count'], $page_url, 5, 5); $pagelink = $p->showStyle(3); $this->assign('pagelink', $pagelink); $ccService = service('CouponCode'); //最近被领取的10个优惠券 $fetched10 = array(); $data = $ccService->fetch_latest(10); foreach ($data as $d) { $d['fetch_time'] = $localTimeObj->local_date('H:i:s', $d['fetch_time']); $fetched10[] = $d; } $this->assign('fetched10', $fetched10); //每日精选 $daybest10 = array(); $time = $localTimeObj->local_strtotime(date('Y-m-d 00:00:00')); $daybest10 = $ccService->daybest($time, 10); $this->assign('daybest10', $daybest10); $this->assign('page_title', '我领取的优惠券 - '); $this->assign('page_keywords', $this->_CFG['site_keywords']); $this->assign('page_description', $this->_CFG['site_description']); $this->display('codes'); }
/** * 优惠券详情 * */ 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(); }