OrderPayController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\admin\controller\notify;
  3. use support\Log;
  4. use support\Request;
  5. use Yansongda\Pay\Pay;
  6. class OrderPayController
  7. {
  8. public function wxpay(Request $request)
  9. {
  10. Log::channel('pay')->info("WXPAY_NOTIFY_REPLY", $request->all());
  11. try {
  12. // $config = config('payment.wxpay');
  13. // $config['notify_url'] = getenv('NOTIFY_DOMAIN_ADMIN').'/notify/orderPay/wxpay';
  14. // Pay::wechat($config)->success()->send();
  15. echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
  16. }catch (\Exception $e){
  17. Log::channel('pay')->info("WXPAY_NOTIFY_REPLY_FAIL", ['msg'=>"回复失败"]);
  18. }
  19. }
  20. public function alipay(Request $request)
  21. {
  22. Log::channel('pay')->info("ALIPAY_NOTIFY_REPLY", $request->all());
  23. try {
  24. // $config = config('payment.alipay');
  25. // $config['notify_url'] = getenv('NOTIFY_DOMAIN_ADMIN').'/notify/orderPay/alipay';
  26. // Pay::alipay($config)->success()->send();
  27. header('Content-type: application/json');
  28. echo json_encode(['code' => '200', 'msg' => 'success']);
  29. }catch (\Exception $e){
  30. Log::channel('pay')->info("ALIPAY_NOTIFY_REPLY_FAIL", ['msg'=>"回复失败"]);
  31. }
  32. }
  33. }