PaymentRepositories.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace liuniu\repositories;
  3. use app\common\model\Lave;
  4. use app\common\model\OrderLevel;
  5. class PaymentRepositories
  6. {
  7. /**
  8. * 公众号下单成功之后
  9. * @param $order
  10. * @param $prepay_id
  11. */
  12. public static function wechatPaymentPrepare($order, $prepay_id)
  13. {
  14. }
  15. /**
  16. * 小程序下单成功之后
  17. * @param $order
  18. * @param $prepay_id
  19. */
  20. public static function wechatPaymentPrepareProgram($order, $prepay_id)
  21. {
  22. }
  23. /**
  24. * 使用余额支付订单时
  25. * @param $userInfo
  26. * @param $orderInfo
  27. */
  28. public static function yuePayProduct($userInfo, $orderInfo)
  29. {
  30. }
  31. /**
  32. * 订单支付成功之后
  33. * @param string|null $order_id 订单id
  34. * @return bool
  35. */
  36. public static function wechatProduct(string $order_id = null)
  37. {
  38. try {
  39. if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
  40. return StoreOrder::paySuccess($order_id);
  41. } catch (\Exception $e) {
  42. return false;
  43. }
  44. }
  45. /**
  46. * 捐款支付成功之后
  47. * @param string|null $order_id 订单id
  48. * @return bool
  49. */
  50. public static function wechatLave($event)
  51. {
  52. list($cid,$order_id) = $event;
  53. try {
  54. if (Lave::where(['cid'=>$cid,'order_id' => $order_id, 'paid' => 1])->find()) return true;
  55. return Lave::paySuccess($cid,$order_id);
  56. } catch (\Exception $e) {
  57. return false;
  58. }
  59. }
  60. /**
  61. * 捐款支付成功之后
  62. * @param string|null $order_id 订单id
  63. * @return bool
  64. */
  65. public static function wechatLevel($event)
  66. {
  67. list($cid,$order_id) = $event;
  68. try {
  69. if (OrderLevel::where(['cid'=>$cid,'order_id' => $order_id, 'paid' => 1])->find()) return true;
  70. return OrderLevel::paySuccess($cid,$order_id);
  71. } catch (\Exception $e) {
  72. return false;
  73. }
  74. }
  75. }