54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
namespace App\Http\Controllers\Api;
|
|||
|
|
|
|||
|
|
use App\BaseApp\BaseController;
|
|||
|
|
use App\Service\business\ImageService;
|
|||
|
|
use Exception;
|
|||
|
|
use Illuminate\Http\JsonResponse;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 商品相册
|
|||
|
|
*/
|
|||
|
|
class ImageController extends BaseController
|
|||
|
|
{
|
|||
|
|
public function __construct()
|
|||
|
|
{
|
|||
|
|
parent::__construct();
|
|||
|
|
$this->service = ImageService::getInstance();
|
|||
|
|
$this->insertField = ['catalogue_id', 'url', 'type'];
|
|||
|
|
$this->updateField = ['id', 'url'];
|
|||
|
|
$this->notRequest = ['catalogue_id', 'type', 'status'];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 渲染图列表(入参 catalogue_id)
|
|||
|
|
* @Method GET
|
|||
|
|
*/
|
|||
|
|
public function renderGraph(): JsonResponse
|
|||
|
|
{
|
|||
|
|
return jok($this->service->renderGraph((int) request()->get('catalogue_id', 0)), '列表获取成功');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 实物图列表(入参 catalogue_id)
|
|||
|
|
* @Method GET
|
|||
|
|
*/
|
|||
|
|
public function physicalDrawing(): JsonResponse
|
|||
|
|
{
|
|||
|
|
return jok($this->service->physicalDrawing((int) request()->get('catalogue_id', 0)), '列表获取成功');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 启用 / 禁用
|
|||
|
|
* @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']), '操作成功');
|
|||
|
|
}
|
|||
|
|
}
|