WithdrawEnum.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LikeShop有特色的全开源社交分销电商系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 商业用途务必购买系统授权,以免引起不必要的法律纠纷
  7. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  8. // | 微信公众号:好象科技
  9. // | 访问官网:http://www.likemarket.net
  10. // | 访问社区:http://bbs.likemarket.net
  11. // | 访问手册:http://doc.likemarket.net
  12. // | 好象科技开发团队 版权所有 拥有最终解释权
  13. // +----------------------------------------------------------------------
  14. // | Author: LikeShopTeam
  15. // +----------------------------------------------------------------------
  16. namespace app\common\enum;
  17. /**
  18. * 提现枚举
  19. * Class WithdrawEnum
  20. * @package app\common\enum
  21. */
  22. class WithdrawEnum
  23. {
  24. /**
  25. * 默认值
  26. */
  27. const DEFAULT_MIN_MONEY = 0;
  28. const DEFAULT_MAX_MONEY = 100;
  29. const DEFAULT_PERCENTAGE = 10;
  30. const DEFAULT_TYPE = [self::TYPE_BALANCE];
  31. /**
  32. * 提现类型
  33. */
  34. const TYPE_BALANCE = 1; //余额
  35. const TYPE_WECHAT_CHANGE = 2; //微信零钱
  36. const TYPE_WECHAT_CODE = 4; //微信收款码
  37. const TYPE_ALI_CODE = 5; //阿里收款码
  38. const TYPE_BANK = 3; //银行卡
  39. /**
  40. * 提现状态
  41. */
  42. const STATUS_WAIT = 1;
  43. const STATUS_ING = 2;
  44. const STATUS_SUCCESS = 3;
  45. const STATUS_FAIL = 4;
  46. /**
  47. * 微信零钱提现方式
  48. */
  49. const ENTERPRISE = 1;//企业付款到零钱
  50. const MERCHANT = 2;//商家转账到零钱
  51. //提现到微信零钱 是否待收款
  52. static function wechatChangeIsWaitReceive($data)
  53. {
  54. return intval($data['status'] == self::STATUS_ING && $data['type'] == self::TYPE_WECHAT_CHANGE);
  55. }
  56. /**
  57. * @notes 获取提现类型描述
  58. * @param $type
  59. * @param false $flag
  60. * @return string|string[]
  61. * @author Tab
  62. * @date 2021/8/6 16:56
  63. */
  64. public static function getTypeDesc($type, $flag = false)
  65. {
  66. $desc = [
  67. self::TYPE_BALANCE => '钱包余额',
  68. self::TYPE_WECHAT_CHANGE => '微信零钱',
  69. self::TYPE_WECHAT_CODE => '微信收款码',
  70. self::TYPE_ALI_CODE => '支付宝收款码',
  71. self::TYPE_BANK => '银行卡',
  72. ];
  73. if($flag) {
  74. return $desc;
  75. }
  76. return $desc[$type] ?? '';
  77. }
  78. /**
  79. * @notes 获取状态描述
  80. * @param $status
  81. * @param false $flag
  82. * @return string|string[]
  83. * @author Tab
  84. * @date 2021/8/6 18:50
  85. */
  86. public static function getStatusDesc($status, $flag = false, $data = [])
  87. {
  88. $desc = [
  89. self::STATUS_WAIT => '待提现',
  90. self::STATUS_ING => '提现中',
  91. self::STATUS_SUCCESS => '提现成功',
  92. self::STATUS_FAIL => '提现失败',
  93. ];
  94. if (isset($data['type']) && $data['type'] == static::TYPE_WECHAT_CHANGE) {
  95. $desc[self::STATUS_ING] = '待收款';
  96. }
  97. if($flag) {
  98. return $desc;
  99. }
  100. return $desc[$status] ?? '';
  101. }
  102. }