ThirdPayService.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\api\service;
  3. class ThirdPayService extends BaseService
  4. {
  5. //256D40416947FAD6C41742179D5389466DC6E793
  6. private $wxService;
  7. public function __construct()
  8. {
  9. $this->wxService = new WxService();
  10. }
  11. // ali支付
  12. public function payAli($order)
  13. {
  14. return $this->ok("appid=sadasdaasfmkasklan&sign=sdfsdjkgsdnsvmklsas");
  15. }
  16. // 微信支付
  17. public function payWechat($platform, $openid, $order_no, $order_amount, $description = "购买服务")
  18. {
  19. switch ($platform) {
  20. case "app":
  21. return $this->wxService->appPay($openid, $order_no, $description, $order_amount);
  22. case "web":
  23. return $this->wxService->webPay($openid, $order_no, $description, $order_amount);
  24. case "applet":
  25. return $this->wxService->appletPay($openid, $order_no, $description, $order_amount);
  26. }
  27. return $this->fail("支付方式错误!");
  28. }
  29. public function refundByWx($platform, $order_no, $description, $order_amount, $refund_amount)
  30. {
  31. switch ($platform) {
  32. case "app":
  33. return $this->wxService->appRefund($order_no, $description, $order_amount, $refund_amount);
  34. case "web":
  35. return $this->wxService->webRefund($order_no, $description, $order_amount, $refund_amount);
  36. case "applet":
  37. return $this->wxService->appletRefund($order_no, $description, $order_amount, $refund_amount);
  38. }
  39. return $this->fail("支付方式错误!");
  40. }
  41. public function refundByAli($order)
  42. {
  43. return $this->ok(true);
  44. }
  45. }