MessageData.php
2.88 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
<?php
namespace LibModels\Web\Home;
use Api\Yohobuy;
use Api\Sign;
class MessageData
{
/**
* 获取我的消息列表数据
* @param type $uid 用户id
* @param type $page 当前页
* @param type $size 每页显示个数
* @return type
*/
public static function getInboxList($uid, $page, $size)
{
$param = Yohobuy::param();
$param['method'] = 'app.inbox.getlist';
$param['uid'] = $uid;
$param['page'] = $page;
$param['size'] = $size;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 删除我的消息
* @param type $uid 用户id
* @param type $id 消息id
* @return type
*/
public static function delMessageData($uid, $id)
{
$param = Yohobuy::param();
$param['method'] = 'app.inbox.delmessage';
$param['uid'] = $uid;
$param['id'] = $id;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 批量设置消息为已读
* @param type $uid 用户id
* @param type $ids 选中消息id
*/
public static function setRead($uid, $ids)
{
$param = Yohobuy::param();
$param['method'] = 'web.inbox.setread';
$param['uid'] = $uid;
$param['ids'] = $ids;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 获取未读数量
* @param type $uid 用户id
*/
public static function unredTotal($uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.inbox.getTotal';
$param['uid'] = $uid;
$param['is_read'] = 'N';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 根据用户uid获取生日券id
* @param type $uid
* @return type
*/
public static function getCouponId($uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.promotion.queryBirthCoupon';
$param['uid'] = $uid;
$param['couponType'] = 4;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* vip会员领取生日券
* @param type $uid 用户id
* @param type $couponId 生日券号
* @return type
*/
public static function getBirthCoupon($uid, $couponId)
{
$param = Yohobuy::param();
$param['method'] = 'app.promotion.getCoupon';
$param['uid'] = $uid;
$param['couponId'] = $couponId;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}