Files
hyperf_service/app/Controller/Api/SystemController.php
2025-08-06 15:10:12 +08:00

98 lines
2.7 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Controller\Api;
use App\Controller\AbstractController;
use App\Middleware\Api\JwtAuthMiddleware;
use App\Service\Api\System\AliStsService;
use App\Service\Api\System\CityListService;
use App\Service\Api\System\GetLeaderboardService;
use App\Service\Api\System\MiniWxConfigService;
use App\Service\Api\System\SiteListService;
use App\Service\Api\System\SystemConfigService;
use App\Service\Api\System\TestService;
use App\Service\Api\User\IndexService;
use DateMalformedStringException;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\Validation\Annotation\Scene;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
#[Controller(prefix: 'api/system')]
class SystemController extends AbstractController
{
#[RequestMapping(path: 'site/search_list',methods: 'POST')]
#[Scene(scene: 'search_list')]
public function searchSiteList()
{
return (new SiteListService)->handle();
}
#[RequestMapping(path: 'city',methods: 'GET')]
#[Scene(scene: 'city')]
public function getCityList()
{
return (new CityListService)->handle();
}
#[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();
}
#[RequestMapping(path: 'index',methods: 'GET')]
#[Scene(scene: 'index')]
#[Middleware(JwtAuthMiddleware::class)]
public function index(): array
{
return (new IndexService)->handle();
}
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "sts/accredit", methods: "GET")]
#[Scene(scene: 'sts_accredit')]
#[Middleware(JwtAuthMiddleware::class)]
public function aliSts()
{
return (new AliStsService)->handle();
}
/**
* @return array|null
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws DateMalformedStringException
*/
#[RequestMapping(path: "leaderboard", methods: "GET")]
#[Scene(scene: 'leaderboard')]
#[Middleware(JwtAuthMiddleware::class)]
public function getLeaderboardHistory()
{
return (new GetLeaderboardService)->handle();
}
#[RequestMapping(path: "test", methods: "GET")]
public function test()
{
return (new TestService)->handle();
}
}