PayDict.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 PayDict
  13. {
  14. //上传方式 图片
  15. public const WECHATPAY = 'wechatpay';//微信支付
  16. //上传方式 视频
  17. public const ALIPAY = 'alipay';//支付宝支付
  18. //const UNIPAY = 'unipay';//银联
  19. public const OFFLINEPAY = 'offlinepay';//线下支付
  20. public const BALANCEPAY = 'balancepay';//余额支付
  21. public const FRIENDSPAY = 'friendspay';//找朋友帮忙付
  22. public const ON = '1';
  23. public const OFF = '0';
  24. //图标根目录
  25. public const PAY_ICON_PATH = 'static' . '/' . 'resource' . '/' . 'icon' . '/' . 'pay_icon' . '/';
  26. public const WECHATPAY_ICON = self::PAY_ICON_PATH . 'wechatpay.png';//微信支付
  27. //上传方式 视频
  28. public const ALIPAY_ICON = self::PAY_ICON_PATH . 'alipay.png';//支付宝支付
  29. public const BALANCEPAY_ICON = self::PAY_ICON_PATH . 'balancepay.png';//余额支付
  30. public const OFFLINEPAY_ICON = self::PAY_ICON_PATH . 'offlinepay.png';//线下支付
  31. public const FRIENDSPAY_ICON = self::PAY_ICON_PATH . 'friendspay.png';//找朋友帮忙付
  32. //支付状态
  33. public const STATUS_WAIT = '0';//待支付
  34. public const STATUS_ING = '1';//支付中
  35. public const STATUS_FINISH = '2';//已支付
  36. public const STATUS_AUDIT = '3';//待审核
  37. public const STATUS_CANCLE = '-1';//已取消
  38. public const MEMBER = 'member';
  39. public const USER = 'user';
  40. public const SITE = 'site';
  41. /**
  42. * 支付类型
  43. * @return array
  44. */
  45. public static function getPayType(array $types = [])
  46. {
  47. $list = [
  48. // 微信支付
  49. self::WECHATPAY => [
  50. 'name' => get_lang('dict_pay.type_wechatpay'),
  51. 'key' => self::WECHATPAY,
  52. 'icon' => self::WECHATPAY_ICON,
  53. 'setting_component' => '/src/app/views/setting/components/pay-wechatpay.vue',
  54. 'encrypt_params' => [ 'mch_public_cert_path', 'mch_secret_cert', 'mch_secret_key', 'wechat_public_cert_path' ],
  55. ],
  56. // 支付宝支付
  57. self::ALIPAY => [
  58. 'name' => get_lang('dict_pay.type_alipay'),
  59. 'key' => self::ALIPAY,
  60. 'icon' => self::ALIPAY_ICON,
  61. 'setting_component' => '/src/app/views/setting/components/pay-alipay.vue',
  62. 'encrypt_params' => [ 'app_secret_cert', 'app_public_cert_path', 'alipay_public_cert_path', 'alipay_root_cert_path' ],
  63. ],
  64. // 余额支付
  65. self::BALANCEPAY => [
  66. 'name' => get_lang('dict_pay.type_balancepay'),
  67. 'key' => self::BALANCEPAY,
  68. 'icon' => self::BALANCEPAY_ICON,
  69. 'setting_component' => '',
  70. 'encrypt_params' => [ 'secret_key' ],
  71. ],
  72. // 找朋友帮忙付
  73. self::FRIENDSPAY => [
  74. 'name' => get_lang('dict_pay.type_friendspay'),
  75. 'key' => self::FRIENDSPAY,
  76. 'icon' => self::FRIENDSPAY_ICON,
  77. 'setting_component' => '/src/app/views/setting/components/pay-friendspay.vue',
  78. 'encrypt_params' => [],
  79. ],
  80. ];
  81. $list = array_merge($list, ...event('PayType'));
  82. if (!empty($types)) {
  83. foreach ($list as $k => $v) {
  84. if (!in_array($k, $types)) {
  85. unset($list[ $k ]);
  86. }
  87. }
  88. }
  89. return $list;
  90. }
  91. /**
  92. * 获取状态
  93. * @return array
  94. */
  95. public static function getStatus()
  96. {
  97. return [
  98. self::STATUS_WAIT => get_lang('dict_pay.status_wait'),
  99. self::STATUS_ING => get_lang('dict_pay.status_ing'),
  100. self::STATUS_FINISH => get_lang('dict_pay.status_finish'),
  101. self::STATUS_CANCLE => get_lang('dict_pay.status_cancle'),
  102. self::STATUS_AUDIT => get_lang('dict_pay.status_audit')
  103. ];
  104. }
  105. }