CouponDict.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的多应用管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace addon\mall\app\dict\coupon;
  12. class CouponDict
  13. {
  14. //未开始
  15. const WAIT_START = 0;
  16. //进行中
  17. const NORMAL = 1;
  18. //已过期
  19. const EXPIRE = 2;
  20. //已失效
  21. const INVALID = 3;
  22. //通用券
  23. const ALL = 1;
  24. //店铺品类券
  25. const CATEGORY = 2;
  26. //商品券
  27. const GOODS = 3;
  28. //品牌券
  29. const BRAND = 4;
  30. //平台品类券
  31. const MALL_CATEGORY = 5;
  32. const USER = 1;
  33. const GRANT = 2;
  34. //所有店铺参与
  35. const ALL_SITE_JOIN = 0;
  36. //指定店铺参与
  37. const NOT_ALL_SITE_JOIN = 1;
  38. /**
  39. * 优惠券类型
  40. * @param string $type
  41. * @return array|mixed|string
  42. */
  43. public static function getType($type = ''){
  44. $list = [
  45. self::ALL => get_lang('dict_mall_coupon.all'),
  46. self::CATEGORY => get_lang('dict_mall_coupon.category'),
  47. self::GOODS => get_lang('dict_mall_coupon.goods'),
  48. self::BRAND => get_lang('dict_mall_coupon.brand'),
  49. self::MALL_CATEGORY => get_lang('dict_mall_coupon.category'),
  50. ];
  51. if ($type == '') return $list;
  52. return $list[$type] ?? '';
  53. }
  54. /**
  55. * 领取优惠券类型
  56. * @param string $type
  57. * @return array|mixed|string
  58. */
  59. public static function getReceiveType($type = ''){
  60. $list = [
  61. self::USER => get_lang('dict_mall_coupon.user'),
  62. self::GRANT => get_lang('dict_mall_coupon.grant'),
  63. ];
  64. if ($type == '') return $list;
  65. return $list[$type] ?? '';
  66. }
  67. /**
  68. * 优惠券活动状态
  69. * @param $status
  70. * @return array|mixed|string
  71. */
  72. public static function getStatus($status = ''){
  73. $list = [
  74. self::WAIT_START => get_lang('dict_mall_coupon.wait_start'),
  75. self::NORMAL => get_lang('dict_mall_coupon.normal'),
  76. self::EXPIRE => get_lang('dict_mall_coupon.expire'),
  77. self::INVALID => get_lang('dict_mall_coupon.invalid'),
  78. ];
  79. if ($status == '') return $list;
  80. return $list[$status] ?? '';
  81. }
  82. }