|
|
@@ -59,4 +59,39 @@ class ArticleCateService extends BaseService
|
|
|
$data = request()->all();
|
|
|
return parent::edit($data); // TODO: Change the autogenerated stub
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 选项
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function options()
|
|
|
+ {
|
|
|
+ // 获取参数
|
|
|
+ $param = request()->all();
|
|
|
+ // 用户ID
|
|
|
+ $keyword = getter($param, "keyword");
|
|
|
+ $parentId = getter($param, "parent_id");
|
|
|
+ $id = getter($param, "id");
|
|
|
+ $datas = $this->model->where(function($query) use($parentId){
|
|
|
+ if($parentId){
|
|
|
+ $query->where(['id'=> $parentId,'mark'=>1]);
|
|
|
+ }else{
|
|
|
+ $query->where(['status'=> 1,'mark'=>1]);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ->where(function($query) use($id){
|
|
|
+ if($id){
|
|
|
+ $query->whereNotIn('id', [$id]);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ->where(function($query) use($keyword){
|
|
|
+ if($keyword){
|
|
|
+ $query->where('name','like',"%{$keyword}%")->orWhere('code','like',"%{$keyword}%");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ->select(['id','name','status'])
|
|
|
+ ->get();
|
|
|
+
|
|
|
+ return $datas? $datas->toArray() : [];
|
|
|
+ }
|
|
|
}
|