RechargeOrderDict.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\dict\order;
  12. use app\dict\pay\PayDict;
  13. /**
  14. *充值订单相关枚举类
  15. * Class RechargeOrderDict
  16. * @package app\dict\order
  17. */
  18. class RechargeOrderDict
  19. {
  20. //订单状态
  21. //待支付
  22. const WAIT_PAY = 0;
  23. //已完成
  24. const FINISH = 10;
  25. //已关闭
  26. const CLOSE = -1;
  27. // 退款相关状态
  28. // 未申请
  29. const NOT_APPLAY = 0;
  30. // 退款中
  31. const REFUNDING = 1;
  32. // 退款完成
  33. const REFUND_COMPLETED = 2;
  34. // 退款失败
  35. const REFUND_FAIL = -1;
  36. /**
  37. * 当前订单支持的支付方式
  38. */
  39. const ALLOW_PAY = [
  40. PayDict::WECHATPAY,
  41. PayDict::ALIPAY,
  42. PayDict::OFFLINEPAY,
  43. ];
  44. /**
  45. * 订单类型以及名称
  46. * @return array
  47. */
  48. public static function getOrderType()
  49. {
  50. return [
  51. 'type' => 'recharge',
  52. 'name' => get_lang('dict_order.order_type_recharge')
  53. ];
  54. }
  55. public static function getStatus($status = '')
  56. {
  57. $data = [
  58. self::WAIT_PAY => [
  59. 'name' => '待支付',
  60. 'status' => self::WAIT_PAY,
  61. 'is_refund' => 0,
  62. 'action' => [],
  63. 'member_action' => [
  64. [
  65. 'name' => '支付',
  66. 'class' => '',
  67. 'params' => ''
  68. ],
  69. ],
  70. ],
  71. self::FINISH => [
  72. 'name' => '已完成',
  73. 'status' => self::FINISH,
  74. 'is_refund' => 0,
  75. 'action' => [],
  76. 'member_action' => [
  77. ],
  78. ],
  79. self::CLOSE => [
  80. 'name' => '已关闭',
  81. 'status' => self::CLOSE,
  82. 'is_refund' => 0,
  83. 'action' => [],
  84. 'member_action' => [
  85. ],
  86. ]
  87. ];
  88. if ($status == '') {
  89. return $data;
  90. }
  91. return $data[$status] ?? '';
  92. }
  93. /**
  94. * 获取退款状态
  95. * @param string $status
  96. * @return array|array[]|string
  97. */
  98. public static function getRefundStatus(string $status = '')
  99. {
  100. $data = [
  101. self::REFUNDING => [
  102. 'name' => get_lang('dict_order_refund.refunding'),
  103. 'status' => self::REFUNDING
  104. ],
  105. self::REFUND_COMPLETED => [
  106. 'name' => get_lang('dict_order_refund.refund_complete'),
  107. 'status' => self::REFUND_COMPLETED
  108. ],
  109. self::REFUND_FAIL => [
  110. 'name' => get_lang('dict_order_refund.refund_fail'),
  111. 'status' => self::REFUND_FAIL
  112. ]
  113. ];
  114. if ($status == '') {
  115. return $data;
  116. }
  117. return $data[$status] ?? '';
  118. }
  119. }