香洲二院小程序
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/Logics/Dictionary/ItemLogic.php

61 lines
1.6 KiB

<?php
declare(strict_types = 1);
namespace App\Http\Logics\Dictionary;
use App\Exceptions\GeneralException;
use App\Services\HisHttp\Client;
use App\Utils\Traits\Logger;
use App\Utils\Traits\MiniProgramAuth;
use App\Utils\Traits\UniversalEncryption;
use Illuminate\Auth\AuthenticationException;
use Symfony\Component\HttpFoundation\Response;
class ItemLogic
{
use Logger;
use MiniProgramAuth;
use UniversalEncryption;
private Client $his_client;
/**
* ItemLogic Construct
* @throws AuthenticationException
*/
public function __construct()
{
$this->authInitialize();
$this->his_client = app('HisHttpService');
}
/**
* 列表
* @throws GeneralException
*/
public function getLists()
{
$response = $this->his_client->getDictionaryLists();
if (!isset($response['RESULTCODE']) || $response['RESULTCODE'] !== '0') {
throw new GeneralException($response['ERRORMSG'] ?? '找不到缴费项目分类列表!', Response::HTTP_SERVICE_UNAVAILABLE);
}
return $response;
}
/**
* 详情
* @param int $type_id
* @return array
* @throws GeneralException
*/
public function getDetails(int $type_id): array
{
$response = $this->his_client->getDictionaryDetails($type_id);
if (!isset($response['RESULTCODE']) || $response['RESULTCODE'] !== '0') {
throw new GeneralException($response['ERRORMSG'] ?? '找不到缴费项目分类详情!', Response::HTTP_SERVICE_UNAVAILABLE);
}
return $response;
}
}