Authored by xiaowei

我的逛

@@ -310,11 +310,12 @@ class HomeController extends AbstractAction @@ -310,11 +310,12 @@ class HomeController extends AbstractAction
310 $page = $this->get('page', 1); 310 $page = $this->get('page', 1);
311 $limit = $this->get('limit', 10); 311 $limit = $this->get('limit', 10);
312 $uid = $this->getUid(); 312 $uid = $this->getUid();
313 - $yh_channel = Helpers::getChannelByCookie();  
314 - $uid=5687179;  
315 $gender = Helpers::getGenderByCookie(); 313 $gender = Helpers::getGenderByCookie();
  314 + $yh_channel = Helpers::getChannelByCookie();
316 $guangInfo = \home\GuangModel::getMyGuang($uid, $page,$yh_channel,$gender, $limit); 315 $guangInfo = \home\GuangModel::getMyGuang($uid, $page,$yh_channel,$gender, $limit);
317 - $this->_view->display('my-guang', array('myGuang'=>$guangInfo)); 316 + $this->setTitle('我收藏的');
  317 + $this->setNavHeader('我收藏的', true, '');
  318 + $this->_view->display('my-guang', array( 'myGuangPage' => true,'myGuang'=>$guangInfo,'pageFooter' => true));
318 } 319 }
319 320
320 /** 321 /**
@@ -13,68 +13,19 @@ class GuangModel @@ -13,68 +13,19 @@ class GuangModel
13 { 13 {
14 14
15 //获取我的逛列表 15 //获取我的逛列表
16 - public static function getMyGuang($uid, $page,$yh_channel=1, $gender = '1,3', $limit = 10) 16 + public static function getMyGuang($uid, $page, $yh_channel = 1, $gender = '1,3', $limit = 10)
17 { 17 {
18 $result = array(); 18 $result = array();
19 //调用接口获取数据 19 //调用接口获取数据
20 - $res = GuangData::getGuangInfo($uid, $page, $yh_channel,$gender, $limit);  
21 - $guangInfo = $res['data']['data'];  
22 - if ($guangInfo) 20 + $res = GuangData::getGuangInfo($uid, $page, $yh_channel, $gender, $limit);
  21 + if (!empty($res['data']['data']))
23 { 22 {
24 - foreach ($guangInfo as $k => $v) 23 + foreach ($res['data']['data'] as $k => $v)
25 { 24 {
26 - $result[$k]['id'] = $v['id'];  
27 - $result[$k]['author'] = $v['author'];  
28 - $tag = self::getTag(TRUE, intval($v['category_id']));  
29 - $result[$k]['url'] = $v['url'];  
30 - $result[$k]['img'] = $v['src'];  
31 - $result[$k]['title'] = $v['title'];  
32 - $result[$k]['text'] = $v['intro'];  
33 - $result[$k]['pageView'] = $v['views_num'];  
34 - $result[$k]['publish_time'] = $v['publish_time'];  
35 - $like = ($v['isPraise'] == "Y") ? true : false;  
36 - $collect = ($v['isFavor'] == "Y") ? true : false;  
37 - $result[$k]['like'] = array('isLiked' => $like, 'count' => $v['praise_num']);  
38 - $result[$k]['collect'] = array('isCollected' => $collect, 'url' => $v['url']);  
39 - $result[$k] += $tag;  
40 - $result[$k]['share'] = $v['url']; 25 + $result[$k] = Helpers::formatArticle($v, true, false, true, $uid);
41 } 26 }
42 } 27 }
43 -  
44 return $result; 28 return $result;
45 } 29 }
46 30
47 - //【标签】isTip-小贴士;isCollocation-搭配 isFashionMan-潮人 isFashionGood-潮品 isTopic-话题  
48 - private static function getTag($isShow, $tagId)  
49 - {  
50 - $ret['showTags'] = $isShow;  
51 - $ret['isTopic'] = false;  
52 - $ret['isCollocation'] = false;  
53 - $ret['isFashionMan'] = false;  
54 - $ret['isFashionGood'] = false;  
55 - $ret['isTip'] = false;  
56 - switch ($tagId)  
57 - {  
58 - case 1:  
59 - $ret['isTopic'] = true;  
60 - break;  
61 - case 2:  
62 - $ret['isCollocation'] = true;  
63 - break;  
64 - case 3:  
65 - $ret['isFashionMan'] = true;  
66 - break;  
67 - case 4:  
68 - $ret['isFashionGood'] = true;  
69 - break;  
70 - case 5:  
71 - $ret['isTip'] = true;  
72 - break;  
73 - default:  
74 - $ret['showTags'] = FALSE;  
75 - break;  
76 - }  
77 - return $ret;  
78 - }  
79 -  
80 } 31 }