| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Http\Controllers\Admin;
- use App\Services\Common\GoodsCategoryService;
- /**
- * 商品分类管理-控制器
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Http\Controllers
- */
- class GoodsCategoryController extends Backend
- {
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- */
- public function __construct()
- {
- parent::__construct();
- $this->service = new GoodsCategoryService();
- }
- /**
- * 获取列表
- * @return array
- */
- public function index()
- {
- $pageSize = request()->get('limit', 15);
- $params = request()->all();
- 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();
- }
- }
|