xieruidong il y a 2 ans
Parent
commit
ea4e2774f6
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      application/common/model/OrderGoods.php

+ 7 - 0
application/common/model/OrderGoods.php

@@ -5,6 +5,7 @@ namespace app\common\model;
 
 
 use app\admin\model\Orders;
+use think\Db;
 use think\db\Query;
 use think\Model;
 
@@ -25,4 +26,10 @@ class OrderGoods extends Model
             Orders::whereRaw("orders.id={$table}.order_id and orders.admin_id=$admin_id")->buildSql()
         );
     }
+    public function scopeFilterDate(Query $query, $date, $column = 'create_time', $dateType = 'timestamp')
+    {
+        $query->whereExists(
+            Orders::where('id',Db::raw('order_goods.order_id'))->filterDate($date,$column,$dateType)->buildSql()
+        );
+    }
 }