|
@@ -11,8 +11,8 @@ use Plugin\Helpers; |
|
@@ -11,8 +11,8 @@ use Plugin\Helpers; |
11
|
*/
|
11
|
*/
|
12
|
class StarClassController extends AbstractAction
|
12
|
class StarClassController extends AbstractAction
|
13
|
{
|
13
|
{
|
14
|
- //定义是否APP变量
|
|
|
15
|
- protected $_isApp = false;
|
14
|
+
|
|
|
15
|
+ private $_isApp = false;
|
16
|
|
16
|
|
17
|
/**
|
17
|
/**
|
18
|
* 星潮教室首页
|
18
|
* 星潮教室首页
|
|
@@ -20,17 +20,31 @@ class StarClassController extends AbstractAction |
|
@@ -20,17 +20,31 @@ class StarClassController extends AbstractAction |
20
|
public function indexAction()
|
20
|
public function indexAction()
|
21
|
{
|
21
|
{
|
22
|
//获取uid
|
22
|
//获取uid
|
23
|
- $uid = self::getLoggedUid();
|
|
|
24
|
- $appVersion = array();
|
23
|
+ $uid = $this->getLoggedUid();
|
|
|
24
|
+
|
25
|
if (!$this->_isApp) {
|
25
|
if (!$this->_isApp) {
|
|
|
26
|
+ if ($uid) {
|
|
|
27
|
+ $this->setCookie('uid', $uid);
|
|
|
28
|
+ }else{
|
|
|
29
|
+ $this->setCookie('uid', '', time() - 3600);
|
|
|
30
|
+ }
|
|
|
31
|
+ }else{
|
|
|
32
|
+ $this->setCookie('isApp',true);
|
|
|
33
|
+ if ($uid) {
|
|
|
34
|
+ $this->setCookie('uid', $uid);
|
|
|
35
|
+ }else{
|
|
|
36
|
+ $this->setCookie('uid', '', time() - 3600);
|
|
|
37
|
+ }
|
|
|
38
|
+ }
|
26
|
//设置头部公共导航
|
39
|
//设置头部公共导航
|
|
|
40
|
+ $isApp = $this->getCookie('isApp', false);
|
|
|
41
|
+ if (!$isApp) {
|
27
|
$this->setNavHeader('星潮教室', true, false);
|
42
|
$this->setNavHeader('星潮教室', true, false);
|
28
|
- }else{
|
|
|
29
|
- $appVersion = array('app_version'=>1);
|
|
|
30
|
}
|
43
|
}
|
|
|
44
|
+
|
31
|
$this->setTitle('星潮教室');
|
45
|
$this->setTitle('星潮教室');
|
32
|
//调用模型获得星潮教室首页数据
|
46
|
//调用模型获得星潮教室首页数据
|
33
|
- $data = StarClassModel::getStarClass($uid, $appVersion);
|
47
|
+ $data = StarClassModel::getStarClass($uid);
|
34
|
//渲染模板
|
48
|
//渲染模板
|
35
|
$this->_view->display('index', array(
|
49
|
$this->_view->display('index', array(
|
36
|
'trendClassHome' => $data,
|
50
|
'trendClassHome' => $data,
|
|
@@ -46,18 +60,16 @@ class StarClassController extends AbstractAction |
|
@@ -46,18 +60,16 @@ class StarClassController extends AbstractAction |
46
|
public function specialAction()
|
60
|
public function specialAction()
|
47
|
{
|
61
|
{
|
48
|
//获取uid
|
62
|
//获取uid
|
49
|
- $uid = self::getLoggedUid();
|
|
|
50
|
- $appVersion = array();
|
|
|
51
|
- if (!$this->_isApp) {
|
63
|
+ $isApp = $this->getCookie('isApp', false);
|
|
|
64
|
+
|
|
|
65
|
+ if (!$isApp) {
|
52
|
//设置头部公共导航
|
66
|
//设置头部公共导航
|
53
|
$this->setNavHeader('星潮教室', true, false);
|
67
|
$this->setNavHeader('星潮教室', true, false);
|
54
|
- }else{
|
|
|
55
|
- $appVersion = array('app_version'=>1);
|
|
|
56
|
}
|
68
|
}
|
57
|
$this->setTitle('星潮教室');
|
69
|
$this->setTitle('星潮教室');
|
58
|
|
70
|
|
59
|
//调用模型获得星专题数据
|
71
|
//调用模型获得星专题数据
|
60
|
- $data = StarClassModel::getspecial($appVersion);
|
72
|
+ $data = StarClassModel::getspecial();
|
61
|
|
73
|
|
62
|
//渲染模板
|
74
|
//渲染模板
|
63
|
$this->_view->display('subject', array(
|
75
|
$this->_view->display('subject', array(
|
|
@@ -73,18 +85,16 @@ class StarClassController extends AbstractAction |
|
@@ -73,18 +85,16 @@ class StarClassController extends AbstractAction |
73
|
public function collocationAction()
|
85
|
public function collocationAction()
|
74
|
{
|
86
|
{
|
75
|
//获取uid
|
87
|
//获取uid
|
76
|
- $uid = self::getLoggedUid();
|
|
|
77
|
- $appVersion = array();
|
|
|
78
|
- if (!$this->_isApp) {
|
88
|
+ $isApp = $this->getCookie('isApp', false);
|
|
|
89
|
+
|
|
|
90
|
+ if (!$isApp) {
|
79
|
//设置头部公共导航
|
91
|
//设置头部公共导航
|
80
|
$this->setNavHeader('星潮教室', true, false);
|
92
|
$this->setNavHeader('星潮教室', true, false);
|
81
|
- }else{
|
|
|
82
|
- $appVersion = array('app_version'=>1);
|
|
|
83
|
}
|
93
|
}
|
84
|
$this->setTitle('星潮教室');
|
94
|
$this->setTitle('星潮教室');
|
85
|
|
95
|
|
86
|
//调用模板获得星搭配数据
|
96
|
//调用模板获得星搭配数据
|
87
|
- $data = StarClassModel::getCollocation($appVersion);
|
97
|
+ $data = StarClassModel::getCollocation();
|
88
|
|
98
|
|
89
|
//渲染模板
|
99
|
//渲染模板
|
90
|
$this->_view->display('collocation', array(
|
100
|
$this->_view->display('collocation', array(
|
|
@@ -104,8 +114,8 @@ class StarClassController extends AbstractAction |
|
@@ -104,8 +114,8 @@ class StarClassController extends AbstractAction |
104
|
}
|
114
|
}
|
105
|
//获得必要参数
|
115
|
//获得必要参数
|
106
|
$page = $this->get('page',1);
|
116
|
$page = $this->get('page',1);
|
107
|
- $uid = $this->getLoggedUid();
|
|
|
108
|
- $isApp = $this->_isApp;
|
117
|
+ $isApp = $this->getCookie('isApp', false);
|
|
|
118
|
+ $uid = $this->getCookie('uid', false);
|
109
|
|
119
|
|
110
|
//调取模型获得星搭配文章
|
120
|
//调取模型获得星搭配文章
|
111
|
$data = StarClassModel::ajaxCollocation($page, $uid, $isApp, $limit = 20);
|
121
|
$data = StarClassModel::ajaxCollocation($page, $uid, $isApp, $limit = 20);
|
|
@@ -125,23 +135,20 @@ class StarClassController extends AbstractAction |
|
@@ -125,23 +135,20 @@ class StarClassController extends AbstractAction |
125
|
public function topAction()
|
135
|
public function topAction()
|
126
|
{
|
136
|
{
|
127
|
//获取uid
|
137
|
//获取uid
|
128
|
- $uid = self::getLoggedUid();
|
|
|
129
|
- $appVersion = array();
|
138
|
+ $isApp = $this->getCookie('isApp', false);
|
|
|
139
|
+ $uid = $this->getCookie('uid', false);
|
|
|
140
|
+
|
|
|
141
|
+ if (!$isApp) {
|
130
|
//设置头部公共导航(此处返回键调转星潮教室首页)
|
142
|
//设置头部公共导航(此处返回键调转星潮教室首页)
|
131
|
- if (!$this->_isApp) {
|
|
|
132
|
$url = Helpers::url('/guang/starclass/index');
|
143
|
$url = Helpers::url('/guang/starclass/index');
|
133
|
- //设置头部公共导航
|
|
|
134
|
$this->setNavHeader('星潮粉丝榜', $url, false);
|
144
|
$this->setNavHeader('星潮粉丝榜', $url, false);
|
135
|
- }else{
|
|
|
136
|
- $appVersion = array('app_version'=>1);
|
|
|
137
|
- $url = Helpers::url('/guang/starclass/index', $appVersion);
|
|
|
138
|
}
|
145
|
}
|
139
|
$this->setTitle('星潮粉丝榜');
|
146
|
$this->setTitle('星潮粉丝榜');
|
140
|
|
147
|
|
141
|
//根据客户端类型,进行未登录跳转
|
148
|
//根据客户端类型,进行未登录跳转
|
142
|
if (!$uid) {
|
149
|
if (!$uid) {
|
143
|
$refer = Helpers::url('/guang/starclass/top');
|
150
|
$refer = Helpers::url('/guang/starclass/top');
|
144
|
- if (!$this->_isApp) {
|
151
|
+ if (!$isApp) {
|
145
|
$this->go(Helpers::url('/signin.html', array('refer' => $refer)));
|
152
|
$this->go(Helpers::url('/signin.html', array('refer' => $refer)));
|
146
|
} else {
|
153
|
} else {
|
147
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
154
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
|
@@ -171,10 +178,12 @@ class StarClassController extends AbstractAction |
|
@@ -171,10 +178,12 @@ class StarClassController extends AbstractAction |
171
|
}
|
178
|
}
|
172
|
|
179
|
|
173
|
//根据客户端类型,进行未登录跳转
|
180
|
//根据客户端类型,进行未登录跳转
|
174
|
- $uid = $this->getLoggedUid();
|
181
|
+ $isApp = $this->getCookie('isApp', false);
|
|
|
182
|
+ $uid = $this->getCookie('uid', false);
|
|
|
183
|
+
|
175
|
if (!$uid) {
|
184
|
if (!$uid) {
|
176
|
$refer = Helpers::url('/guang/starclass/index');
|
185
|
$refer = Helpers::url('/guang/starclass/index');
|
177
|
- if (!$this->_isApp) {
|
186
|
+ if (!$isApp) {
|
178
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
187
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
179
|
} else {
|
188
|
} else {
|
180
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
189
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
|
@@ -189,24 +198,6 @@ class StarClassController extends AbstractAction |
|
@@ -189,24 +198,6 @@ class StarClassController extends AbstractAction |
189
|
$this->echoJson($res);
|
198
|
$this->echoJson($res);
|
190
|
}
|
199
|
}
|
191
|
|
200
|
|
192
|
- /**
|
|
|
193
|
- * 星鲜事-点赞
|
|
|
194
|
- */
|
|
|
195
|
- public function setPraiseAction()
|
|
|
196
|
- {
|
|
|
197
|
- if(!$this->isAjax()){
|
|
|
198
|
- return;
|
|
|
199
|
- }
|
|
|
200
|
- //获得客户端ID(点赞不需要登录)
|
|
|
201
|
- $udid = $this->getUdid();
|
|
|
202
|
- //获得文章ID
|
|
|
203
|
- $articleId = $this->post('articleId');
|
|
|
204
|
-
|
|
|
205
|
- //调取接口点赞
|
|
|
206
|
- $result = StarClassData::setPraise($articleId, $udid);
|
|
|
207
|
-
|
|
|
208
|
- $this->echoJson($result);
|
|
|
209
|
- }
|
|
|
210
|
|
201
|
|
211
|
/**
|
202
|
/**
|
212
|
* 星搭配-文章分享
|
203
|
* 星搭配-文章分享
|
|
@@ -219,10 +210,11 @@ class StarClassController extends AbstractAction |
|
@@ -219,10 +210,11 @@ class StarClassController extends AbstractAction |
219
|
$result = array();
|
210
|
$result = array();
|
220
|
|
211
|
|
221
|
//根据客户端类型,进行未登录跳转
|
212
|
//根据客户端类型,进行未登录跳转
|
222
|
- $uid = $this->getLoggedUid();
|
213
|
+ $isApp = $this->getCookie('isApp', false);
|
|
|
214
|
+ $uid = $this->getCookie('uid', false);
|
223
|
if (!$uid) {
|
215
|
if (!$uid) {
|
224
|
$refer = Helpers::url('/guang/starclass/collocation');
|
216
|
$refer = Helpers::url('/guang/starclass/collocation');
|
225
|
- if (!$this->_isApp) {
|
217
|
+ if (!$isApp) {
|
226
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
218
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
227
|
} else {
|
219
|
} else {
|
228
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
220
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
|
@@ -247,10 +239,11 @@ class StarClassController extends AbstractAction |
|
@@ -247,10 +239,11 @@ class StarClassController extends AbstractAction |
247
|
}
|
239
|
}
|
248
|
|
240
|
|
249
|
//根据客户端类型,进行未登录跳转
|
241
|
//根据客户端类型,进行未登录跳转
|
250
|
- $uid = $this->getLoggedUid();
|
242
|
+ $uid = $this->getCookie('uid', false);
|
|
|
243
|
+ $isApp = $this->getCookie('isApp', false);
|
251
|
if (!$uid) {
|
244
|
if (!$uid) {
|
252
|
$refer = Helpers::url('/guang/starclass/collocation');;
|
245
|
$refer = Helpers::url('/guang/starclass/collocation');;
|
253
|
- if (!$this->_isApp) {
|
246
|
+ if (!$isApp) {
|
254
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
247
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
255
|
} else {
|
248
|
} else {
|
256
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
249
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
|
@@ -277,6 +270,25 @@ class StarClassController extends AbstractAction |
|
@@ -277,6 +270,25 @@ class StarClassController extends AbstractAction |
277
|
}
|
270
|
}
|
278
|
|
271
|
|
279
|
/**
|
272
|
/**
|
|
|
273
|
+ * 星鲜事-点赞
|
|
|
274
|
+ */
|
|
|
275
|
+ public function setPraiseAction()
|
|
|
276
|
+ {
|
|
|
277
|
+ if(!$this->isAjax()){
|
|
|
278
|
+ return;
|
|
|
279
|
+ }
|
|
|
280
|
+ //获得客户端ID(点赞不需要登录)
|
|
|
281
|
+ $udid = $this->getUdid();
|
|
|
282
|
+ //获得文章ID
|
|
|
283
|
+ $articleId = $this->post('articleId');
|
|
|
284
|
+
|
|
|
285
|
+ //调取接口点赞
|
|
|
286
|
+ $result = StarClassData::setPraise($articleId, $udid);
|
|
|
287
|
+
|
|
|
288
|
+ $this->echoJson($result);
|
|
|
289
|
+ }
|
|
|
290
|
+
|
|
|
291
|
+ /**
|
280
|
* 检测登录状态
|
292
|
* 检测登录状态
|
281
|
*
|
293
|
*
|
282
|
* @return int
|
294
|
* @return int
|
|
@@ -289,7 +301,7 @@ class StarClassController extends AbstractAction |
|
@@ -289,7 +301,7 @@ class StarClassController extends AbstractAction |
289
|
if ($this->_isApp) {
|
301
|
if ($this->_isApp) {
|
290
|
$uid = $this->get('uid');
|
302
|
$uid = $this->get('uid');
|
291
|
} else {
|
303
|
} else {
|
292
|
- $uid = $this->getUid();
|
304
|
+ $uid = $this->getUid(true);
|
293
|
}
|
305
|
}
|
294
|
|
306
|
|
295
|
return $uid;
|
307
|
return $uid;
|