// +---------------------------------------------------------------------- namespace App\Services; use App\Models\ArticleCatesModel; /** * 文章分类管理-服务类 * @author wesmiler * @since 2020/11/11 * Class ArticleCatesService * @package App\Services */ class ArticleCatesService extends BaseService { /** * 构造函数 * @author wesmiler * @since 2020/11/11 * ArticleCatesService constructor. */ public function __construct() { $this->model = new ArticleCatesModel(); } /** * 获取列表 * @return array * @since 2020/11/11 * @author wesmiler */ public function getList() { $params = request()->all(); return parent::getList(); } /** * 获取分类选项列表 * @param int $num * @return array */ public function getOptions(){ $params = request()->all(); $num = isset($params['num'])? $params['num'] : 0; $type = isset($params['type'])? $params['type'] : 0; $where = ['status'=>1]; if($type>0){ $where['type'] = $type; } $datas = $this->model->where($where) ->select(['id','pid','name','status']) ->orderBy('sort','asc') ->limit($num? $num : 999999) ->get(); return message(MESSAGE_OK, true, $datas); } /** * 添加或编辑 * @return array * @since 2020/11/11 * @author wesmiler */ public function edit() { $data = request()->all(); $data['update_time'] = time(); return parent::edit($data); // TODO: Change the autogenerated stub } }