Guang.php
2.44 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
<?php
namespace Home;
use LibModels\Wap\Home\GuangData;
use Action\AbstractAction;
use Plugin\Helpers;
/**
* 我的逛数据处理
*/
class GuangModel
{
//获取我的逛列表
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)
{
foreach ($guangInfo 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'];
}
}
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;
}
}