PaymentRepositories.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace crmeb\repositories;
  3. use app\admin\model\vote\VoteOrder;
  4. use app\models\member\MemberCheck;
  5. use app\models\store\StoreOrder;
  6. use app\models\user\UserRecharge;
  7. /**
  8. * Class PaymentRepositories
  9. * @package crmeb\repositories
  10. */
  11. class PaymentRepositories
  12. {
  13. /**
  14. * 公众号下单成功之后
  15. * @param $order
  16. * @param $prepay_id
  17. */
  18. public static function wechatPaymentPrepare($order, $prepay_id)
  19. {
  20. }
  21. /**
  22. * 小程序下单成功之后
  23. * @param $order
  24. * @param $prepay_id
  25. */
  26. public static function wechatPaymentPrepareProgram($order, $prepay_id)
  27. {
  28. }
  29. /**
  30. * 使用余额支付订单时
  31. * @param $userInfo
  32. * @param $orderInfo
  33. */
  34. public static function yuePayProduct($userInfo, $orderInfo)
  35. {
  36. }
  37. /**
  38. * 订单支付成功之后
  39. * @param string|null $order_id 订单id
  40. * @return bool
  41. */
  42. public static function wechatProduct(string $order_id = null)
  43. {
  44. try {
  45. if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
  46. return StoreOrder::paySuccess($order_id);
  47. } catch (\Exception $e) {
  48. return false;
  49. }
  50. }
  51. /**
  52. * 订单支付成功之后
  53. * @param string|null $order_id 订单id
  54. * @return bool
  55. */
  56. public static function wechatMember(string $order_id = null)
  57. {
  58. try {
  59. if (MemberCheck::be(['order_id' => $order_id, 'paid' => 1])) return true;
  60. return MemberCheck::paySuccess($order_id);
  61. } catch (\Exception $e) {
  62. return false;
  63. }
  64. }
  65. /**
  66. * 订单支付成功之后
  67. * @param string|null $order_id 订单id
  68. * @return bool
  69. */
  70. public static function wechatVote(string $order_id = null)
  71. {
  72. try {
  73. if (VoteOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
  74. return VoteOrder::paySuccess($order_id);
  75. } catch (\Exception $e) {
  76. return false;
  77. }
  78. }
  79. /**
  80. * 充值成功后
  81. * @param string|null $order_id 订单id
  82. * @return bool
  83. */
  84. public static function wechatUserRecharge(string $order_id = null)
  85. {
  86. try {
  87. if (UserRecharge::be(['order_id' => $order_id, 'paid' => 1])) return true;
  88. return UserRecharge::rechargeSuccess($order_id);
  89. } catch (\Exception $e) {
  90. return false;
  91. }
  92. }
  93. }