1
|
-<?php
|
1
|
+<?php
|
|
|
2
|
+
|
2
|
use Action\WebAction;
|
3
|
use Action\WebAction;
|
3
|
use LibModels\Web\Product\FavoriteData;
|
4
|
use LibModels\Web\Product\FavoriteData;
|
4
|
use Product\BrandsModel;
|
5
|
use Product\BrandsModel;
|
5
|
-
|
|
|
6
|
use product\HotrankModel;
|
6
|
use product\HotrankModel;
|
7
|
|
7
|
|
8
|
class IndexController extends WebAction
|
8
|
class IndexController extends WebAction
|
9
|
{
|
9
|
{
|
|
|
10
|
+
|
10
|
/**
|
11
|
/**
|
11
|
- * 品牌首页
|
|
|
12
|
- */
|
12
|
+ * 品牌首页
|
|
|
13
|
+ */
|
13
|
public function brandAction()
|
14
|
public function brandAction()
|
14
|
{
|
15
|
{
|
15
|
//品牌域名,没有获取到品牌域名的跳转首页
|
16
|
//品牌域名,没有获取到品牌域名的跳转首页
|
16
|
$domain = $this->param('named');
|
17
|
$domain = $this->param('named');
|
17
|
if (empty($domain)) {
|
18
|
if (empty($domain)) {
|
18
|
$this->go(SITE_MAIN);
|
19
|
$this->go(SITE_MAIN);
|
19
|
- }
|
20
|
+ }
|
20
|
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
|
21
|
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
|
21
|
$type = 1;
|
22
|
$type = 1;
|
22
|
$result = BrandsModel::getBrandByDomain($domain, $type);
|
23
|
$result = BrandsModel::getBrandByDomain($domain, $type);
|
23
|
if (!$result) {
|
24
|
if (!$result) {
|
24
|
$this->go(SITE_MAIN);
|
25
|
$this->go(SITE_MAIN);
|
25
|
}
|
26
|
}
|
26
|
-
|
27
|
+
|
27
|
//获取uid
|
28
|
//获取uid
|
28
|
$uid = $this->getUid();
|
29
|
$uid = $this->getUid();
|
29
|
-
|
30
|
+
|
30
|
//传品牌ID参数
|
31
|
//传品牌ID参数
|
31
|
$condition = array();
|
32
|
$condition = array();
|
32
|
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
|
33
|
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
|
33
|
-
|
34
|
+
|
34
|
//品牌系列参数
|
35
|
//品牌系列参数
|
35
|
$condition['folder_id'] = $this->get('folder_id');
|
36
|
$condition['folder_id'] = $this->get('folder_id');
|
36
|
-
|
37
|
+
|
37
|
//$options参数数组
|
38
|
//$options参数数组
|
38
|
$options = array();
|
39
|
$options = array();
|
39
|
$options['brandName'] = $domain;
|
40
|
$options['brandName'] = $domain;
|
|
@@ -46,10 +47,10 @@ class IndexController extends WebAction |
|
@@ -46,10 +47,10 @@ class IndexController extends WebAction |
46
|
$options['reviewNum'] = 6;
|
47
|
$options['reviewNum'] = 6;
|
47
|
$options['controller'] = 'Index';
|
48
|
$options['controller'] = 'Index';
|
48
|
$options['action'] = 'brand';
|
49
|
$options['action'] = 'brand';
|
49
|
-
|
50
|
+
|
50
|
//调用模型获得数据
|
51
|
//调用模型获得数据
|
51
|
$data = BrandsModel::getBrandSearchData($condition, $options);
|
52
|
$data = BrandsModel::getBrandSearchData($condition, $options);
|
52
|
-
|
53
|
+
|
53
|
$data = array(
|
54
|
$data = array(
|
54
|
//初始化js
|
55
|
//初始化js
|
55
|
'searchListPage' => true,
|
56
|
'searchListPage' => true,
|
|
@@ -60,9 +61,9 @@ class IndexController extends WebAction |
|
@@ -60,9 +61,9 @@ class IndexController extends WebAction |
60
|
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
|
61
|
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
|
61
|
$this->setWebNavHeader();
|
62
|
$this->setWebNavHeader();
|
62
|
//渲染模板
|
63
|
//渲染模板
|
63
|
- $this->_view->display('list',$data);
|
64
|
+ $this->_view->display('list', $data);
|
64
|
}
|
65
|
}
|
65
|
-
|
66
|
+
|
66
|
//品牌介绍页
|
67
|
//品牌介绍页
|
67
|
public function aboutAction()
|
68
|
public function aboutAction()
|
68
|
{
|
69
|
{
|
|
@@ -70,21 +71,21 @@ class IndexController extends WebAction |
|
@@ -70,21 +71,21 @@ class IndexController extends WebAction |
70
|
$domain = $this->param('named');
|
71
|
$domain = $this->param('named');
|
71
|
if (empty($domain)) {
|
72
|
if (empty($domain)) {
|
72
|
$this->go(SITE_MAIN);
|
73
|
$this->go(SITE_MAIN);
|
73
|
- }
|
74
|
+ }
|
74
|
$uid = $this->getUid();
|
75
|
$uid = $this->getUid();
|
75
|
-
|
|
|
76
|
-
|
76
|
+
|
|
|
77
|
+
|
77
|
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页TODO
|
78
|
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页TODO
|
78
|
$type = 2;
|
79
|
$type = 2;
|
79
|
$result = BrandsModel::getBrandByDomain($domain, $type);
|
80
|
$result = BrandsModel::getBrandByDomain($domain, $type);
|
80
|
if (!$result) {
|
81
|
if (!$result) {
|
81
|
$this->go(SITE_MAIN);
|
82
|
$this->go(SITE_MAIN);
|
82
|
}
|
83
|
}
|
83
|
-
|
84
|
+
|
84
|
//品牌ID参数
|
85
|
//品牌ID参数
|
85
|
$condition = array();
|
86
|
$condition = array();
|
86
|
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
|
87
|
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
|
87
|
-
|
88
|
+
|
88
|
//$options参数数组
|
89
|
//$options参数数组
|
89
|
$options = array();
|
90
|
$options = array();
|
90
|
$options['brandName'] = $domain;
|
91
|
$options['brandName'] = $domain;
|
|
@@ -96,18 +97,18 @@ class IndexController extends WebAction |
|
@@ -96,18 +97,18 @@ class IndexController extends WebAction |
96
|
$options['action'] = 'brand';
|
97
|
$options['action'] = 'brand';
|
97
|
//调用模型获得数据
|
98
|
//调用模型获得数据
|
98
|
$data = BrandsModel::getBrandIntro($condition, $options);
|
99
|
$data = BrandsModel::getBrandIntro($condition, $options);
|
99
|
-
|
100
|
+
|
100
|
$data = array(
|
101
|
$data = array(
|
101
|
//初始化js
|
102
|
//初始化js
|
102
|
'searchListPage' => true,
|
103
|
'searchListPage' => true,
|
103
|
'list' => $data
|
104
|
'list' => $data
|
104
|
);
|
105
|
);
|
105
|
-
|
106
|
+
|
106
|
$this->setWebNavHeader();
|
107
|
$this->setWebNavHeader();
|
107
|
//渲染模板
|
108
|
//渲染模板
|
108
|
- $this->_view->display('list',$data);
|
109
|
+ $this->_view->display('list', $data);
|
109
|
}
|
110
|
}
|
110
|
-
|
111
|
+
|
111
|
//收藏品牌
|
112
|
//收藏品牌
|
112
|
public function favoriteBrandAction()
|
113
|
public function favoriteBrandAction()
|
113
|
{
|
114
|
{
|
|
@@ -117,15 +118,15 @@ class IndexController extends WebAction |
|
@@ -117,15 +118,15 @@ class IndexController extends WebAction |
117
|
$result = array(
|
118
|
$result = array(
|
118
|
'code' => 400,
|
119
|
'code' => 400,
|
119
|
'message' => 'operation failed'
|
120
|
'message' => 'operation failed'
|
120
|
- );
|
121
|
+ );
|
121
|
$uid = $this->getUid();
|
122
|
$uid = $this->getUid();
|
122
|
$brandId = $this->post('brandId');
|
123
|
$brandId = $this->post('brandId');
|
123
|
- do{
|
124
|
+ do {
|
124
|
if (!$uid) {
|
125
|
if (!$uid) {
|
125
|
$result = array(
|
126
|
$result = array(
|
126
|
'code' => 403,
|
127
|
'code' => 403,
|
127
|
'message' => 'uid is null'
|
128
|
'message' => 'uid is null'
|
128
|
- );
|
129
|
+ );
|
129
|
break;
|
130
|
break;
|
130
|
}
|
131
|
}
|
131
|
if ($uid && $brandId) {
|
132
|
if ($uid && $brandId) {
|
|
@@ -133,46 +134,49 @@ class IndexController extends WebAction |
|
@@ -133,46 +134,49 @@ class IndexController extends WebAction |
133
|
$result = FavoriteData::changeFavoriteBrand($uid, $brandId);
|
134
|
$result = FavoriteData::changeFavoriteBrand($uid, $brandId);
|
134
|
break;
|
135
|
break;
|
135
|
}
|
136
|
}
|
136
|
- }while(false);
|
|
|
137
|
-
|
137
|
+ }
|
|
|
138
|
+ while (false);
|
|
|
139
|
+
|
138
|
$this->echoJson($result);
|
140
|
$this->echoJson($result);
|
139
|
}
|
141
|
}
|
140
|
-
|
|
|
141
|
- /**
|
142
|
+
|
|
|
143
|
+ /**
|
142
|
* 热销排行
|
144
|
* 热销排行
|
143
|
*/
|
145
|
*/
|
144
|
- public function hotrankAction()
|
146
|
+ public function hotrankAction()
|
145
|
{
|
147
|
{
|
146
|
//获取频道
|
148
|
//获取频道
|
147
|
$channel = HotrankModel::getChannelResource();
|
149
|
$channel = HotrankModel::getChannelResource();
|
148
|
$this->setWebNavHeader($channel['channel']);
|
150
|
$this->setWebNavHeader($channel['channel']);
|
149
|
- $page = $this->get('page',1);
|
|
|
150
|
- $sort = $this->get('sid',1);
|
|
|
151
|
- $data = array( 'hotrankPage' => true,
|
|
|
152
|
- 'footerTop'=> true,
|
|
|
153
|
- 'hotrank' => HotrankModel::getHotrankResource($channel, $sort, $page)
|
|
|
154
|
- );
|
|
|
155
|
- $this->_view->display('hotrank', $data);
|
151
|
+ $page = $this->get('page', 1);
|
|
|
152
|
+ $sort = $this->get('sid', 1);
|
|
|
153
|
+ $data = array('hotrankPage' => true,
|
|
|
154
|
+ 'footerTop' => true,
|
|
|
155
|
+ 'hotrank' => HotrankModel::getHotrankResource($channel, $sort, $page)
|
|
|
156
|
+ );
|
|
|
157
|
+
|
|
|
158
|
+ $this->_view->display('hotrank', $data);
|
156
|
}
|
159
|
}
|
157
|
-
|
160
|
+
|
158
|
/*
|
161
|
/*
|
159
|
* 一周热卖加载更多
|
162
|
* 一周热卖加载更多
|
160
|
*/
|
163
|
*/
|
|
|
164
|
+
|
161
|
public function getdataAction()
|
165
|
public function getdataAction()
|
162
|
{
|
166
|
{
|
163
|
- $page = $this->get('page',1);
|
167
|
+ $page = $this->get('page', 1);
|
164
|
//加载到100个以后停止
|
168
|
//加载到100个以后停止
|
165
|
- if($page > 2)
|
|
|
166
|
- {
|
|
|
167
|
- echo json_encode(array('code'=>201,'data'=>''));
|
169
|
+ if ($page > 2) {
|
|
|
170
|
+ echo json_encode(array('code' => 201, 'data' => ''));
|
168
|
exit;
|
171
|
exit;
|
169
|
}
|
172
|
}
|
170
|
- $sid = $this->get('sid',1);
|
173
|
+ $sid = $this->get('sid', 1);
|
171
|
//获取频道资源
|
174
|
//获取频道资源
|
172
|
$channel = HotrankModel::getChannelResource();
|
175
|
$channel = HotrankModel::getChannelResource();
|
173
|
//获取一周热卖资源
|
176
|
//获取一周热卖资源
|
174
|
- $data = HotrankModel::getListData($channel, $sid, $page);
|
177
|
+ $data = HotrankModel::getListData($channel, $sid, $page);
|
175
|
echo json_encode($data);
|
178
|
echo json_encode($data);
|
176
|
- exit;
|
179
|
+ exit;
|
177
|
}
|
180
|
}
|
178
|
-} |
|
|
|
|
181
|
+
|
|
|
182
|
+} |