TransferDict.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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\pay;
  12. class TransferDict
  13. {
  14. public const WECHAT = 'wechatpay';//微信支付
  15. public const ALIPAY = 'alipay';//支付宝支付
  16. public const OFFLINE = 'offline';//线下转账
  17. public const BANK = 'bank';//银行卡转账
  18. //转账状态
  19. public const SUCCESS = 'success';//转账成功
  20. public const DEALING = 'dealing';//处理中
  21. public const WAIT = 'wait';//待转账
  22. public const FAIL = 'fail';//失败
  23. public static function getPayTypeByTransfer(string $type = '')
  24. {
  25. $list = [
  26. self::WECHAT => PayDict::WECHATPAY,
  27. self::ALIPAY => PayDict::ALIPAY,
  28. ];
  29. if (empty($type))
  30. return $list;
  31. return $list[$type];
  32. }
  33. /**
  34. * 支付类型
  35. * @return array
  36. */
  37. public static function getTransferType(array $types = [], $is_all = true)
  38. {
  39. $list = [
  40. self::WECHAT => [
  41. 'name' => get_lang('dict_transfer.type_wechat'),
  42. 'key' => self::WECHAT,
  43. 'is_online' => true
  44. ],//微信
  45. self::ALIPAY => [
  46. 'name' => get_lang('dict_transfer.type_ali'),
  47. 'key' => self::ALIPAY,
  48. 'is_online' => false
  49. ],//支付宝
  50. self::BANK => [
  51. 'name' => get_lang('dict_transfer.type_bank'),
  52. 'key' => self::BANK,
  53. 'is_online' => false
  54. ],//银行卡
  55. ];
  56. if ($is_all) {
  57. $list[self::OFFLINE] = [
  58. 'name' => get_lang('dict_transfer.type_offline'),
  59. 'key' => self::OFFLINE,
  60. 'is_online' => false
  61. ];
  62. }
  63. if (!empty($types)) {
  64. foreach ($list as $k => $v) {
  65. if (!in_array($k, $types)) {
  66. unset($list[$k]);
  67. }
  68. }
  69. }
  70. return $list;
  71. }
  72. /**
  73. * 获取状态
  74. * @return array
  75. */
  76. public static function getStatus()
  77. {
  78. return [
  79. self::WAIT => get_lang('dict_transfer.status_wait'),
  80. self::DEALING => get_lang('dict_transfer.status_dealing'),
  81. self::SUCCESS => get_lang('dict_transfer.status_success'),
  82. self::FAIL => get_lang('dict_transfer.status_fail'),
  83. ];
  84. }
  85. }