...
|
...
|
@@ -11,8 +11,8 @@ use Plugin\Helpers; |
|
|
*/
|
|
|
class StarClassController extends AbstractAction
|
|
|
{
|
|
|
//定义是否APP变量
|
|
|
protected $_isApp = false;
|
|
|
|
|
|
private $_isApp = false;
|
|
|
|
|
|
/**
|
|
|
* 星潮教室首页
|
...
|
...
|
@@ -21,16 +21,30 @@ class StarClassController extends AbstractAction |
|
|
{
|
|
|
//获取uid
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$appVersion = array();
|
|
|
|
|
|
if (!$this->_isApp) {
|
|
|
//设置头部公共导航
|
|
|
$this->setNavHeader('星潮教室', true, false);
|
|
|
if ($uid) {
|
|
|
$this->setCookie('uid', $uid);
|
|
|
}else{
|
|
|
$this->setCookie('uid', '', time() - 3600);
|
|
|
}
|
|
|
}else{
|
|
|
$appVersion = array('app_version'=>1);
|
|
|
$this->setCookie('isApp',true);
|
|
|
if ($uid) {
|
|
|
$this->setCookie('uid', $uid);
|
|
|
}else{
|
|
|
$this->setCookie('uid', '', time() - 3600);
|
|
|
}
|
|
|
}
|
|
|
//设置头部公共导航
|
|
|
$isApp = $this->getCookie('isApp', false);
|
|
|
if (!$isApp) {
|
|
|
$this->setNavHeader('星潮教室', true, false);
|
|
|
}
|
|
|
|
|
|
$this->setTitle('星潮教室');
|
|
|
//调用模型获得星潮教室首页数据
|
|
|
$data = StarClassModel::getStarClass($uid, $appVersion);
|
|
|
$data = StarClassModel::getStarClass($uid);
|
|
|
//渲染模板
|
|
|
$this->_view->display('index', array(
|
|
|
'trendClassHome' => $data,
|
...
|
...
|
@@ -46,18 +60,16 @@ class StarClassController extends AbstractAction |
|
|
public function specialAction()
|
|
|
{
|
|
|
//获取uid
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$appVersion = array();
|
|
|
if (!$this->_isApp) {
|
|
|
$isApp = $this->getCookie('isApp', false);
|
|
|
|
|
|
if (!$isApp) {
|
|
|
//设置头部公共导航
|
|
|
$this->setNavHeader('星潮教室', true, false);
|
|
|
}else{
|
|
|
$appVersion = array('app_version'=>1);
|
|
|
}
|
|
|
$this->setTitle('星潮教室');
|
|
|
|
|
|
//调用模型获得星专题数据
|
|
|
$data = StarClassModel::getspecial($appVersion);
|
|
|
$data = StarClassModel::getspecial();
|
|
|
|
|
|
//渲染模板
|
|
|
$this->_view->display('subject', array(
|
...
|
...
|
@@ -73,18 +85,16 @@ class StarClassController extends AbstractAction |
|
|
public function collocationAction()
|
|
|
{
|
|
|
//获取uid
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$appVersion = array();
|
|
|
if (!$this->_isApp) {
|
|
|
$isApp = $this->getCookie('isApp', false);
|
|
|
|
|
|
if (!$isApp) {
|
|
|
//设置头部公共导航
|
|
|
$this->setNavHeader('星潮教室', true, false);
|
|
|
}else{
|
|
|
$appVersion = array('app_version'=>1);
|
|
|
}
|
|
|
$this->setTitle('星潮教室');
|
|
|
|
|
|
//调用模板获得星搭配数据
|
|
|
$data = StarClassModel::getCollocation($appVersion);
|
|
|
$data = StarClassModel::getCollocation();
|
|
|
|
|
|
//渲染模板
|
|
|
$this->_view->display('collocation', array(
|
...
|
...
|
@@ -104,8 +114,8 @@ class StarClassController extends AbstractAction |
|
|
}
|
|
|
//获得必要参数
|
|
|
$page = $this->get('page',1);
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$isApp = $this->_isApp;
|
|
|
$isApp = $this->getCookie('isApp', false);
|
|
|
$uid = $this->getCookie('uid', false);
|
|
|
|
|
|
//调取模型获得星搭配文章
|
|
|
$data = StarClassModel::ajaxCollocation($page, $uid, $isApp, $limit = 20);
|
...
|
...
|
@@ -125,23 +135,20 @@ class StarClassController extends AbstractAction |
|
|
public function topAction()
|
|
|
{
|
|
|
//获取uid
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$appVersion = array();
|
|
|
//设置头部公共导航(此处返回键调转星潮教室首页)
|
|
|
if (!$this->_isApp) {
|
|
|
$isApp = $this->getCookie('isApp', false);
|
|
|
$uid = $this->getCookie('uid', false);
|
|
|
|
|
|
if (!$isApp) {
|
|
|
//设置头部公共导航(此处返回键调转星潮教室首页)
|
|
|
$url = Helpers::url('/guang/starclass/index');
|
|
|
//设置头部公共导航
|
|
|
$this->setNavHeader('星潮粉丝榜', $url, false);
|
|
|
}else{
|
|
|
$appVersion = array('app_version'=>1);
|
|
|
$url = Helpers::url('/guang/starclass/index', $appVersion);
|
|
|
}
|
|
|
$this->setTitle('星潮粉丝榜');
|
|
|
|
|
|
//根据客户端类型,进行未登录跳转
|
|
|
if (!$uid) {
|
|
|
$refer = Helpers::url('/guang/starclass/top');
|
|
|
if (!$this->_isApp) {
|
|
|
if (!$isApp) {
|
|
|
$this->go(Helpers::url('/signin.html', array('refer' => $refer)));
|
|
|
} else {
|
|
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
...
|
...
|
@@ -171,10 +178,12 @@ class StarClassController extends AbstractAction |
|
|
}
|
|
|
|
|
|
//根据客户端类型,进行未登录跳转
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$isApp = $this->getCookie('isApp', false);
|
|
|
$uid = $this->getCookie('uid', false);
|
|
|
|
|
|
if (!$uid) {
|
|
|
$refer = Helpers::url('/guang/starclass/index');
|
|
|
if (!$this->_isApp) {
|
|
|
if (!$isApp) {
|
|
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
|
|
} else {
|
|
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
...
|
...
|
@@ -189,24 +198,6 @@ class StarClassController extends AbstractAction |
|
|
$this->echoJson($res);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 星鲜事-点赞
|
|
|
*/
|
|
|
public function setPraiseAction()
|
|
|
{
|
|
|
if(!$this->isAjax()){
|
|
|
return;
|
|
|
}
|
|
|
//获得客户端ID(点赞不需要登录)
|
|
|
$udid = $this->getUdid();
|
|
|
//获得文章ID
|
|
|
$articleId = $this->post('articleId');
|
|
|
|
|
|
//调取接口点赞
|
|
|
$result = StarClassData::setPraise($articleId, $udid);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 星搭配-文章分享
|
...
|
...
|
@@ -219,10 +210,11 @@ class StarClassController extends AbstractAction |
|
|
$result = array();
|
|
|
|
|
|
//根据客户端类型,进行未登录跳转
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$isApp = $this->getCookie('isApp', false);
|
|
|
$uid = $this->getCookie('uid', false);
|
|
|
if (!$uid) {
|
|
|
$refer = Helpers::url('/guang/starclass/collocation');
|
|
|
if (!$this->_isApp) {
|
|
|
if (!$isApp) {
|
|
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
|
|
} else {
|
|
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
...
|
...
|
@@ -247,10 +239,11 @@ class StarClassController extends AbstractAction |
|
|
}
|
|
|
|
|
|
//根据客户端类型,进行未登录跳转
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$uid = $this->getCookie('uid', false);
|
|
|
$isApp = $this->getCookie('isApp', false);
|
|
|
if (!$uid) {
|
|
|
$refer = Helpers::url('/guang/starclass/collocation');;
|
|
|
if (!$this->_isApp) {
|
|
|
if (!$isApp) {
|
|
|
$this->echoJson(array('code'=>201,'data'=>Helpers::url('/signin.html', array('refer' => $refer))));
|
|
|
} else {
|
|
|
$referEncode = strtr($refer, array('/' => '\\/'));
|
...
|
...
|
@@ -277,6 +270,25 @@ class StarClassController extends AbstractAction |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 星鲜事-点赞
|
|
|
*/
|
|
|
public function setPraiseAction()
|
|
|
{
|
|
|
if(!$this->isAjax()){
|
|
|
return;
|
|
|
}
|
|
|
//获得客户端ID(点赞不需要登录)
|
|
|
$udid = $this->getUdid();
|
|
|
//获得文章ID
|
|
|
$articleId = $this->post('articleId');
|
|
|
|
|
|
//调取接口点赞
|
|
|
$result = StarClassData::setPraise($articleId, $udid);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 检测登录状态
|
|
|
*
|
|
|
* @return int
|
...
|
...
|
@@ -289,7 +301,7 @@ class StarClassController extends AbstractAction |
|
|
if ($this->_isApp) {
|
|
|
$uid = $this->get('uid');
|
|
|
} else {
|
|
|
$uid = $this->getUid();
|
|
|
$uid = $this->getUid(true);
|
|
|
}
|
|
|
|
|
|
return $uid;
|
...
|
...
|
|