Skip to content

Commit

Permalink
'document'
Browse files Browse the repository at this point in the history
  • Loading branch information
huangbule committed Mar 14, 2024
1 parent 76ca8bd commit 81ae06b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ return [
'title' => '$like', //可以不写 因为默认是like
'department_name' => '$like',
'#department_name' => '#department|$like',
'created_at' => '#department|preprocess|$halfOpenFilter' //不分顺序。 属于department表,同时进行预处理函数,最后执行左开右闭处理
'created_at' => '#department|HalfOpenDate|$halfOpen' //不分顺序。 属于department表,同时进行预处理函数,最后执行左开右闭处理
]
];
Expand Down Expand Up @@ -118,7 +118,7 @@ class OrderModel extends Model
| `$in` | whereIn('id', [1, 2, 3]) |
| `$notIn` | whereNotIn('id', [1, 2, 3]) |
| `$between` | whereBetween('id', [1, 10]) |
| `$halfOpenFilter`| where('id','>=',1)->where('id','<',10) | |
| `$halfOpen`| where('id','>=',1)->where('id','<',10) | |

### 前置处理器

Expand Down
5 changes: 4 additions & 1 deletion config/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
'default' => '$like',

'rule' => [

'uuid' => 'uuid|$eq',
'created_at' => 'HalfOpenDate|$halfOpen',
'department_name' => '$like',
'#department_name' => '#department|$like'
]
];
4 changes: 2 additions & 2 deletions src/Preprocess/HalfOpenDatePreprocess.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public function handle($column, &$param) {
$start_at = $param[$column][0];
$end_at = date('Y-m-d', strtotime('+1 day', strtotime($param[$column][1])));
} else {
$start_at = $param[$column];
$end_at = date('Y-m-d', strtotime('+1 day', strtotime($param[$column])));
list($start_at, $end_at) = explode(",", $param[$column]);
$end_at = date('Y-m-d', strtotime('+1 day', strtotime($end_at)));
}
$param[$column] = [$start_at, $end_at];
}
Expand Down

0 comments on commit 81ae06b

Please sign in to comment.