Authored by xiaowei

我的逛

... ... @@ -310,11 +310,12 @@ class HomeController extends AbstractAction
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
$uid = $this->getUid();
$yh_channel = Helpers::getChannelByCookie();
$uid=5687179;
$gender = Helpers::getGenderByCookie();
$yh_channel = Helpers::getChannelByCookie();
$guangInfo = \home\GuangModel::getMyGuang($uid, $page,$yh_channel,$gender, $limit);
$this->_view->display('my-guang', array('myGuang'=>$guangInfo));
$this->setTitle('我收藏的');
$this->setNavHeader('我收藏的', true, '');
$this->_view->display('my-guang', array( 'myGuangPage' => true,'myGuang'=>$guangInfo,'pageFooter' => true));
}
/**
... ...
... ... @@ -13,68 +13,19 @@ class GuangModel
{
//获取我的逛列表
public static function getMyGuang($uid, $page,$yh_channel=1, $gender = '1,3', $limit = 10)
public static function getMyGuang($uid, $page, $yh_channel = 1, $gender = '1,3', $limit = 10)
{
$result = array();
//调用接口获取数据
$res = GuangData::getGuangInfo($uid, $page, $yh_channel,$gender, $limit);
$guangInfo = $res['data']['data'];
if ($guangInfo)
$res = GuangData::getGuangInfo($uid, $page, $yh_channel, $gender, $limit);
if (!empty($res['data']['data']))
{
foreach ($guangInfo as $k => $v)
foreach ($res['data']['data'] as $k => $v)
{
$result[$k]['id'] = $v['id'];
$result[$k]['author'] = $v['author'];
$tag = self::getTag(TRUE, intval($v['category_id']));
$result[$k]['url'] = $v['url'];
$result[$k]['img'] = $v['src'];
$result[$k]['title'] = $v['title'];
$result[$k]['text'] = $v['intro'];
$result[$k]['pageView'] = $v['views_num'];
$result[$k]['publish_time'] = $v['publish_time'];
$like = ($v['isPraise'] == "Y") ? true : false;
$collect = ($v['isFavor'] == "Y") ? true : false;
$result[$k]['like'] = array('isLiked' => $like, 'count' => $v['praise_num']);
$result[$k]['collect'] = array('isCollected' => $collect, 'url' => $v['url']);
$result[$k] += $tag;
$result[$k]['share'] = $v['url'];
$result[$k] = Helpers::formatArticle($v, true, false, true, $uid);
}
}
return $result;
}
//【标签】isTip-小贴士;isCollocation-搭配 isFashionMan-潮人 isFashionGood-潮品 isTopic-话题
private static function getTag($isShow, $tagId)
{
$ret['showTags'] = $isShow;
$ret['isTopic'] = false;
$ret['isCollocation'] = false;
$ret['isFashionMan'] = false;
$ret['isFashionGood'] = false;
$ret['isTip'] = false;
switch ($tagId)
{
case 1:
$ret['isTopic'] = true;
break;
case 2:
$ret['isCollocation'] = true;
break;
case 3:
$ret['isFashionMan'] = true;
break;
case 4:
$ret['isFashionGood'] = true;
break;
case 5:
$ret['isTip'] = true;
break;
default:
$ret['showTags'] = FALSE;
break;
}
return $ret;
}
}
... ...