|
@@ -2,8 +2,11 @@
|
|
|
|
|
|
namespace app\common\model;
|
|
|
|
|
|
+use think\db\Query;
|
|
|
use think\Model;
|
|
|
-
|
|
|
+/**
|
|
|
+ * @method Query filterDate($date)
|
|
|
+ */
|
|
|
class ViewUnique extends Model
|
|
|
{
|
|
|
protected $pk='date';
|
|
@@ -19,4 +22,13 @@ class ViewUnique extends Model
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
+ public function scopeFilterDate(Query $query,$date,$dateType=0){
|
|
|
+ if($date){
|
|
|
+ if($dateType===0){
|
|
|
+ $date[0]=strtotime($date[0]);
|
|
|
+ $date[1]=strtotime($date[1]);
|
|
|
+ }
|
|
|
+ $query->whereBetween('date',$date);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|