CouponEnum.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. class CouponEnum
  21. {
  22. // 使用条件
  23. const CONDITION_TYPE_NOT = 1; //无门槛
  24. const CONDITION_TYPE_FULL = 2; //需订单满足金额
  25. const CONDITION_TYPE_DISCOUNT = 3; //折扣券
  26. // 发放数量限制
  27. const SEND_TOTAL_TYPE_NOT = 1; // 无限数量
  28. const SEND_TOTAL_TYPE_FIXED = 2; // 固定数量
  29. // 用券时间
  30. const USE_TIME_TYPE_FIXED = 1; //固定时间
  31. const USE_TIME_TYPE_TODAY = 2; //当日起多少天内
  32. const USE_TIME_TYPE_TOMORROW = 3; //次日起多少天内
  33. // 领取方式
  34. const GET_TYPE_USER = 1; //买家领取
  35. const GET_TYPE_STORE = 2; //商家发放
  36. // 领取数量限制
  37. const GET_NUM_TYPE_NOT = 1; //不限制
  38. const GET_NUM_TYPE_LIMIT = 2; //限制张数
  39. const GET_NUM_TYPE_DAY = 3; //每天限制张数
  40. // 允许使用商品
  41. const USE_GOODS_TYPE_NOT = 1; //不限制
  42. const USE_GOODS_TYPE_ALLOW = 2; //允许商品
  43. const USE_GOODS_TYPE_BAN = 3; //禁止商品
  44. const USE_GOODS_TYPE_CATEGORY = 4; //指定分类
  45. // 优惠券状态
  46. const COUPON_STATUS_NOT = 1; //未开始
  47. const COUPON_STATUS_CONDUCT = 2; //进行中
  48. const COUPON_STATUS_END = 3; //已结束
  49. // 使用状态
  50. const USE_STATUS_NOT = 0; //未使用
  51. const USE_STATUS_OK = 1; //已使用
  52. const USE_STATUS_EXPIRE = 2; //已过期
  53. const USE_STATUS_VOID = 3; //已作废
  54. static function getUseGoodsTypeDesc($value = true)
  55. {
  56. $data = [
  57. self::USE_GOODS_TYPE_NOT => '全场通用',
  58. self::USE_GOODS_TYPE_ALLOW => '指定商品可用',
  59. self::USE_GOODS_TYPE_BAN => '指定商品不可用',
  60. self::USE_GOODS_TYPE_CATEGORY => '指定分类可用',
  61. ];
  62. if ($value === true) {
  63. return $data;
  64. }
  65. return $data[$value];
  66. }
  67. /**
  68. * @notes 领取方式
  69. * @param bool $value
  70. * @return array|mixed
  71. * @author 张无忌
  72. * @date 2021/7/20 17:36
  73. */
  74. public static function getTypeDesc($value = true)
  75. {
  76. $data = [
  77. self::GET_TYPE_USER => '买家领取',
  78. self::GET_TYPE_STORE => '卖家发放'
  79. ];
  80. if ($value === true) {
  81. return $data;
  82. }
  83. return $data[$value];
  84. }
  85. /**
  86. * @notes 优惠券状态
  87. * @param bool $value
  88. * @return array|mixed
  89. * @author 张无忌
  90. * @date 2021/7/20 17:55
  91. */
  92. public static function getCouponStatusDesc($value = true)
  93. {
  94. $data = [
  95. self::COUPON_STATUS_NOT => '未开始',
  96. self::COUPON_STATUS_CONDUCT => '进行中',
  97. self::COUPON_STATUS_END => '已结束'
  98. ];
  99. if ($value === true) {
  100. return $data;
  101. }
  102. return $data[$value];
  103. }
  104. /**
  105. * @notes 优惠券使用状态
  106. * @param bool $value
  107. * @return array|mixed
  108. * @author 张无忌
  109. * @date 2021/7/21 17:03
  110. */
  111. public static function getUseStatusDesc($value = true)
  112. {
  113. $data = [
  114. self::USE_STATUS_NOT => '未使用',
  115. self::USE_STATUS_OK => '已使用',
  116. self::USE_STATUS_EXPIRE => '已过期',
  117. self::USE_STATUS_VOID => '已作废'
  118. ];
  119. if ($value === true) {
  120. return $data;
  121. }
  122. return $data[$value];
  123. }
  124. }