PaymentRepositories.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace liuniu\repositories;
  3. use app\common\model\Lave;
  4. use app\common\model\LaveMonth;
  5. use app\common\model\OrderLevel;
  6. class PaymentRepositories
  7. {
  8. /**
  9. * 公众号下单成功之后
  10. * @param $order
  11. * @param $prepay_id
  12. */
  13. public static function wechatPaymentPrepare($order, $prepay_id)
  14. {
  15. }
  16. /**
  17. * 小程序下单成功之后
  18. * @param $order
  19. * @param $prepay_id
  20. */
  21. public static function wechatPaymentPrepareProgram($order, $prepay_id)
  22. {
  23. }
  24. /**
  25. * 使用余额支付订单时
  26. * @param $userInfo
  27. * @param $orderInfo
  28. */
  29. public static function yuePayProduct($userInfo, $orderInfo)
  30. {
  31. }
  32. /**
  33. * 订单支付成功之后
  34. * @param string|null $order_id 订单id
  35. * @return bool
  36. */
  37. public static function wechatProduct(string $order_id = null)
  38. {
  39. try {
  40. if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
  41. return StoreOrder::paySuccess($order_id);
  42. } catch (\Exception $e) {
  43. return false;
  44. }
  45. }
  46. /**
  47. * 捐款支付成功之后
  48. * @param string|null $order_id 订单id
  49. * @return bool
  50. */
  51. public static function wechatLave($event)
  52. {
  53. list($cid, $order_id) = $event;
  54. try {
  55. if (Lave::where(['cid' => $cid, 'order_id' => $order_id, 'paid' => 1])->find()) return true;
  56. return Lave::paySuccess($cid, $order_id);
  57. } catch (\Exception $e) {
  58. return false;
  59. }
  60. }
  61. /**
  62. * 捐款支付成功之后
  63. * @param string|null $order_id 订单id
  64. * @return bool
  65. */
  66. public static function wechatLevel($event)
  67. {
  68. list($cid, $order_id) = $event;
  69. try {
  70. if (OrderLevel::where(['cid' => $cid, 'order_id' => $order_id, 'paid' => 1])->find()) return true;
  71. return OrderLevel::paySuccess($cid, $order_id);
  72. } catch (\Exception $e) {
  73. return false;
  74. }
  75. }
  76. /**
  77. * 月捐款支付成功之后
  78. * @param string|null $order_id 订单id
  79. * @return bool
  80. */
  81. public static function wechatMonthLave($event)
  82. {
  83. list($cid, $order_id) = $event;
  84. try {
  85. if (LaveMonth::where(['cid' => $cid, 'contract_code' => $order_id, 'paid' => 1])->find()) return true;
  86. return LaveMonth::paySuccess($cid, $order_id);
  87. } catch (\Exception $e) {
  88. return false;
  89. }
  90. }
  91. /**
  92. * 月捐款申请扣款
  93. * @param string|null $order_id 订单id
  94. * @return bool
  95. */
  96. public static function wechatMonthLavePay($event)
  97. {
  98. list($cid, $order_id) = $event;
  99. try {
  100. if (LaveMonth::where(['cid' => $cid, 'nonce_str' => $order_id, 'paid' => 1])->find()) return true;
  101. return LaveMonth::pappayapplySuccess($cid, $order_id);
  102. } catch (\Exception $e) {
  103. return false;
  104. }
  105. }
  106. }