// +---------------------------------------------------------------------- namespace App\Services; use App\Models\ArticleCatesModel; use App\Models\GoodsCatesModel; /** * 商品分类管理-服务类 * @author wesmiler * @since 2020/11/11 * Class GoodsCatesService * @package App\Services */ class GoodsCatesService extends BaseService { /** * 构造函数 * @author wesmiler * @since 2020/11/11 * GoodsCatesService constructor. */ public function __construct() { $this->model = new GoodsCatesModel(); } /** * 获取列表 * @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; $datas = $this->model->where(['status'=> 1])->select(['id','pid','name','status'])->orderBy('sort','desc')->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 } }