This commit is contained in:
30
app/Constants/ReturnCode.php
Normal file
30
app/Constants/ReturnCode.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
use Hyperf\Constants\Annotation\Message;
|
||||
use Hyperf\Constants\EnumConstantsTrait;
|
||||
|
||||
#[Constants]
|
||||
enum ReturnCode: int
|
||||
{
|
||||
use EnumConstantsTrait;
|
||||
|
||||
#[Message("Server Error!")]
|
||||
case SERVER_ERROR = 500;
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*/
|
||||
#[Message('return success')]
|
||||
case SUCCESS = 0;
|
||||
|
||||
/**
|
||||
* 返回失败
|
||||
*/
|
||||
#[Message('return fail')]
|
||||
case ERROR = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user