PaywayConst.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * PaywayConst.php UTF-8
  4. * 支付方式常量
  5. *
  6. * @date : 2018/4/28 16:28
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huolib\constant;
  13. class PaywayConst {
  14. CONST PAYWAY_ALIPAY = 'alipay'; //官方支付宝
  15. CONST PAYWAY_WXPAY = 'wxpay'; //微信支付
  16. CONST PAYWAY_SHENGPAY = 'shengpay'; //盛付通支付
  17. CONST PAYWAY_PTBPAY = 'ptbpay'; //平台币支付
  18. CONST PAYWAY_GAMEPAY = 'gamepay'; //游戏币支付
  19. CONST PAYWAY_WXPAYQR = 'wxpayqr'; //微信扫码支付
  20. CONST PAYWAY_WXPAYH5 = 'wxpayh5'; //微信H5
  21. CONST PAYWAY_WXPAYJS = 'wxpayjs'; //微信内支付
  22. CONST PAYWAY_WXPAYMP = 'wxpaymp'; //微信小程序支付
  23. CONST PAYWAY_ALIPAYQR = 'alipayqr'; //支付宝扫码
  24. CONST PAYWAY_ALIPAYH5 = 'alipayh5'; //支付宝H5
  25. CONST PAYWAY_BALANCE = 'balance'; //钱包余额支付
  26. CONST PAYWAY_APPLE = 'applepay'; /* 苹果支付 */
  27. CONST PAYWAY_APPLE_TEST = 'applepaytest'; /* 苹果沙盒支付 */
  28. CONST PAYWAY_BANK = 'bank'; /* 银行卡转账 */
  29. CONST PAYWAY_MPAY = 'mpay'; /* 米大师支付 */
  30. CONST PAYWAY_MPAY_TEST = 'mpaytest'; /* 米大师沙盒支付 */
  31. CONST PAYWAY_ALIPAYXY = 'alipayxy'; //支付宝协议支付
  32. /**
  33. * @param $type
  34. * @param bool $all
  35. *
  36. * @return array|bool|mixed
  37. */
  38. public static function getMsg($type, $all = false) {
  39. $_msg = array(
  40. self::PAYWAY_ALIPAY => '支付宝',
  41. self::PAYWAY_WXPAY => '微信',
  42. self::PAYWAY_SHENGPAY => '盛付通',
  43. self::PAYWAY_PTBPAY => '平台币',
  44. self::PAYWAY_GAMEPAY => '游戏币',
  45. self::PAYWAY_WXPAYQR => '微信扫码',
  46. self::PAYWAY_WXPAYH5 => '微信H5',
  47. self::PAYWAY_WXPAYJS => '微信内支付',
  48. self::PAYWAY_ALIPAYQR => '支付宝扫码',
  49. self::PAYWAY_ALIPAYH5 => '支付宝H5',
  50. self::PAYWAY_BALANCE => '余额支付',
  51. self::PAYWAY_APPLE => '苹果支付',
  52. self::PAYWAY_APPLE_TEST => '苹果沙盒支付',
  53. );
  54. if (true == $all) {
  55. return $_msg;
  56. }
  57. if (!isset($_msg[$type])) {
  58. return false;
  59. }
  60. return $_msg[$type];
  61. }
  62. /**
  63. * 获取所有支付
  64. *
  65. * @param bool $inc
  66. *
  67. * @return array
  68. */
  69. public static function getPayways($inc = false) {
  70. $_types = self::getMsg(null, true);
  71. if (true == $inc) {
  72. $_default = ["0" => "选择类型"];
  73. $_types = $_default + $_types;
  74. }
  75. return $_types;
  76. }
  77. }