weizong song 1 year ago
parent a97fd90675
commit 5d7d4804a9

@ -12,12 +12,17 @@ class PayCallbackController extends Controller
{
public function index()
{
//处理回调数据
$xml = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input");
Log::info($xml);
$array = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
$recharge = (new Recharge())->with("order")->where("serial", $array["out_trade_no"])->first();
$notify = new \NotifyPub($recharge->order->project_id);
Log::info($xml);
$pay = (new Recharge())->with("order")->where("serial", $array["out_trade_no"])->first();
if (!$pay) exit();
if ($pay->paid_at) exit();
Log::info($pay);
//开始处理业务
$notify = new \NotifyPub($pay->order->project_id);
//存储微信的回调
$notify->saveData($xml);
@ -38,11 +43,6 @@ class PayCallbackController extends Controller
if ($notify->data["return_code"] == "FAIL") {
exit();
}
$recharge_serial = $notify->data["out_trade_no"];
$pay = (new Recharge())->where("serial", $recharge_serial)->first();
if (!$pay) exit();
if ($pay->paid_at) exit();
$transaction_id = $notify->data["transaction_id"];
$update = [

Loading…
Cancel
Save