...
|
...
|
@@ -314,13 +314,30 @@ class CartModel |
|
|
* @param int $uid 用户ID
|
|
|
* @param string $cartType 购物车类型,ordinary表示普通购物车
|
|
|
* @param array $orderInfo cookie中记录的一些订单有关数据
|
|
|
* @param string $limitCode 限购商品的限购码,用户限购商品购买
|
|
|
* @param string $sku 商品sku,用于限购商品购买
|
|
|
* @param stirng $skn 商品skn,用于限购商品购买
|
|
|
* @param int $buyNumber 购买商品数目,用户限购商品支付
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function cartPay($uid, $cartType, $orderInfo)
|
|
|
public static function cartPay($uid, $cartType, $orderInfo, $limitCode, $sku, $skn, $buyNumber)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
$pay = CartData::cartPay($uid, $cartType);
|
|
|
$skuList = '';
|
|
|
if (!empty($sku) && !empty($skn) && !empty($buyNumber)) { // 存在sku,skn和buyNumber时
|
|
|
$skuList = json_encode(array(
|
|
|
array(
|
|
|
'type' => 'limitcode',
|
|
|
'limitproductcode' => $limitCode,
|
|
|
'skn' => $skn,
|
|
|
'sku' => $sku,
|
|
|
'buy_number' => $buyNumber
|
|
|
)
|
|
|
));
|
|
|
}
|
|
|
|
|
|
$pay = CartData::cartPay($uid, $cartType, 0, $skuList);
|
|
|
|
|
|
// 商品为空返回
|
|
|
if (!$pay || empty($pay['data']['goods_list'])) {
|
...
|
...
|
@@ -335,7 +352,7 @@ class CartModel |
|
|
|
|
|
// cookie保存的数据
|
|
|
if (!empty($orderInfo)) {
|
|
|
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
|
|
|
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin'], $skuList);
|
|
|
}
|
|
|
|
|
|
// 根据地址id查询地址信息
|
...
|
...
|
@@ -503,13 +520,14 @@ class CartModel |
|
|
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
|
|
|
* @param string $couponCode 优惠券码
|
|
|
* @param mixed $yohoCoin 使用的YOHO币数量
|
|
|
* @param string $skuList 购买限购商品时需要传递的参数
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin)
|
|
|
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $skuList)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
$compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
|
|
|
$compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $skuList);
|
|
|
if ($compute && isset($compute['code']) && $compute['code'] === 200) {
|
|
|
// 有货币添加.00后缀
|
|
|
$compute['data']['use_yoho_coin'] = Helpers::transPrice($compute['data']['use_yoho_coin']);
|
...
|
...
|
@@ -596,9 +614,10 @@ class CartModel |
|
|
* @param string $remark 留言
|
|
|
* @param string $couponCode 优惠券码
|
|
|
* @param mixed $yohoCoin 使用的YOHO币数量或为空
|
|
|
* @param string $skuList 购买限购商品时需要传递的参数
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
|
|
|
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList)
|
|
|
{
|
|
|
$result = array('code' => 400, 'message' => '出错啦');
|
|
|
|
...
|
...
|
@@ -612,7 +631,7 @@ class CartModel |
|
|
$result['code'] = 403;
|
|
|
$result['message'] = '请选择配送方式';
|
|
|
} else {
|
|
|
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
|
|
|
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList);
|
|
|
if ($orderSubRes && isset($orderSubRes['code'])) {
|
|
|
$result = $orderSubRes;
|
|
|
}
|
...
|
...
|
|