verify(); } else { $data = $alipay->callback(); } $this->getPaymentByTradeNo($data->out_trade_no); //设置支付完成 if ($this->payment) { $this->payment->paid(); $this->payment->order->pay(); } return $alipay->success(); } public function wechat() { $wechat = Pay::wechat(); if (config('payment.version', 2) == 2) { $data = $wechat->verify(); $this->getPaymentByTradeNo($data->out_trade_no); } else { $data = $wechat->callback(); $this->getPaymentByTradeNo($data->resource['ciphertext']['out_trade_no']); } //设置支付完成 if ($this->payment) { $this->payment->paid(); $this->payment->order->pay(); } return $wechat->success(); } public function getPaymentByTradeNo($tradeNo) { $this->payment = Payment::where('trade_id', $tradeNo)->first(); } }