Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
zds-s committed Jan 19, 2024
1 parent e26fe5c commit b43d29d
Show file tree
Hide file tree
Showing 100 changed files with 1,030 additions and 801 deletions.
17 changes: 10 additions & 7 deletions api/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
use Mine\Exception\TokenException;
use Mine\Helper\MineCode;
use Mine\MineApi;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\SimpleCache\InvalidArgumentException;

/**
* Class ApiController.
Expand All @@ -50,8 +53,8 @@ class ApiController extends MineApi

/**
* 初始化.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function __init()
{
Expand All @@ -64,9 +67,9 @@ protected function __init()

/**
* 获取accessToken.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws InvalidArgumentException
*/
#[PostMapping('v1/getAccessToken')]
public function getAccessToken(): ResponseInterface
Expand All @@ -77,8 +80,8 @@ public function getAccessToken(): ResponseInterface

/**
* v1 版本.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping('v1/{method}')]
#[Middlewares([VerifyInterfaceMiddleware::class])]
Expand Down
14 changes: 8 additions & 6 deletions api/ApiDocController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
use Mine\Annotation\Api\MApiCollector;
use Mine\Helper\MineCode;
use Mine\MineApi;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
Expand All @@ -46,8 +48,8 @@ class ApiDocController extends MineApi

/**
* 登录文档.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PostMapping('login')]
public function login(): ResponseInterface
Expand All @@ -68,8 +70,8 @@ public function login(): ResponseInterface

/**
* 通过app id获取接口数据.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[GetMapping('getAppAndInterfaceList/{id}')]
public function getAppAndInterfaceList(string $id): ResponseInterface
Expand All @@ -86,8 +88,8 @@ public function getAppAndInterfaceList(string $id): ResponseInterface
}

/**
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[GetMapping('getColumnList/{id}')]
public function getColumnList(string $id): ResponseInterface
Expand Down
6 changes: 4 additions & 2 deletions api/Listener/ApiLogListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use Mine\Event\ApiAfter;
use Mine\Helper\Str;
use Mine\MineRequest;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

/**
* API访问日志保存.
Expand All @@ -39,8 +41,8 @@ public function listen(): array

/**
* 事件处理.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function process(object $event): void
{
Expand Down
7 changes: 4 additions & 3 deletions api/Middleware/VerifyInterfaceMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\SimpleCache\InvalidArgumentException;

class VerifyInterfaceMiddleware implements MiddlewareInterface
{
Expand All @@ -53,7 +54,7 @@ class VerifyInterfaceMiddleware implements MiddlewareInterface
* 验证检查接口.
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
Expand All @@ -64,7 +65,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
* 访问接口鉴权处理.
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
protected function auth(ServerRequestInterface $request): int
{
Expand Down Expand Up @@ -169,7 +170,7 @@ protected function apiModelCheck($request): ServerRequestInterface
* 运行.
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
protected function run(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
Expand Down
12 changes: 8 additions & 4 deletions api/Middleware/VerifyParamsMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@

namespace Api\Middleware;

use App\System\Service\SystemApiService;
use Mine\Annotation\Api\MApi;
use PhpOffice\PhpSpreadsheet\Writer\Exception;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
Expand All @@ -31,16 +35,16 @@ class VerifyParamsMiddleware implements MiddlewareInterface
{
/**
* 验证接口参数.
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws Exception
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$apiData = $request->getParsedBody()['apiData'];
$requestData = $this->getRequestData($request, $apiData);

$columns = container()->get(\App\System\Service\SystemApiService::class)
$columns = container()->get(SystemApiService::class)
->getColumnListByApiId((string) $apiData['id'])['api_column'];

// todo...
Expand Down
9 changes: 6 additions & 3 deletions app/Setting/Controller/CommonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use Hyperf\HttpServer\Annotation\GetMapping;
use Mine\Annotation\Auth;
use Mine\MineController;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
* setting 公共方法控制器
Expand All @@ -26,11 +29,11 @@ class CommonController extends MineController
{
/**
* 返回模块信息及表前缀
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[GetMapping('getModuleList')]
public function getModuleList(): \Psr\Http\Message\ResponseInterface
public function getModuleList(): ResponseInterface
{
return $this->success($this->mine->getModuleInfo());
}
Expand Down
22 changes: 12 additions & 10 deletions app/Setting/Controller/Modules/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
use Mine\Annotation\OperationLog;
use Mine\Annotation\Permission;
use Mine\MineController;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
Expand All @@ -38,8 +40,8 @@ class ModuleController extends MineController

/**
* 本地模块列表.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[GetMapping('index'), Permission('setting:module, setting:module:index')]
public function index(): ResponseInterface
Expand All @@ -49,8 +51,8 @@ public function index(): ResponseInterface

/**
* 新增本地模块.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PutMapping('save'), Permission('setting:module:save'), OperationLog]
public function save(ModuleRequest $request): ResponseInterface
Expand All @@ -61,8 +63,8 @@ public function save(ModuleRequest $request): ResponseInterface

/**
* 启停用模块.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PostMapping('modifyStatus'), Permission('setting:module:status'), OperationLog]
public function modifyStatus(ModuleRequest $request): ResponseInterface
Expand All @@ -72,8 +74,8 @@ public function modifyStatus(ModuleRequest $request): ResponseInterface

/**
* 安装模块.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PutMapping('install'), Permission('setting:module:install'), OperationLog]
public function install(): ResponseInterface
Expand All @@ -83,8 +85,8 @@ public function install(): ResponseInterface

/**
* 卸载删除模块.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws \Throwable
*/
#[DeleteMapping('delete'), Permission('setting:module:delete'), OperationLog]
Expand Down
26 changes: 14 additions & 12 deletions app/Setting/Controller/Settings/SystemConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
use Mine\Annotation\Permission;
use Mine\Annotation\RemoteState;
use Mine\MineController;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
Expand All @@ -38,8 +40,8 @@ class SystemConfigController extends MineController

/**
* 获取配置列表.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[GetMapping('index'), Permission('setting:config, setting:config:index')]
public function index(): ResponseInterface
Expand All @@ -49,8 +51,8 @@ public function index(): ResponseInterface

/**
* 保存配置.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PostMapping('save'), Permission('setting:config:save'), OperationLog]
public function save(SettingConfigRequest $request): ResponseInterface
Expand All @@ -60,8 +62,8 @@ public function save(SettingConfigRequest $request): ResponseInterface

/**
* 更新配置.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PostMapping('update'), Permission('setting:config:update'), OperationLog]
public function update(SettingConfigRequest $request): ResponseInterface
Expand All @@ -71,8 +73,8 @@ public function update(SettingConfigRequest $request): ResponseInterface

/**
* 按 keys 更新配置.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PostMapping('updateByKeys'), Permission('setting:config:update'), OperationLog]
public function updateByKeys(): ResponseInterface
Expand All @@ -82,8 +84,8 @@ public function updateByKeys(): ResponseInterface

/**
* 删除配置.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[DeleteMapping('delete'), Permission('setting:config:delete'), OperationLog]
public function delete(): ResponseInterface
Expand All @@ -93,8 +95,8 @@ public function delete(): ResponseInterface

/**
* 清除配置缓存.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PostMapping('clearCache'), Permission('setting:config:clearCache'), OperationLog]
public function clearCache(): ResponseInterface
Expand Down
18 changes: 10 additions & 8 deletions app/Setting/Controller/Settings/SystemConfigGroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
use Mine\Annotation\Permission;
use Mine\Annotation\RemoteState;
use Mine\MineController;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
Expand All @@ -38,8 +40,8 @@ class SystemConfigGroupController extends MineController

/**
* 获取系统组配置.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[GetMapping('index'), Permission('setting:config, setting:config:index')]
public function index(): ResponseInterface
Expand All @@ -49,8 +51,8 @@ public function index(): ResponseInterface

/**
* 保存配置组.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PostMapping('save'), Permission('setting:config:save'), OperationLog('保存配置组')]
public function save(SettingConfigGroupRequest $request): ResponseInterface
Expand All @@ -60,8 +62,8 @@ public function save(SettingConfigGroupRequest $request): ResponseInterface

/**
* 更新配置组.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[PostMapping('update'), Permission('setting:config:update'), OperationLog('更新配置组')]
public function update(SettingConfigGroupRequest $request): ResponseInterface
Expand All @@ -71,8 +73,8 @@ public function update(SettingConfigGroupRequest $request): ResponseInterface

/**
* 删除配置组.
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[DeleteMapping('delete'), Permission('setting:config:delete'), OperationLog('删除配置组')]
public function delete(): ResponseInterface
Expand Down
Loading

0 comments on commit b43d29d

Please sign in to comment.