IndexData.php
5.16 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
170
171
172
173
<?php
namespace LibModels\Web\Home;
use Api\Yohobuy;
use Api\Sign;
class IndexData
{
//分类服务
const URL_OPERATIONS_CATEGORY = 'operations/service/v1/category';
//资源位地址
const URL_OPERATIONS_RESOURCE_GET = 'operations/api/v5/resource/get';
/**
* 获取导航数据
*
* @param int $status (default)
* @param string $fields (default)
* @return array
*/
public static function getNavData($status = 1, $fields = 'id,sort_name,sort_name_en,parent_id,sort_url,sort_ico,content_code,is_new,is_hot,separative_sign')
{
$params = array(
'parent_id' => '',
'platform' => 'web',
'status' => $status,
'fields' => $fields
);
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_CATEGORY, 'getCategory', $params);
}
/**
* 获取资源数据
*
* @param string $content_code
* @param string $client_type
* @return array
*/
public static function getResourceData($content_code, $client_type = 'web')
{
// 构建必传参数
$params = Yohobuy::param();
$params['content_code'] = $content_code;
$params['client_type'] = $client_type;
$params['private_key'] = Yohobuy::$privateKeyList[$client_type];
$params['client_secret'] = Sign::getSign($params);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_RESOURCE_GET, $params, false, false, 2);
}
/**
* 邮箱订阅
*
* @param string $email
* @param string $uid
* @return array
*/
public static function emailSubscriber($email, $uid = 0)
{
//TODO 走老接口
// 构建必传参数
$param = Yohobuy::param();
$param['page'] = 1;
$param['open_key'] = '12345';
$param['method'] = 'open.subscriber.subscriber';
$param['email'] = $email;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
unset($param['app_version']);
unset($param['client_type']);
unset($param['os_version']);
unset($param['screen_size']);
unset($param['v']);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
* 意见反馈
*
* @param int $feedback_id
* @param int $question_id
* @param string $answer
* @param int $solution
* @return array
*/
public static function suggestFeedback($feedback_id, $question_id, $answer, $solution)
{
//TODO 走老接口
$param = Yohobuy::param();
$param['page'] = 1;
$param['open_key'] = '12345';
$param['method'] = 'open.feedback.submit';
$param['feedback_id'] = $feedback_id;
$param['question_id'] = $question_id;
$param['answer'] = $answer;
$param['solution'] = $solution;
unset($param['app_version']);
unset($param['client_type']);
unset($param['os_version']);
unset($param['screen_size']);
unset($param['v']);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
* 消息提示——未读消息
*
* @param int $uid 用户ID
* @return array 接口返回的数据
*/
public static function infoNum($uid, $udid)
{
$param = Yohobuy::param();
$param['method'] = 'app.home.getInfoNum';
$param['uid'] = $uid;
$param['udid'] = $udid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 消息提示——未确认订单数量
* @param type $uid
* @return type
*/
public static function getPendingOrderCount($uid)
{
$param = Yohobuy::param();
$param['method'] = 'web.SpaceOrders.getPendingOrderCount';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::DEV_API_URL, $param);
}
/**
* 消息提示——未评论数量
* @param type $uid
* @return type
*/
public static function notCommentRecordCount($uid)
{
$param = Yohobuy::param();
$param['method'] = 'show.notCommentRecordCount';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* YOHO币列表数据
*
* @param int $uid 用户ID
* @param int $page 第几页,默认1
* @param int $limit 限制读取的数目,默认10
* @param string $type 请求类型 get,post
* @return array YOHO币接口返回的数据
*/
public static function yohoCoinData($uid, $page = 1, $limit = 15, $type = 'get')
{
$param = Yohobuy::param();
$param['method'] = 'app.yohocoin.lists';
$param['uid'] = $uid;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::$type(Yohobuy::API_URL, $param);
}
}