Authored by Rock Zhang

修复结算提交接口缺失参数的bug,修复接口传参书写错误的bug

Code Review By Rock Zhang
... ... @@ -303,14 +303,15 @@ class CartData
* @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, $yohoCoin)
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['addressId'] = $addressId;
$param['address_id'] = $addressId;
$param['cart_type'] = $cartType;
$param['delivery_time'] = $deliveryTime;
$param['delivery_way'] = $deliveryWay;
... ... @@ -324,6 +325,9 @@ class CartData
$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;
}
... ...
... ... @@ -314,8 +314,9 @@ class ShoppingCartController extends AbstractAction
$paymentId = $this->post('paymentTypeId', 15);
$paymentType = $this->post('paymentType', 1); // 默认在线支付
$remark = $this->post('msg', null);
$couponCode = $this->post('couponCode', null);
$yohoCoin = $this->post('yohoCoin', 1);
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
}
if (empty($result)) {
... ...
... ... @@ -567,16 +567,28 @@ class CartModel
* @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, $yohoCoin)
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
{
$result = array();
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);
if ($orderSubRes && isset($orderSubRes['code'])) {
$result = $orderSubRes;
$result = array('code' => 400, 'message' => '出错啦');
if (empty($addressId)) {
$result['code'] = 401;
$result['message'] = '配送地址不能为空';
} elseif (empty($deliveryTime)) {
$result['code'] = 402;
$result['message'] = '请选择配送时间';
} elseif (empty($deliveryWay)) {
$result['code'] = 403;
$result['message'] = '请选择配送方式';
} else {
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
if ($orderSubRes && isset($orderSubRes['code'])) {
$result = $orderSubRes;
}
}
return $result;
... ...