36 lines
870 B
PHP
36 lines
870 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\BaseApp\BaseController;
|
|
use App\Service\business\CategoryService;
|
|
use Exception;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
/**
|
|
* 商品分类
|
|
*/
|
|
class CategoryController extends BaseController
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->service = CategoryService::getInstance();
|
|
$this->insertField = ['name'];
|
|
$this->updateField = ['id', 'name'];
|
|
$this->notRequest = ['url', 'pid', 'status', 'sort'];
|
|
}
|
|
|
|
/**
|
|
* 启用 / 禁用
|
|
* @Method POST
|
|
* @throws Exception
|
|
*/
|
|
public function status(): JsonResponse
|
|
{
|
|
$this->insertField = ['id', 'status'];
|
|
$params = $this->checkRequiredFields(request()->post());
|
|
return jok($this->service->status($params['id'], $params['status']), '操作成功');
|
|
}
|
|
}
|