|
@@ -299,11 +299,17 @@ class GoodsCategoryService extends BaseService
|
|
|
public function options()
|
|
public function options()
|
|
|
{
|
|
{
|
|
|
$type = request()->post('type',0);
|
|
$type = request()->post('type',0);
|
|
|
|
|
+ $kw = request()->post('kw','');
|
|
|
$map = ['type'=>$type,'status'=>1,'mark'=>1];
|
|
$map = ['type'=>$type,'status'=>1,'mark'=>1];
|
|
|
if($type<=0){
|
|
if($type<=0){
|
|
|
unset($map['type']);
|
|
unset($map['type']);
|
|
|
}
|
|
}
|
|
|
$list = $this->model->where($map)
|
|
$list = $this->model->where($map)
|
|
|
|
|
+ ->where(function ($query) use($kw){
|
|
|
|
|
+ if($kw){
|
|
|
|
|
+ $query->where('name','like',"%{$kw}%");
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
->orderBy('sort', 'desc')
|
|
->orderBy('sort', 'desc')
|
|
|
->orderBy('id', 'asc')
|
|
->orderBy('id', 'asc')
|
|
|
->select(['id', 'name','type', 'pid', 'icon'])
|
|
->select(['id', 'name','type', 'pid', 'icon'])
|