StarClassData.php
4.29 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2016-4-12
* Time: 13:21
*/
namespace LibModels\Wap\Guang;
use Api\Sign;
use Api\Yohobuy;
/**
* Class StarClassData
* 星潮教室相关接口
* @package LibModels\Wap\Guang
*/
class StarClassData
{
/**
* 用户当前亲密度,排名
* @param $uid
* @return string
*/
public static function rankInfoDataUrl($uid = 0)
{
$param = Yohobuy::param();
$param['uid'] = $uid;
$param['method'] = 'app.starClass.rankInfo';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
}
/**
* 获取资源位数据(url)
* @param string $contentCode 内容位置码
* @return array 首页频道数据
*/
public static function getResourceDataUrl($contentCode)
{
$param = Yohobuy::param();
$param['content_code'] = $contentCode;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
}
/**
* 获取资源位数据
* @param string $contentCode 内容位置码
* @return array 首页频道数据
*/
public static function getResourceData($contentCode)
{
$param = Yohobuy::param();
$param['content_code'] = $contentCode;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
}
/**
* 星潮教室-签到
* @param $uid
* @return mixed
*/
public static function sign($uid = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.starClass.sign';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 星潮教室-星搭配文章
* @param $page
* @param $uid
* @param $limit
* @return mixed
*/
public static function collocationData($page, $uid, $limit)
{
$param = Yohobuy::param();
$param['page'] = $page;
$param['limit'] = $limit;
$param['uid'] = $uid ? $uid : 0;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'guang/api/v5/article/getStarClassroomArticleList', $param);
}
/**
* 点赞
* @param $articleId
* @param $udid
* @return mixed
*/
public static function setPraise($articleId, $udid)
{
$param = Yohobuy::param();
$param['articleId'] = $articleId;
$param['udid'] = $udid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'guang/api/v5/praise/setPraise', $param);
}
/**
* 分享星搭配文章获得亲密度
* @param $uid
* @return mixed
*/
public static function forward($uid = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.starClass.forward';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 收藏资讯文章
* @param $articleId
* @param $uid
* @param $type
* @return mixed
*/
public static function setFavorite($articleId, $uid, $type)
{
//根据type判断调取收藏or取消收藏接口
if (!empty($type) && $type == 'fav') {
$url = 'guang/api/v1/favorite/setFavorite';
}elseif($type == 'del'){
$url = 'guang/api/v1/favorite/cancelFavorite';
}
$param = Yohobuy::param();
$param['article_id'] = $articleId;
$param['uid'] = $uid ? $uid : 0;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . $url, $param);
}
/**
* 排名前100
* @param $uid
* @return mixed
*/
public static function topData($uid = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.starClass.top100';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}