feat : config
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Middleware\Api\JwtAuthMiddleware;
|
||||
use App\Service\Api\System\CityListService;
|
||||
use App\Service\Api\System\MiniWxConfigService;
|
||||
use App\Service\Api\System\SiteListService;
|
||||
use App\Service\Api\System\SystemConfigService;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\Middlewares;
|
||||
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||
@@ -32,10 +33,17 @@ class SystemController extends AbstractController
|
||||
return (new CityListService)->handle();
|
||||
}
|
||||
|
||||
#[RequestMapping(path: 'mini_wx/config',methods: 'GET')]
|
||||
#[RequestMapping(path: 'mini_wx/about_us',methods: 'GET')]
|
||||
#[Scene(scene: 'mini_wx_config')]
|
||||
public function getMiniWxConfig()
|
||||
{
|
||||
return (new MiniWxConfigService)->handle();
|
||||
}
|
||||
|
||||
#[RequestMapping(path: 'config',methods: 'GET')]
|
||||
#[Scene(scene: 'config')]
|
||||
public function systemConfig()
|
||||
{
|
||||
return (new SystemConfigService)->handle();
|
||||
}
|
||||
}
|
||||
|
||||
42
app/Service/Api/System/SystemConfigService.php
Normal file
42
app/Service/Api/System/SystemConfigService.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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),
|
||||
];
|
||||
|
||||
return $this->return->success('success', $res);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user