ActivityEnum.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\common\Enum;
  3. /**
  4. * 全局状态枚举
  5. */
  6. class ActivityEnum
  7. {
  8. // 活动状态
  9. const ACTIVITY_STATUS_NOT_STARTED = 1; // 未开始
  10. const ACTIVITY_STATUS_ONGOING = 2; // 进行中
  11. const ACTIVITY_STATUS_ENDED = 3; // 已结束
  12. const ACTIVITY_STATUS_CANCELLED = 4; // 已取消
  13. const ACTIVITY_STATUS_SUSPENDED = 5; // 已暂停
  14. const ACTIVITY_STATUS_CLOSED = 6; // 已关闭
  15. const ACTIVITY_STATUS_DELETED = 7; // 已删除
  16. const ACTIVITY_STATUS_EXPIRED = 8; // 已过期
  17. /**
  18. * 获取状态描述
  19. * @param int $status
  20. * @return string
  21. */
  22. public static function getActivityStatusText($status)
  23. {
  24. $map = self::getActivityStatusMap();
  25. return $map[$status] ?? '未知';
  26. }
  27. /**
  28. * 获取状态映射
  29. * @return array
  30. */
  31. public static function getActivityStatusMap()
  32. {
  33. return [
  34. self::ACTIVITY_STATUS_NOT_STARTED => '未开始',
  35. self::ACTIVITY_STATUS_ONGOING => '进行中',
  36. self::ACTIVITY_STATUS_ENDED => '已结束',
  37. self::ACTIVITY_STATUS_CANCELLED => '已取消',
  38. self::ACTIVITY_STATUS_SUSPENDED => '已暂停',
  39. self::ACTIVITY_STATUS_CLOSED => '已关闭',
  40. self::ACTIVITY_STATUS_DELETED => '已删除',
  41. self::ACTIVITY_STATUS_EXPIRED => '已过期',
  42. ];
  43. }
  44. }