This commit is contained in:
38
app/Constants/AbsConst.php
Normal file
38
app/Constants/AbsConst.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2024/3/6
|
||||
* Time: 11:08
|
||||
* Description:
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\AbstractConstants;
|
||||
use Hyperf\Constants\ConstantsCollector;
|
||||
|
||||
class AbsConst extends AbstractConstants
|
||||
{
|
||||
/**
|
||||
* 获取所有常量的键值对列表.
|
||||
*/
|
||||
public static function getConstantsList(): array
|
||||
{
|
||||
$class = static::class;
|
||||
$constants = ConstantsCollector::list();
|
||||
$list = [];
|
||||
if (isset($constants[$class])) {
|
||||
foreach ($constants[$class] as $name => $value) {
|
||||
// 确保获取的是当前常量对应的消息
|
||||
$message = $value['message'] ?? '';
|
||||
$list[] = [
|
||||
'label' => $message,
|
||||
'value' => $name,
|
||||
];
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
}
|
27
app/Constants/ActiveStatusConst.php
Normal file
27
app/Constants/ActiveStatusConst.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2024/3/15
|
||||
* Time: 11:13
|
||||
* Description:
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
|
||||
#[Constants]
|
||||
class ActiveStatusConst extends AbsConst
|
||||
{
|
||||
/**
|
||||
* @Message("禁用")
|
||||
*/
|
||||
public const int ACTIVE_DISABLE = 0;
|
||||
|
||||
/**
|
||||
* @Message("启用")
|
||||
*/
|
||||
public const int ACTIVE_ENABLE = 1;
|
||||
}
|
21
app/Constants/CompanyTypeConst.php
Normal file
21
app/Constants/CompanyTypeConst.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
|
||||
#[Constants]
|
||||
class CompanyTypeConst extends AbsConst
|
||||
{
|
||||
/**
|
||||
* @Message("开证公司")
|
||||
*/
|
||||
public const int ISSUING_COMPANY = 1;
|
||||
|
||||
/**
|
||||
* @Message("收货公司")
|
||||
*/
|
||||
public const int RECEIVING_COMPANY = 2;
|
||||
}
|
22
app/Constants/CustomerTypeConst.php
Normal file
22
app/Constants/CustomerTypeConst.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\AbstractConstants;
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
|
||||
#[Constants]
|
||||
class CustomerTypeConst extends AbstractConstants
|
||||
{
|
||||
/**
|
||||
* @Message("代理")
|
||||
*/
|
||||
public const int AGENT = 1;
|
||||
|
||||
/**
|
||||
* @Message("非代理")
|
||||
*/
|
||||
public const int NON_AGENT = 2;
|
||||
}
|
26
app/Constants/RoleTypeConst.php
Normal file
26
app/Constants/RoleTypeConst.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
|
||||
#[Constants]
|
||||
class RoleTypeConst extends AbsConst
|
||||
{
|
||||
/**
|
||||
* @Message("普通用户")
|
||||
*/
|
||||
const int NORMAL_USER = 0;
|
||||
|
||||
/**
|
||||
* @Message("管理员")
|
||||
*/
|
||||
const int ADMIN = 1;
|
||||
|
||||
/**
|
||||
* @Message("超级管理员")
|
||||
*/
|
||||
const int SUPER_ADMIN = 2;
|
||||
}
|
21
app/Constants/SourceConst.php
Executable file
21
app/Constants/SourceConst.php
Executable file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
|
||||
#[Constants]
|
||||
class SourceConst extends AbsConst
|
||||
{
|
||||
/**
|
||||
* @Message("管理后台")
|
||||
*/
|
||||
public const int SOURCE_PC = 1;
|
||||
|
||||
/**
|
||||
* @Message("手机端")
|
||||
*/
|
||||
public const int SOURCE_MOBILE = 2;
|
||||
}
|
21
app/Constants/UserTypeConst.php
Normal file
21
app/Constants/UserTypeConst.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
use Hyperf\Constants\Annotation\Constants;
|
||||
|
||||
#[Constants]
|
||||
class UserTypeConst extends AbsConst
|
||||
{
|
||||
/**
|
||||
* @Message("系统用户!")
|
||||
*/
|
||||
public const int SYSTEM_USER = 1;
|
||||
|
||||
/**
|
||||
* @Message("注册用户!")
|
||||
*/
|
||||
public const int REGISTER_USER = 2;
|
||||
}
|
Reference in New Issue
Block a user