select('id','global_order_id','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 false; }; $options = [ 'refund_desc' => '', 'notify_url' => config('site_host') . '/wechat/notify/wxpayrefund' ]; $result = $app->refund->byOutTradeNumber( $orderMain->global_order_id, $orderMain->global_order_id, $orderMain->money * 100, $orderMain->money * 100, $options ); $this->log->event('wx_pay_refund',$result); return $result; } }