CouponData.php
1.08 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
<?php
namespace LibModels\Web\Home;
use Api\Yohobuy;
use Api\Sign;
class CouponData
{
/**
* 获取领券频道资源
* @param type $code 资源码
* @param type $uid 用户uid
*/
public static function getCouponRousource($contentCode, $uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.promotion.queryCouponCenter';
$param['contentCode'] = $contentCode;
if($uid !== 0){
$param['uid'] = $uid;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL , $param);
}
/**
* 领取优惠券
* @param type $id 优惠券id
* @param type $uid 用户uid
*/
public static function sendCoupon($id, $uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.promotion.getCoupon';
$param['couponId'] = $id;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}