Explorar el Código

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

- 修正了cartId参数解析方式,移除不必要的json_decode调用
- 修复数据库查询中的参数传递问题
- 确保购物车验证逻辑正确执行
- 保持邮费计算和产品验证功能正常运行
shichen hace 3 meses
padre
commit
febe4d83eb
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  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
         $addressId = request()->param('address_id');
14
         $addressId = request()->param('address_id');
15
         $uid = 4895;
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
             return app('json')->fail('已失效或已下单');
18
             return app('json')->fail('已失效或已下单');
19
 
19
 
20
         $postagePrice = 0;
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
         $productInfo = Db::name('store_product')->whereIn('product_id', array_column($cartInfo, 'product_id'))->find();
24
         $productInfo = Db::name('store_product')->whereIn('product_id', array_column($cartInfo, 'product_id'))->find();
25
         if (!$productInfo['is_alibaba']) {
25
         if (!$productInfo['is_alibaba']) {
26
             return app('json')->success(['postagePrice' => $postagePrice]);
26
             return app('json')->success(['postagePrice' => $postagePrice]);