Files
hyperf_service/app/Service/Api/System/SystemConfigService.php
2025-03-26 16:55:31 +08:00

44 lines
1.1 KiB
PHP

<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Api\System;
use App\Cache\Redis\Common\ConfigCache;
use App\Constants\ConfigCode;
use App\Service\Api\BaseService;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class SystemConfigService extends BaseService
{
/**
* @var ConfigCache
*/
#[Inject]
protected ConfigCache $configCache;
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function handle(): array
{
$res = [
'logo' => $this->configCache->getConfigValueByKey(ConfigCode::APP_LOGO),
'sundry_unit_price' => $this->configCache->getConfigValueByKey(ConfigCode::SUNDRY_UNIT_PRICE),
'today_cut_off_time' => $this->configCache->getConfigValueByKey(ConfigCode::TODAY_CUT_OFF_TIME_KEY),
];
return $this->return->success('success', $res);
}
}