PaymentRepositories.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 aliProduct(string $order_id = null)
  55. {
  56. try {
  57. if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
  58. return StoreOrder::paySuccess($order_id, 'ali');
  59. } catch (\Exception $e) {
  60. return false;
  61. }
  62. }
  63. /**
  64. * 充值成功后
  65. * @param string|null $order_id 订单id
  66. * @return bool
  67. */
  68. public static function wechatUserRecharge(string $order_id = null)
  69. {
  70. try {
  71. if (UserRecharge::be(['order_id' => $order_id, 'paid' => 1])) return true;
  72. return UserRecharge::rechargeSuccess($order_id);
  73. } catch (\Exception $e) {
  74. return false;
  75. }
  76. }
  77. /**
  78. * 充值成功后
  79. * @param string|null $order_id 订单id
  80. * @return bool
  81. */
  82. public static function aliUserRecharge(string $order_id = null)
  83. {
  84. try {
  85. if (UserRecharge::be(['order_id' => $order_id, 'paid' => 1])) return true;
  86. return UserRecharge::rechargeSuccess($order_id);
  87. } catch (\Exception $e) {
  88. return false;
  89. }
  90. }
  91. }