PaymentRepositories.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace crmeb\repositories;
  3. use app\models\store\StoreOrder;
  4. use app\models\user\UserRecharge;
  5. /**
  6. * Class PaymentRepositories
  7. * @package crmeb\repositories
  8. */
  9. class PaymentRepositories
  10. {
  11. /**
  12. * 公众号下单成功之后
  13. * @param $order
  14. * @param $prepay_id
  15. */
  16. public static function wechatPaymentPrepare($order, $prepay_id)
  17. {
  18. }
  19. /**
  20. * 小程序下单成功之后
  21. * @param $order
  22. * @param $prepay_id
  23. */
  24. public static function wechatPaymentPrepareProgram($order, $prepay_id)
  25. {
  26. }
  27. /**
  28. * 使用余额支付订单时
  29. * @param $userInfo
  30. * @param $orderInfo
  31. */
  32. public static function yuePayProduct($userInfo, $orderInfo)
  33. {
  34. }
  35. /**
  36. * 订单支付成功之后
  37. * @param string|null $order_id 订单id
  38. * @return bool
  39. */
  40. public static function wechatProduct(string $order_id = null)
  41. {
  42. try {
  43. if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
  44. return StoreOrder::paySuccess($order_id);
  45. } catch (\Exception $e) {
  46. return false;
  47. }
  48. }
  49. /**
  50. * 充值成功后
  51. * @param string|null $order_id 订单id
  52. * @return bool
  53. */
  54. public static function wechatUserRecharge(string $order_id = null)
  55. {
  56. try {
  57. if (UserRecharge::be(['order_id' => $order_id, 'paid' => 1])) return true;
  58. return UserRecharge::rechargeSuccess($order_id);
  59. } catch (\Exception $e) {
  60. return false;
  61. }
  62. }
  63. }