StarClass.php
3.02 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
use Action\AbstractAction;
use Guang\StarClassModel;
use LibModels\Wap\Guang\StarClassData;
/**
* 星潮教室
*/
class StarClassController extends AbstractAction
{
/**
* 星潮教室首页
*/
public function indexAction()
{
$this->setNavHeader('星潮教室', true, false);
//获取uid
$uid = $this->getUid();
$data = StarClassModel::getStarClass($uid);
$this->_view->display('index', array(
'trendClassHome' => $data,
'trendClassHomePage' => true
)
);
}
//星潮教室-星专题
public function specialAction()
{
$this->setNavHeader('星潮教室', true, false);
$data = StarClassModel::getspecial();
$this->_view->display('subject', array(
'trendClassSubject' => $data
));
}
//星潮教室-星搭配
public function collocationAction()
{
$this->setNavHeader('星潮教室', true, false);
$data = StarClassModel::getCollocation();
$this->_view->display('collocation', array(
'trendClassCollocation' => $data,
'trendClassCollocationPage' => true
));
}
//星潮教室-星搭配文章请求
public function ajaxCollocationAction()
{
if (!$this->isAjax()) {
return;
}
$page = $this->get('page',1);
$data = StarClassModel::ajaxCollocation($page);
if (isset($data) && !empty($data)) {
$this->_view->display('collocation-list',$data);
}else{
echo ' ';
}
}
//签到
public function signAction()
{
if(!$this->isAjax()){
return;
}
$uid = $this->getUid();
if ($uid) {
$res = StarClassModel::sign($uid);
$this->echoJson($res);
}else{
$this->echoJson(array('code'=>201, 'message'=>'未登录'));
}
}
//点赞
public function setPraiseAction()
{
if(!$this->isAjax()){
return;
}
$udid = $this->getUdid();
$articleId = $this->post('articleId');
$result = StarClassData::setPraise($articleId, $udid);
$this->echoJson($result);
}
//转发
public function forwardAction()
{
if(!$this->isAjax()){
return;
}
//未登录跳转登录页
$this->auditJumpLogin();
$uid = $this->getUid();
}
//收藏资讯文章
public function setFavoriteAction()
{
if (!$this->isAjax()) {
return;
}
$uid = $this->getUid();
$articleId = $this->post('articleId','3');
$type = $this->post('type');
if (!$uid || !isset($articleId) || !isset($type)) {
$this->echoJson(array('code'=>400,'message'=>'参数错误!'));
}
$result = array();
$result = StarClassData::setFavorite($articleId, $uid, $type);
if (!empty($result)) {
$this->echoJson($result);
}
}
}