香洲二院小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mini_xzey/app/Http/Controllers/Dictionary/ItemController.php

52 lines
1.3 KiB

<?php
declare(strict_types = 1);
namespace App\Http\Controllers\Dictionary;
use App\Exceptions\GeneralException;
use App\Http\Logics\Dictionary\ItemLogic;
use App\Http\Resources\Dictionary\ItemDetailsResource;
use App\Http\Resources\Dictionary\ItemListsResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class ItemController
{
protected ItemLogic $item_logic;
/**
* Patient Construct.
*/
public function __construct()
{
$this->item_logic = new ItemLogic();
}
/**
* 获取列表
* @return JsonResponse
* @throws GeneralException
*/
public function lists(): JsonResponse
{
$response = $this->item_logic->getLists();
return jsonResponse(Response::HTTP_OK, 'success', ItemListsResource::make($response)->toArray());
}
/**
* 获取详情
* @param Request $request
* @param int $type_id
* @return JsonResponse
* @throws GeneralException
*/
public function details(Request $request, int $type_id): JsonResponse
{
$response = $this->item_logic->getDetails($type_id);
return jsonResponse(Response::HTTP_OK, 'success', ItemDetailsResource::make($response)->toArray());
}
}