WIN-2308041133\Administrator 1 день назад
Родитель
Сommit
dc6b386b46
1 измененных файлов с 17 добавлено и 0 удалено
  1. 17 0
      app/system/controller/Shop.php

+ 17 - 0
app/system/controller/Shop.php

@@ -113,7 +113,24 @@ class Shop extends BaseController
             ->order('o.id', 'desc')
             ->select()
             ->toArray();
+        // 关联订单商品信息
+        if (!empty($data)) {
+            foreach ($data as &$order) {
+                $cartInfo = Db::name('store_order_cart_info')
+                    ->where('oid', $order['id'])
+                    ->select()
+                    ->toArray();
 
+                foreach ($cartInfo as &$item) {
+                    if (!empty($item['cart_info'])) {
+                        $innerCartInfo = json_decode($item['cart_info'], true);
+                        unset($item['cart_info']);
+                        $item = array_merge($item, $innerCartInfo);
+                    }
+                }
+                $order['cart_info'] = $cartInfo;
+            }
+        }
         $pageCount = $order->where($where)->count();
 
         $result = UtilService::getParam([