CouponData.php 1.11 KB
<?php

/**
 * Created by PhpStorm.
 * User: Targaryen
 * Date: 2016/4/19
 * Time: 10:50
 */
namespace LibModels\Wap\Coupon;

use Api\Sign;
use Api\Yohobuy;

class CouponData
{

    /**
     * 获取领券楼层数据
     *
     * @param $uid 用户ID
     * @param $contentCode 资源码
     * @return array|mixed
     */
    public static function getCouponRousource($contentCode, $uid)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.promotion.queryCouponCenter';
        $param['contentCode'] = $contentCode;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);
        return Yohobuy::get(Yohobuy::API_URL, $param);
    }


    /**
     * @param $uid 用户ID
     * @param $couponId 优惠券ID
     * @return mixed
     */
    public static function receiveCoupon($uid, $couponId)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.promotion.getCoupon';
        $param['couponId'] = $couponId;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);
        return Yohobuy::get(Yohobuy::API_URL, $param);
    }
}