// +---------------------------------------------------------------------- namespace App\Http\Controllers\Admin; use App\Services\Common\StoreCategoryService; /** * 商家分类管理-控制器 * @author laravel开发员 * @since 2020/11/11 * @package App\Http\Controllers */ class StoreCategoryController extends Backend { /** * 构造函数 * @author laravel开发员 * @since 2020/11/11 */ public function __construct() { parent::__construct(); $this->service = new StoreCategoryService(); } /** * 获取列表 * @return array */ public function index() { $pageSize = request()->get('limit', 15); $params = request()->all(); $params['store_id'] = $this->storeId; return $this->service->getDataList($params, $pageSize); } /** * 获取详情 * @return array */ public function info() { return $this->service->info(); } /** * 添加或编辑 * @return array */ public function edit() { if ($this->service->edit()) { return message($this->service->getError() ?: '操作成功', true); } else { return message($this->service->getError() ?: '操作失败', false); } } /** * 设置状态 * @return array */ public function status() { $params = request()->post(); if ($this->service->setStatus($params)) { return message($this->service->getError(), true); } else { return message($this->service->getError(), false); } } /** * 删除 * @return array */ public function delete() { return $this->service->delete(); } /** * 批量删除 * @return array */ public function deleteAll() { $params = request()->post(); if ($this->service->deleteAll($params)) { return message($this->service->getError(), true); } else { return message($this->service->getError(), false); } } /** * 选项列表(用于下拉选择) * @return array */ public function options() { return $this->service->options(); } }