123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace app\common\Enum;
- /**
- * 全局状态枚举
- */
- class ActivityEnum
- {
- // 活动状态
- const ACTIVITY_STATUS_NOT_STARTED = 1; // 未开始
- const ACTIVITY_STATUS_ONGOING = 2; // 进行中
- const ACTIVITY_STATUS_ENDED = 3; // 已结束
- const ACTIVITY_STATUS_CANCELLED = 4; // 已取消
- const ACTIVITY_STATUS_SUSPENDED = 5; // 已暂停
- const ACTIVITY_STATUS_CLOSED = 6; // 已关闭
- const ACTIVITY_STATUS_DELETED = 7; // 已删除
- const ACTIVITY_STATUS_EXPIRED = 8; // 已过期
- /**
- * 获取状态描述
- * @param int $status
- * @return string
- */
- public static function getActivityStatusText($status)
- {
- $map = self::getActivityStatusMap();
- return $map[$status] ?? '未知';
- }
- /**
- * 获取状态映射
- * @return array
- */
- public static function getActivityStatusMap()
- {
- return [
- self::ACTIVITY_STATUS_NOT_STARTED => '未开始',
- self::ACTIVITY_STATUS_ONGOING => '进行中',
- self::ACTIVITY_STATUS_ENDED => '已结束',
- self::ACTIVITY_STATUS_CANCELLED => '已取消',
- self::ACTIVITY_STATUS_SUSPENDED => '已暂停',
- self::ACTIVITY_STATUS_CLOSED => '已关闭',
- self::ACTIVITY_STATUS_DELETED => '已删除',
- self::ACTIVITY_STATUS_EXPIRED => '已过期',
- ];
- }
- }
|