MemberLevelUpgradeTypeEnum.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace common\enums;
  3. /**
  4. * 会员升级类型
  5. *
  6. * Class MemberLevelUpgradeTypeEnum
  7. * @package common\enums
  8. * @author jianyan74 <751393839@qq.com>
  9. */
  10. class MemberLevelUpgradeTypeEnum extends BaseEnum
  11. {
  12. const CONSUMPTION_INTEGRAL = 1;
  13. const CONSUMPTION_MONEY = 2;
  14. const CONSUMPTION_GROWTH = 3;
  15. /**
  16. * @return array|string[]
  17. */
  18. public static function getMap(): array
  19. {
  20. return [
  21. self::CONSUMPTION_INTEGRAL => '累计积分',
  22. self::CONSUMPTION_MONEY => '累计消费金额',
  23. self::CONSUMPTION_GROWTH => '累计成长值',
  24. ];
  25. }
  26. /**
  27. * 等级对应字段
  28. *
  29. * @param $key
  30. * @return string
  31. */
  32. public static function getLevelFieldByKey($key): string
  33. {
  34. $map = [
  35. self::CONSUMPTION_INTEGRAL => 'integral',
  36. self::CONSUMPTION_MONEY => 'money',
  37. self::CONSUMPTION_GROWTH => 'growth',
  38. ];
  39. return $map[$key] ?? '';
  40. }
  41. /**
  42. * 账号对应字段
  43. *
  44. * @param $key
  45. * @return string
  46. */
  47. public static function getAccountFieldByKey($key): string
  48. {
  49. $map = [
  50. self::CONSUMPTION_INTEGRAL => 'accumulate_integral',
  51. self::CONSUMPTION_MONEY => 'consume_money',
  52. self::CONSUMPTION_GROWTH => 'accumulate_growth',
  53. ];
  54. return $map[$key] ?? '';
  55. }
  56. }
粤ICP备19079148号