...
|
...
|
@@ -17,15 +17,15 @@ use Api\Yohobuy; |
|
|
class CartData
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
* 加入购物车接口
|
|
|
*
|
|
|
* @param int $productSku 商品SKU
|
|
|
* @param int $buyNumber 购买数量
|
|
|
* @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品
|
|
|
* @param int $isEdit 是否是编辑商品SKU,0表示不是编辑
|
|
|
* @param null|int $promotionId 促销id,默认null(加价购有关)
|
|
|
* @param null|int $uid 用户UID,可以不传
|
|
|
/**
|
|
|
* 加入购物车接口
|
|
|
*
|
|
|
* @param int $productSku 商品SKU
|
|
|
* @param int $buyNumber 购买数量
|
|
|
* @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品
|
|
|
* @param int $isEdit 是否是编辑商品SKU,0表示不是编辑
|
|
|
* @param null|int $promotionId 促销id,默认null(加价购有关)
|
|
|
* @param null|int $uid 用户UID,可以不传
|
|
|
* @param string $shoppingKey 未登录用户唯一识别码,可以不传
|
|
|
* @return array 加入购物车接口返回的数据
|
|
|
*/
|
...
|
...
|
@@ -205,175 +205,199 @@ class CartData |
|
|
$param['decrease_number'] = $decreaseNum;
|
|
|
}
|
|
|
|
|
|
if (!empty($uid)) {
|
|
|
$param['uid'] = $uid;
|
|
|
}
|
|
|
if ($shoppingKey !== null) {
|
|
|
$param['shopping_key'] = $shoppingKey;
|
|
|
}
|
|
|
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改购物车商品数据
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $swapData 商品数据
|
|
|
* @param string $shoppingKey 未登录用户唯一识别码
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function modifyCartProduct($uid, $swapData, $shoppingKey)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.swap';
|
|
|
$param['swap_data'] = $swapData;
|
|
|
|
|
|
if (!empty($uid)) {
|
|
|
$param['uid'] = $uid;
|
|
|
}
|
|
|
if ($shoppingKey !== null) {
|
|
|
$param['shopping_key'] = $shoppingKey;
|
|
|
}
|
|
|
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
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 int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
|
|
|
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
|
|
|
* @param string $couponCode 优惠券码
|
|
|
* @param mixed $yohoCoin 使用的YOHO币数量
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.compute';
|
|
|
$param['cart_type'] = $cartType;
|
|
|
$param['delivery_way'] = $deliveryWay;
|
|
|
$param['payment_type'] = $paymentType;
|
|
|
if (!empty($couponCode)) {
|
|
|
$param['coupon_code'] = $couponCode;
|
|
|
}
|
|
|
if (!empty($yohoCoin)) {
|
|
|
$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 searchCoupon($uid, $couponCode)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.useCoupon';
|
|
|
$param['coupon_code'] = $couponCode;
|
|
|
$param['uid'] = $uid;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
if (!empty($uid)) {
|
|
|
$param['uid'] = $uid;
|
|
|
}
|
|
|
if ($shoppingKey !== null) {
|
|
|
$param['shopping_key'] = $shoppingKey;
|
|
|
}
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改购物车商品数据
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $swapData 商品数据
|
|
|
* @param string $shoppingKey 未登录用户唯一识别码
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function modifyCartProduct($uid, $swapData, $shoppingKey)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.swap';
|
|
|
$param['swap_data'] = $swapData;
|
|
|
|
|
|
if (!empty($uid)) {
|
|
|
$param['uid'] = $uid;
|
|
|
}
|
|
|
if ($shoppingKey !== null) {
|
|
|
$param['shopping_key'] = $shoppingKey;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算--获取优惠券列表
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function getCouponList($uid)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.coupons.lists';
|
|
|
$param['type'] = 'notuse';
|
|
|
$param['page'] = 1;
|
|
|
$param['limit'] = 1000;
|
|
|
$param['uid'] = $uid;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
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 int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
|
|
|
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
|
|
|
* @param string $couponCode 优惠券码
|
|
|
* @param mixed $yohoCoin 使用的YOHO币数量
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.compute';
|
|
|
$param['cart_type'] = $cartType;
|
|
|
$param['delivery_way'] = $deliveryWay;
|
|
|
$param['payment_type'] = $paymentType;
|
|
|
if (!empty($couponCode)) {
|
|
|
$param['coupon_code'] = $couponCode;
|
|
|
}
|
|
|
if (!empty($yohoCoin)) {
|
|
|
$param['use_yoho_coin'] = $yohoCoin;
|
|
|
}
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
$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 searchCoupon($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);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算--获取优惠券列表
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function getCouponList($uid)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.coupons.lists';
|
|
|
$param['type'] = 'notuse';
|
|
|
$param['page'] = 1;
|
|
|
$param['limit'] = 1000;
|
|
|
$param['uid'] = $uid;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算--提交结算信息
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param int $addressId 地址ID
|
|
|
* @param int $cartType 购物车类型ID
|
|
|
* @param int $deliveryTime 寄送时间ID
|
|
|
* @param int $deliveryWay 寄送方式ID
|
|
|
* @param string $invoiceTitle 发票说明
|
|
|
* @param int $invoiceId 发票类型ID
|
|
|
* @param int $paymentId 支付方式ID
|
|
|
* @param int $paymentType 支付类型ID
|
|
|
* @param string $remark 留言
|
|
|
* @param string $couponCode 优惠券码
|
|
|
* @param mixed $yohoCoin 使用的YOHO币数量或为空
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.submit';
|
|
|
$param['address_id'] = $addressId;
|
|
|
$param['cart_type'] = $cartType;
|
|
|
$param['delivery_time'] = $deliveryTime;
|
|
|
$param['delivery_way'] = $deliveryWay;
|
|
|
if (!empty($invoiceTitle)) {
|
|
|
$param['invoices_title'] = $invoiceTitle;
|
|
|
}
|
|
|
if (!empty($invoiceId)) {
|
|
|
$param['invoices_type_id'] = $invoiceId;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车结算--提交结算信息
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param int $addressId 地址ID
|
|
|
* @param int $cartType 购物车类型ID
|
|
|
* @param int $deliveryTime 寄送时间ID
|
|
|
* @param int $deliveryWay 寄送方式ID
|
|
|
* @param string $invoiceTitle 发票说明
|
|
|
* @param int $invoiceId 发票类型ID
|
|
|
* @param int $paymentId 支付方式ID
|
|
|
* @param int $paymentType 支付类型ID
|
|
|
* @param string $remark 留言
|
|
|
* @param string $couponCode 优惠券码
|
|
|
* @param mixed $yohoCoin 使用的YOHO币数量或为空
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.submit';
|
|
|
$param['address_id'] = $addressId;
|
|
|
$param['cart_type'] = $cartType;
|
|
|
$param['delivery_time'] = $deliveryTime;
|
|
|
$param['delivery_way'] = $deliveryWay;
|
|
|
if (!empty($invoiceTitle)) {
|
|
|
$param['invoices_title'] = $invoiceTitle;
|
|
|
}
|
|
|
if (!empty($invoiceId)) {
|
|
|
$param['invoices_type_id'] = $invoiceId;
|
|
|
}
|
|
|
$param['payment_id'] = $paymentId;
|
|
|
$param['payment_type'] = $paymentType;
|
|
|
$param['remark'] = $remark;
|
|
|
if (!empty($couponCode)) {
|
|
|
$param['coupon_code'] = $couponCode;
|
|
|
}
|
|
|
if (!empty($yohoCoin)) {
|
|
|
$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 $shoppingKey 未登录用户唯一识别码
|
|
|
* @return array 购物车接口返回的数据
|
|
|
*/
|
|
|
public static function cartCount($uid, $shoppingKey)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
$param['method'] = 'app.Shopping.count';
|
|
|
|
|
|
if (!empty($uid)) {
|
|
|
$param['uid'] = $uid;
|
|
|
}
|
|
|
if (!empty($shoppingKey)) {
|
|
|
$param['shopping_key'] = $shoppingKey;
|
|
|
}
|
|
|
|
|
|
$param['payment_id'] = $paymentId;
|
|
|
$param['payment_type'] = $paymentType;
|
|
|
$param['remark'] = $remark;
|
|
|
if (!empty($couponCode)) {
|
|
|
$param['coupon_code'] = $couponCode;
|
|
|
}
|
|
|
if (!empty($yohoCoin)) {
|
|
|
$param['use_yoho_coin'] = $yohoCoin;
|
|
|
}
|
|
|
$param['uid'] = $uid;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|