ActivitiesController.php
3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
class ActivitiesController extends QLib_Controller_Default_Action {
public function init() {
$this->QLayoutLink()->appendStylesheet($this->_css('promotion'));
$this->QLayoutScript()->offsetSetFile(61, $this->_js('activities'));
$this->QLayoutTitle()->headTitle('促销活动|YOHO!有货 100%正品保证');
}
/**
* 当前执行的活动
*/
public function indexAction() {
//获取全场活动
$this->view->globalActList = QINOperations_Models_Activities_Client::getCurActivities(1);
//获取当前品牌的活动
$this->view->brandActList = QINOperations_Models_Activities_Client::getCurActivities(2);
if(!empty($this->view->brandActList)) {
//获取所有的品牌
$brandList = QINProduct_Models_Brand_Client::getAllBrand();
foreach ($this->view->brandActList as $k => $v) {
$this->view->brandActList[$k]['brand_logo'] = $brandList[$v['brand_id']]['brand_ico'];
$this->view->brandActList[$k]['brand_name'] = $brandList[$v['brand_id']]['brand_name'];
}
}
}
/**
* 过往全场活动
*/
public function oldAction(){
$count = QINOperations_Models_Activities_Client::getOldActivitiesCount(1);
$this->view->page = $page = $this->helpPaging()->setTotal($count)->setSize(10);
$this->view->actList = QINOperations_Models_Activities_Client::getOldActivitiesList(1, $page->getOffset(), $page->getSize());
}
/**
* 过往品牌活动
*/
public function brandoldAction() {
$count = QINOperations_Models_Activities_Client::getOldActivitiesCount(2);
$this->view->page = $page = $this->helpPaging()->setTotal($count)->setSize(10);
$this->view->actList = QINOperations_Models_Activities_Client::getOldActivitiesList(2, $page->getOffset(), $page->getSize());
if(!empty($this->view->actList)) {
$brandList = QINProduct_Models_Brand_Client::getAllBrand();
foreach ($this->view->actList as $k => $v) {
$this->view->actList[$k]['brand_logo'] = $brandList[$v['brand_id']]['brand_ico'];
$this->view->actList[$k]['brand_name'] = $brandList[$v['brand_id']]['brand_name'];
}
}
}
/**
* 加载活动资讯
*/
public function actinfoAction() {
$this->_helper->layout()->disableLayout();
$total = QINOperations_Models_Activities_Info_Client::getCountInfo();
$this->view->page = $page = $this->helpPaging('buymini')->setFJs('QActivities.getInfos')->setTotal($total)->setSize(8);
$this->view->infoList = QINOperations_Models_Activities_Info_Client::getInfoList($page);
//print_r($this->view->infoList);exit;
}
public function detailAction() {
$id = $this->helpGparam('id');
$this->view->detail = $detail = QINOperations_Models_Activities_Info_Client::getInfoById($id);
}
/**
* 推荐商品
*/
public function recommendproductAction() {
$this->_helper->layout()->disableLayout();
$size = 6;
$getUserParams = $this->getRequest()->getParams();
$userParams['isrecommend'] = 1;
$userParams['ishot'] = 1;
$paging = $this->helpPaging('yohomini')->setSize($size);
$parans = array();
$result = QModels_Search_Source_Client::getSourceIds($getUserParams, $paging->getNewCurrent(), $size, $parans);
$total = $result['total'];
$this->view->paging = $paging->setFJs('QRecommend.recommend')->setTotal($total);
$this->view->productData = $productData = QModels_Product_Client::getProductAllByIds($result['ids']);
}
}