Files
hyperf_service/app/Controller/Api/UserController.php
2025-03-28 09:52:06 +08:00

118 lines
2.9 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Controller\Api;
use App\Controller\AbstractController;
use App\Middleware\Api\JwtAuthMiddleware;
use App\Request\Api\UserRequest;
use App\Service\Api\Login\LogOutService;
use App\Service\Api\User\BindPhoneByWxService;
use App\Service\Api\User\InviteListService;
use App\Service\Api\User\MyPageService;
use App\Service\Api\User\SiteService;
use App\Service\Api\User\UnBindPhoneService;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\Middlewares;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\Validation\Annotation\Scene;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
#[Controller(prefix: 'api/user')]
#[Middlewares([
JwtAuthMiddleware::class,
])]
class UserController extends AbstractController
{
/**
* @param UserRequest $request
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: 'bind_phone/wx_code',methods: 'post')]
#[Scene(scene: 'bind_phone_wx')]
public function bind_phone_by_wx_code(UserRequest $request)
{
return (new BindPhoneByWxService)->handle();
}
/**
* @return array
*/
#[RequestMapping(path: 'unbind_phone',methods: 'post')]
#[Scene(scene: 'unbind_phone')]
public function unbind_phone()
{
return (new UnBindPhoneService)->handle();
}
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: 'site/list',methods: 'GET')]
#[Scene(scene: 'site_list')]
public function userSiteList()
{
return (new SiteService)->handle();
}
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: 'site/add',methods: 'post')]
#[Scene(scene: 'add_site')]
public function addSite()
{
return (new SiteService)->add();
}
/**
* @return array
*/
#[RequestMapping(path: 'site/del',methods: 'post')]
#[Scene(scene: 'del_site')]
public function delSite()
{
return (new SiteService)->del();
}
/**
* @return array
*/
#[RequestMapping(path: 'invite/list',methods: 'GET')]
#[Scene(scene: 'invite_list')]
public function inviteList()
{
return (new InviteListService)->handle();
}
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: 'logOut',methods: 'GET')]
#[Scene(scene: 'logOut')]
public function logOut()
{
return (new LogOutService)->handle();
}
/**
* @return array
*/
#[RequestMapping(path: 'myPage',methods: 'GET')]
#[Scene(scene: 'myPage')]
public function myPage()
{
return (new MyPageService)->handle();
}
}