0, 'msg' => '退款成功' ]; // 查询订单 $orderMain = OrderMain::query() ->select('id','code','order_num','money','state') ->where('global_order_id',$global_order_id) ->where('pay_type',OrderMain::ORDER_PAY_WX) ->where(Db::raw('refund_time is null')) ->first(); if(empty($orderMain)){ return ['status'=>1, 'msg'=>'订单不存在或已退款']; } $optional = []; $result = $app->refund->byOutTradeNumber( $orderMain->code, $orderMain->code, $orderMain->money * 100, $orderMain->money * 100, $optional ); return $result; } }