Bläddra i källkod

wesmiler 抢表商城

APPLE 3 år sedan
förälder
incheckning
96f4fe13da
1 ändrade filer med 26 tillägg och 6 borttagningar
  1. 26 6
      app/Services/Common/TradeService.php

+ 26 - 6
app/Services/Common/TradeService.php

@@ -93,9 +93,12 @@ class TradeService extends BaseService
             ->where($where)
             ->where('a.status','>', 0)
             ->where(function($query) use($userId,$status){
-                if($status == 2){
-                    $query->whereNotIn('a.user_id',[$userId]);
-                }
+//                if($status == 0){
+//                    $query->whereNotIn('a.sell_uid',[$userId]);
+//                }
+//                else if($status == 2){
+//                    $query->whereNotIn('a.user_id',[$userId]);
+//                }
             })
             ->where(function($query) use($type){
                 if($type){
@@ -114,9 +117,26 @@ class TradeService extends BaseService
                     $query->where('a.pay_time', '>=', $time)->orWhere('a.create_time', '>=', $time);
                 }
             })
-            ->where(function ($query) use ($userId,$sellUid, $status) {
+            ->where(function ($query) use ($type, $userId, $sellUid, $status) {
 
-                if ($sellUid && $userId) {
+                if($type == 1){
+
+                    if($status == 0){
+                        $query->where('a.user_id', '=', $userId);
+                        $query->whereNotIn('a.sell_uid', [$userId]);
+                    }else if($status == 2){
+                        $query->whereNotIn('a.user_id', '=', $userId);
+                    }else{
+                        $query->where('a.user_id', '=', $userId);
+                    }
+                }else{
+                    if($userId){
+                        $query->where('a.user_id', '=', $userId);
+                    }else if($sellUid){
+                        $query->where('a.sell_uid', '=', $sellUid);
+                    }
+                }
+                /*if ($sellUid && $userId) {
                     $query->where('a.user_id', $userId)->orWhere(function($query) use($sellUid){
                         $query->where('a.sell_uid', $sellUid)->whereIn('a.status', [1,2]);
                     });
@@ -124,7 +144,7 @@ class TradeService extends BaseService
                     $query->where('a.user_id', '=', $userId);
                 }else if($sellUid){
                     $query->where('a.sell_uid', '=', $sellUid);
-                }
+                }*/
             })
             ->select(['a.*', 'b.nickname', 'b.mobile as buy_mobile','s.name as shop_name','s.code as shop_code', 'c.nickname as sell_nickname', 'c.mobile as sell_mobile', 'g.goods_name', 'g.code', 'g.thumb'])
             ->orderBy('a.create_time', 'desc')