mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 21:37:50 +08:00
first commit
This commit is contained in:
19
app/Constants/AdminCode.php
Normal file
19
app/Constants/AdminCode.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
use Hyperf\Constants\Annotation\Message;
|
||||
use Hyperf\Constants\EnumConstantsTrait;
|
||||
|
||||
#[Constants]
|
||||
final class AdminCode extends ResultCode
|
||||
{
|
||||
#[Message("登录失败")]
|
||||
public const int LOGIN_ERROR = 10001;
|
||||
|
||||
#[Message("验证已过期")]
|
||||
public const int LOGIN_TOKEN_ERROR = 10002;
|
||||
}
|
||||
25
app/Constants/ErrorCode.php
Normal file
25
app/Constants/ErrorCode.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\AbstractConstants;
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
|
||||
#[Constants]
|
||||
class ErrorCode extends AbstractConstants
|
||||
{
|
||||
/**
|
||||
* @Message("Server Error!")
|
||||
*/
|
||||
public const SERVER_ERROR = 500;
|
||||
}
|
||||
32
app/Constants/Model/AdminUser/AdminMenuStatusCode.php
Normal file
32
app/Constants/Model/AdminUser/AdminMenuStatusCode.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants\Model\AdminUser;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
use Hyperf\Constants\Annotation\Message;
|
||||
use Hyperf\Constants\EnumConstantsTrait;
|
||||
|
||||
#[Constants]
|
||||
enum AdminMenuStatusCode: int
|
||||
{
|
||||
use EnumConstantsTrait;
|
||||
|
||||
|
||||
#[Message('正常')]
|
||||
case Normal = 1;
|
||||
|
||||
#[Message('停用')]
|
||||
case DISABLE = 2;
|
||||
|
||||
public function isNormal(): bool
|
||||
{
|
||||
return $this === self::Normal;
|
||||
}
|
||||
|
||||
public function isDisable(): bool
|
||||
{
|
||||
return $this === self::DISABLE;
|
||||
}
|
||||
}
|
||||
32
app/Constants/Model/AdminUser/AdminRoleStatusCode.php
Normal file
32
app/Constants/Model/AdminUser/AdminRoleStatusCode.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants\Model\AdminUser;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
use Hyperf\Constants\Annotation\Message;
|
||||
use Hyperf\Constants\EnumConstantsTrait;
|
||||
|
||||
#[Constants]
|
||||
enum AdminRoleStatusCode: int
|
||||
{
|
||||
use EnumConstantsTrait;
|
||||
|
||||
|
||||
#[Message('正常')]
|
||||
case Normal = 1;
|
||||
|
||||
#[Message('停用')]
|
||||
case DISABLE = 2;
|
||||
|
||||
public function isNormal(): bool
|
||||
{
|
||||
return $this === self::Normal;
|
||||
}
|
||||
|
||||
public function isDisable(): bool
|
||||
{
|
||||
return $this === self::DISABLE;
|
||||
}
|
||||
}
|
||||
31
app/Constants/Model/AdminUser/AdminUserStatusCode.php
Normal file
31
app/Constants/Model/AdminUser/AdminUserStatusCode.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants\Model\AdminUser;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
use Hyperf\Constants\Annotation\Message;
|
||||
use Hyperf\Constants\EnumConstantsTrait;
|
||||
|
||||
#[Constants]
|
||||
enum AdminUserStatusCode: int
|
||||
{
|
||||
use EnumConstantsTrait;
|
||||
|
||||
#[Message('正常')]
|
||||
case Normal = 1;
|
||||
|
||||
#[Message('停用')]
|
||||
case DISABLE = 2;
|
||||
|
||||
public function isNormal(): bool
|
||||
{
|
||||
return $this === self::Normal;
|
||||
}
|
||||
|
||||
public function isDisable(): bool
|
||||
{
|
||||
return $this === self::DISABLE;
|
||||
}
|
||||
}
|
||||
21
app/Constants/Model/AdminUser/AdminUserTypeCode.php
Normal file
21
app/Constants/Model/AdminUser/AdminUserTypeCode.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants\Model\AdminUser;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
use Hyperf\Constants\Annotation\Message;
|
||||
use Hyperf\Constants\EnumConstantsTrait;
|
||||
|
||||
#[Constants]
|
||||
enum AdminUserTypeCode: int
|
||||
{
|
||||
use EnumConstantsTrait;
|
||||
|
||||
#[Message('系统用户')]
|
||||
case SYSTEM = 100;
|
||||
|
||||
#[Message('普通用户')]
|
||||
case USER = 200;
|
||||
}
|
||||
22
app/Constants/ResultCode.php
Normal file
22
app/Constants/ResultCode.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\AbstractConstants;
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
use Hyperf\Constants\Annotation\Message;
|
||||
use Hyperf\Constants\EnumConstantsTrait;
|
||||
|
||||
#[Constants]
|
||||
class ResultCode extends AbstractConstants
|
||||
{
|
||||
use EnumConstantsTrait;
|
||||
|
||||
#[Message("success")]
|
||||
final public const int SUCCESS = 0;
|
||||
|
||||
#[Message("failed")]
|
||||
final public const int ERROR = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user