Parcourir la source

小程序app-订单详情

xupuyuan il y a 10 mois
Parent
commit
684ee9ce1e
1 fichiers modifiés avec 27 ajouts et 9 suppressions
  1. 27 9
      app/common/repositories/store/order/StoreOrderRepository.php

+ 27 - 9
app/common/repositories/store/order/StoreOrderRepository.php

@@ -2679,17 +2679,34 @@ class StoreOrderRepository extends BaseRepository
2679 2679
         $where = [];
2680 2680
         if ($uid) $where['uid'] = $uid;
2681 2681
 
2682
-        $data = $this->dao->search($where)->where('group_order_id', $id)->where('is_del', 0)->with([
2683
-            'orderProduct', 'merchant' => function ($query) {
2682
+//        $data = $this->dao->search($where)->where('group_order_id', $id)->where('is_del', 0)->with([
2683
+//            'orderProduct', 'merchant' => function ($query) {
2684
+//                return $query->field('mer_id,mer_name,mer_avatar,business_id');
2685
+//            }
2686
+//        ])->when(!$uid, function ($query) {
2687
+//            $query->with([
2688
+//                'user' => function ($query) {
2689
+//                    return $query->field('uid,nickname');
2690
+//                }
2691
+//            ]);
2692
+//        })->find();
2693
+        $data = StoreOrder::with([
2694
+            'orderProduct',
2695
+            'merchant' => function ($query) {
2684 2696
                 return $query->field('mer_id,mer_name,mer_avatar,business_id');
2685 2697
             }
2686
-        ])->when(!$uid, function ($query) {
2687
-            $query->with([
2688
-                'user' => function ($query) {
2689
-                    return $query->field('uid,nickname');
2690
-                }
2691
-            ]);
2692
-        })->find();
2698
+        ])
2699
+            ->when(!$uid, function ($query) {
2700
+                $query->with([
2701
+                    'user' => function ($query) {
2702
+                        return $query->field('uid,nickname');
2703
+                    }
2704
+                ]);
2705
+            })
2706
+            ->where('uid', $where['uid'])
2707
+            ->where('group_order_id', $id)
2708
+            ->where('is_del', 0)
2709
+            ->find();
2693 2710
         $pay_time = isset($data->pay_time) ?? $data['pay_time'];
2694 2711
         $data['take_order_time'] = strtotime($pay_time) + $time;
2695 2712
         return $data;
@@ -5272,6 +5289,7 @@ class StoreOrderRepository extends BaseRepository
5272 5289
         $teshu_mer_id = implode(',', $teshu_mer_id);
5273 5290
         $query = $this->dao->search($where)->where('test_order', 0)->where('is_del', 0);
5274 5291
 //        $query = $this->dao->search($where)->where('is_del', 0);
5292
+//        $query = Db::name('store_order')->where('test_order', 0)->where('is_del', 0)->where('uid',$where['uid'])->where('paid',1)->where('status',$where['status']);
5275 5293
         $count = $query->count();
5276 5294
         $list = $query->with([
5277 5295
             'orderProduct', 'merchant' => function ($query) {