|
@@ -93,9 +93,21 @@ class UserPurchase extends Auth
|
|
|
$offer->order('id','desc');
|
|
|
$offer->whereExists(
|
|
|
ShopPurchase::getQuery($request['tab'])
|
|
|
- ->where(function ($query) use ($status){
|
|
|
- if ($status>2){
|
|
|
- $query->where('status',$status);
|
|
|
+ ->where(function ($query) use ($status,$request){
|
|
|
+ if($request['tab'] == 1){
|
|
|
+ if($status == 1){
|
|
|
+ $query->whereExists('select * from shop_purchase_item where shop_purchase_item.purchase_id=shop_purchase.id and not exists(select * from shop_purchase_offer where shop_purchase_offer.item_id=shop_purchase_item.id)');
|
|
|
+ }elseif ($status == 2){
|
|
|
+ $query->whereExists('select * from shop_purchase_item where shop_purchase_item.purchase_id=shop_purchase.id and exists(select * from shop_purchase_offer where shop_purchase_offer.item_id=shop_purchase_item.id)');
|
|
|
+ }elseif($status == 3){
|
|
|
+ $query->whereExists('select * from shop_purchase_item where shop_purchase_item.purchase_id=shop_purchase.id and offer_id is not null');
|
|
|
+ }else{
|
|
|
+ $this->error('未知参数');
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if ($status>2){
|
|
|
+ $query->where('status',$status);
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
->where('id',"{$offerTable}.$key")->buildSql()
|