ActivityData.php
2.21 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
<?php
namespace LibModels\Wap\Cuxiao;
use Api\Yohobuy;
/**
* 活动的数据模型
*
* @name ActivityData
* @package LibModels/Wap/Cuxiao
* @copyright yoho.inc
* @version 1.0 (2015-11-25 19:10:52)
* @author fei.hong <fei.hong@yoho.cn>
*/
class ActivityData
{
const URI_GET_ACTIVITY_INFO = 'event/api/v1/activity/get';
const URI_GET_NAMED_COUPON = 'event/api/v1/activity/getCoupon';
const URI_GET_ALL_COUPON = 'event/api/v1/activity/getCoupon';
/**
* 用户获取某个活动指定的单个优惠券
*
* @param int $uid 用户ID
* @param int $activityId 活动ID
* @param int $couponId 优惠券ID
* @return array
*/
public static function getCouponNamed($uid, $activityId, $couponId)
{
$param = array();
$param['uid'] = $uid;
$param['activity_id'] = $activityId;
$param['coupon_id'] = $couponId;
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_GET_NAMED_COUPON, $param);
}
/**
* 用户获取某个活动所有的优惠券操作
*
* @param int $uid 用户ID
* @param int $activityId 活动ID
* @return array
*/
public static function getCouponAll($uid, $activityId)
{
$param = array();
$param['uid'] = $uid;
$param['activity_id'] = $activityId;
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_GET_ALL_COUPON, $param);
}
/**
* 获取活动信息
*
* @param int $activityId 活动ID
* @return array
*/
public static function getActivityInfo($activityId)
{
$param = array('activity_id' => $activityId);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_GET_ACTIVITY_INFO, $param, 3600); // 有缓存1小时
}
/**
* 发送站内信
*
* @param int $activityId 活动ID
* @return array
*/
public static function message($uid, $title, $content, $type = 1, $verify_key = '', $send_uid = 0, $call_back = '')
{
//调用接口发送站内信
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_SEND_MESSAGE, 'setSingleMessage', array(
$uid, $title, $content, $type, $verify_key, $send_uid, $call_back
));
}
}