...
|
...
|
@@ -105,4 +105,67 @@ class CartData |
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $cartType 购物车类型,ordinary表示普通购物车
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function cartPay($uid, $cartType)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.payment';
|
|
|
$param['cart_type'] = $cartType;
|
|
|
$param['uid'] = $uid;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算--支付方式和配送方式选择
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $cartType 购物车类型,ordinary表示普通购物车
|
|
|
* @param string $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
|
|
|
* @param string $paymentType 支付方式,1表示在线支付,2表示货到付款
|
|
|
* @param string $yohoCoin 使用的YOHO币数量,默认为null表示不适用
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType, $yohoCoin = null)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.compute';
|
|
|
$param['cart_type'] = $cartType;
|
|
|
$param['delivery_way'] = $deliveryWay;
|
|
|
$param['payment_type'] = $paymentType;
|
|
|
if ($yohoCoin !== null) {
|
|
|
$param['use_yoho_coin'] = $yohoCoin;
|
|
|
}
|
|
|
|
|
|
$param['uid'] = $uid;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算--使用优惠券
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $couponCode 优惠券代码
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function getCoupon($uid, $couponCode)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.useCoupon';
|
|
|
$param['coupon_code'] = $couponCode;
|
|
|
$param['uid'] = $uid;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|