Index.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\admin\controller\pay;
  3. use app\admin\controller\BaseController;
  4. use support\Redis;
  5. use support\Request;
  6. use app\admin\server\payment\TonglianPayment;
  7. use app\admin\server\payment\UnionOrder;
  8. class Index extends BaseController
  9. {
  10. /**
  11. * Notes:通联退款
  12. * @return \support\Response
  13. * User: ycp
  14. * Date: 2023/3/28
  15. */
  16. public function refund()
  17. {
  18. $order_don = $this->request->post('order_don');//订单号
  19. $info = UnionOrder::getOrderInfo2($order_don);
  20. if(empty($info))
  21. {
  22. throw new \Exception('订单不存在');
  23. }
  24. if($info['order_status'] != 5)
  25. {
  26. throw new \Exception('该订单状态不允许退款');
  27. }
  28. $result = TonglianPayment::refund($info['order_price']*100, $order_don);
  29. if($result['trxstatus'] == '0000')
  30. {
  31. UnionOrder::updateRefund($order_don);
  32. }
  33. return json_success($result);
  34. }
  35. }