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

fix(order): 修复购物车ID处理逻辑错误

- 修正了cartId参数解析方式,移除不必要的json_decode调用
- 修复数据库查询中的参数传递问题
- 确保购物车验证逻辑正确执行
- 保持邮费计算和产品验证功能正常运行
shichen месяцев назад: 3
Родитель
Сommit
febe4d83eb
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      app/controller/api/store/order/AlibabaOrder.php

+ 2 - 2
app/controller/api/store/order/AlibabaOrder.php

@@ -14,13 +14,13 @@ class AlibabaOrder
14 14
         $addressId = request()->param('address_id');
15 15
         $uid = 4895;
16 16
 
17
-        if (!($count = count(json_decode($cartId))) || $count != count($cartRepository->validIntersection(json_decode($cartId), $uid)))
17
+        if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
18 18
             return app('json')->fail('已失效或已下单');
19 19
 
20 20
         $postagePrice = 0;
21 21
 
22 22
         // 判断是否是阿里巴巴商品
23
-        $cartInfo = Db::name('store_cart')->whereIn('cart_id', json_decode($cartId))->select()->toArray();
23
+        $cartInfo = Db::name('store_cart')->whereIn('cart_id', $cartId)->select()->toArray();
24 24
         $productInfo = Db::name('store_product')->whereIn('product_id', array_column($cartInfo, 'product_id'))->find();
25 25
         if (!$productInfo['is_alibaba']) {
26 26
             return app('json')->success(['postagePrice' => $postagePrice]);