LuckyDrawEnum.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\common\enum;
  20. /**
  21. * 幸运抽奖枚举
  22. */
  23. class LuckyDrawEnum
  24. {
  25. const NOT_WIN = 0;
  26. const INTEGRAL = 1;
  27. const COUPON = 2;
  28. const BALANCE = 3;
  29. const GOODS = 4;
  30. const WAIT = 0;
  31. const ING = 1;
  32. const END = 2;
  33. /**
  34. * 所有奖品类型
  35. */
  36. const PRIZE_TYPE = [
  37. self::NOT_WIN,
  38. self::INTEGRAL,
  39. self::COUPON,
  40. self::BALANCE,
  41. self::GOODS,
  42. ];
  43. /**
  44. * 中奖奖品类型
  45. */
  46. const WIN_PRIZE_TYPE = [
  47. self::INTEGRAL,
  48. self::COUPON,
  49. self::BALANCE,
  50. self::GOODS,
  51. ];
  52. /**
  53. * @notes 获取奖品类型描述
  54. * @param null $prizeType
  55. * @return string|string[]
  56. * @author Tab
  57. * @date 2021/11/24 9:44
  58. */
  59. public static function getPrizeTypeDesc($prizeType = null)
  60. {
  61. $desc = [
  62. self::NOT_WIN => '未中奖',
  63. self::GOODS => '商品',
  64. self::INTEGRAL => '积分',
  65. self::COUPON => '优惠券',
  66. self::BALANCE => '余额',
  67. ];
  68. if (is_null($prizeType)) {
  69. return $desc;
  70. }
  71. return $desc[$prizeType] ?? '';
  72. }
  73. /**
  74. * @notes 获取状态描述
  75. * @param null $status
  76. * @return string|string[]
  77. * @author Tab
  78. * @date 2021/11/24 14:02
  79. */
  80. public static function getStatusDesc($status = null)
  81. {
  82. $desc = [
  83. self::WAIT => '未开始',
  84. self::ING => '进行中',
  85. self::END => '已结束',
  86. ];
  87. if (is_null($status)) {
  88. return $desc;
  89. }
  90. return $desc[$status] ?? '';
  91. }
  92. }