完善广告搜索
parent
c5249c2a3f
commit
038427493c
|
|
@ -28,7 +28,24 @@ class AdController extends AdminController
|
|||
$this->createButton(),
|
||||
...$this->baseHeaderToolBar(),
|
||||
])
|
||||
->filter($this->baseFilter()->body())
|
||||
->filter($this->baseFilter()->labelWidth('80px')->body([
|
||||
amis()->TextControl('id', __('admin.ads.id'))
|
||||
->size('md')
|
||||
->placeholder(__('admin.id')),
|
||||
amis()->TextControl('remark', __('admin.ads.remark'))
|
||||
->size('md')
|
||||
->placeholder(__('admin.ads.remark')),
|
||||
Components::make()->parentControl(admin_url('api/keywords/tree-list?parent_name=banner_address&has_owner=0'), 'address', __('admin.ads.address'), 'name', 'key')
|
||||
->size('md'),
|
||||
amis()->InputDatetimeRange()->label(__('admin.ads.published_at'))->name('published_at'),
|
||||
|
||||
amis()->SelectControl('enable', __('admin.ads.is_enable'))
|
||||
->options([
|
||||
1=>'开启',0=>'关闭'
|
||||
])
|
||||
->size('md'),
|
||||
amis()->InputDatetimeRange()->label(__('admin.created_at'))->name('created_at'),
|
||||
]))
|
||||
->columns([
|
||||
amis()->TableColumn('id', __('admin.ads.id'))->width('50px')->sortable(),
|
||||
amis()->TableColumn('address', __('admin.ads.address'))->type('mapping')
|
||||
|
|
|
|||
|
|
@ -7,10 +7,56 @@ use EloquentFilter\ModelFilter;
|
|||
class AdFilter extends ModelFilter
|
||||
{
|
||||
/**
|
||||
* 标题
|
||||
* 主键
|
||||
*/
|
||||
public function name($name)
|
||||
public function id($id)
|
||||
{
|
||||
return $this->where('name','like', '%'.$name.'%');
|
||||
return $this->where('id', $id);
|
||||
}
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
public function remark($remark)
|
||||
{
|
||||
return $this->where('remark','like', '%'.$remark.'%');
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
public function address($address)
|
||||
{
|
||||
return $this->where('address', $address);
|
||||
}
|
||||
public function publishedAt($publishedAt){
|
||||
$publishedAt = explode(',',$publishedAt);
|
||||
return $this->where(function($q) use ($publishedAt) {
|
||||
$startAt = Arr::get($publishedAt, 0) ?? null;
|
||||
$endAt = Arr::get($publishedAt, 1) ?? null;
|
||||
if(!empty($startAt)){
|
||||
$q->where('published_at', '>=', $startAt);
|
||||
}
|
||||
if(!empty($endAt)){
|
||||
$q->where('published_at', '<=', $endAt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function createdAt($createdAt){
|
||||
$createdAt = explode(',',$createdAt);
|
||||
return $this->where(function($q) use ($createdAt) {
|
||||
$startAt = Arr::get($createdAt, 0) ?? null;
|
||||
$endAt = Arr::get($createdAt, 1) ?? null;
|
||||
if(!empty($startAt)){
|
||||
$q->where('created_at', '>=', $startAt);
|
||||
}
|
||||
if(!empty($endAt)){
|
||||
$q->where('created_at', '<=', $endAt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function enable($enable){
|
||||
return $this->where('is_enable', $enable);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use Illuminate\Support\Arr;
|
|||
class ArticleFilter extends ModelFilter
|
||||
{
|
||||
/**
|
||||
* 标题
|
||||
* 主键
|
||||
*/
|
||||
public function id($id)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue