正在显示
1 个修改的文件
包含
13 行增加
和
2 行删除
| @@ -28,9 +28,20 @@ class ProductController extends BaseController | @@ -28,9 +28,20 @@ class ProductController extends BaseController | ||
| 28 | if(!empty($this->param['search'])){ | 28 | if(!empty($this->param['search'])){ |
| 29 | $map[] = ['title', 'like', "%{$this->param['search']}%"]; | 29 | $map[] = ['title', 'like', "%{$this->param['search']}%"]; |
| 30 | } | 30 | } |
| 31 | + if(!empty($this->param['created_at'][0])){ | ||
| 32 | + $this->param['created_at'][0] .= ' 00:00:00'; | ||
| 33 | + } | ||
| 34 | + if(!empty($this->param['created_at'][1])){ | ||
| 35 | + $this->param['created_at'][1] .= ' 23:59:59'; | ||
| 36 | + } | ||
| 37 | + if(empty($this->param['created_at'][0]) && !empty($this->param['created_at'][1])){ | ||
| 38 | + $map[] = ['created_at', '>=', $this->param['created_at'][0]]; | ||
| 39 | + } | ||
| 40 | + if(!empty($this->param['created_at'][0]) && empty($this->param['created_at'][1])){ | ||
| 41 | + $map[] = ['created_at', '<=', $this->param['created_at']]; | ||
| 42 | + } | ||
| 31 | if(!empty($this->param['created_at'][0]) && !empty($this->param['created_at'][1])){ | 43 | if(!empty($this->param['created_at'][0]) && !empty($this->param['created_at'][1])){ |
| 32 | - $map[] = ['created_at', '>=', $this->param['created_at'][0] . ' 00:00:00']; | ||
| 33 | - $map[] = ['created_at', '<=', $this->param['created_at'][1] . ' 59:59:59']; | 44 | + $map[] = ['created_at', 'between', [$this->param['created_at']]]; |
| 34 | } | 45 | } |
| 35 | if(!empty($this->param['category_id'])){ | 46 | if(!empty($this->param['category_id'])){ |
| 36 | $ids = CategoryRelated::where('cate_id', $this->param['category_id'])->pluck('product_id')->toArray(); | 47 | $ids = CategoryRelated::where('cate_id', $this->param['category_id'])->pluck('product_id')->toArray(); |
-
请 注册 或 登录 后发表评论