72 lines
1.8 KiB
PHP
72 lines
1.8 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\User\BindPhoneByWxService;
|
|
use App\Service\Api\User\SiteService;
|
|
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
|
|
* @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();
|
|
}
|
|
}
|