Просмотр исходного кода

fix(order): 解决订单创建时收货地址验证问题

- 移除了无效的 psType 变量赋值
- 添加了收货地址必填验证并返回错误码 40001
- 统一了错误响应格式为 JSON 格式
shichen месяцев назад: 2
Родитель
Сommit
f8a97d5f16
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      app/controller/api/store/order/StoreOrder.php

+ 1 - 1
app/controller/api/store/order/StoreOrder.php

@@ -78,7 +78,7 @@ class StoreOrder extends BaseController
78
         if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
78
         if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
79
             return app('json')->fail('已失效或已下单');
79
             return app('json')->fail('已失效或已下单');
80
         if (!$addressId) {
80
         if (!$addressId) {
81
-            $psType = false;
81
+            return app('json')->fail('请选择收货地址',null, 40001);
82
         }
82
         }
83
         $orderInfo = $this->repository->cartIdByOrderInfo($uid, $cartId, $addressId, true, $psType);
83
         $orderInfo = $this->repository->cartIdByOrderInfo($uid, $cartId, $addressId, true, $psType);
84
         $orderInfo['product_type'] = 0;
84
         $orderInfo['product_type'] = 0;