PayEnum.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\common\enum;
  15. /**
  16. * 支付
  17. * Class PayrEnum
  18. * @package app\common\enum
  19. */
  20. class PayEnum
  21. {
  22. //支付类型
  23. const BALANCE_PAY = 1; //余额支付
  24. const WECHAT_PAY = 2; //微信支付
  25. const ALI_PAY = 3; //支付宝支付
  26. const WECHAT_NATIVE_PAY = 4; //微信扫码支付
  27. //支付状态
  28. const UNPAID = 0; //未支付
  29. const ISPAID = 1; //已支付
  30. //支付场景
  31. const SCENE_H5 = 1;//H5
  32. const SCENE_OA = 2;//微信公众号
  33. const SCENE_MNP = 3;//微信小程序
  34. const SCENE_APP = 4;//APP
  35. const SCENE_PC = 5;//PC商城
  36. /**
  37. * @notes 获取支付类型
  38. * @param bool $value
  39. * @return string|string[]
  40. * @author 段誉
  41. * @date 2023/2/23 15:36
  42. */
  43. public static function getPayDesc($value = true)
  44. {
  45. $data = [
  46. self::BALANCE_PAY => '余额支付',
  47. self::WECHAT_PAY => '微信支付',
  48. self::ALI_PAY => '支付宝支付',
  49. ];
  50. if ($value === true) {
  51. return $data;
  52. }
  53. return $data[$value] ?? '';
  54. }
  55. /**
  56. * @notes 支付状态
  57. * @param bool $value
  58. * @return string|string[]
  59. * @author 段誉
  60. * @date 2023/2/23 15:36
  61. */
  62. public static function getPayStatusDesc($value = true)
  63. {
  64. $data = [
  65. self::UNPAID => '未支付',
  66. self::ISPAID => '已支付',
  67. ];
  68. if ($value === true) {
  69. return $data;
  70. }
  71. return $data[$value] ?? '';
  72. }
  73. /**
  74. * @notes 支付场景
  75. * @param bool $value
  76. * @return string|string[]
  77. * @author 段誉
  78. * @date 2023/2/23 15:36
  79. */
  80. public static function getPaySceneDesc($value = true)
  81. {
  82. $data = [
  83. self::SCENE_H5 => 'H5',
  84. self::SCENE_OA => '微信公众号',
  85. self::SCENE_MNP => '微信小程序',
  86. self::SCENE_APP => 'APP',
  87. self::SCENE_PC => 'PC',
  88. ];
  89. if ($value === true) {
  90. return $data;
  91. }
  92. return $data[$value] ?? '';
  93. }
  94. }