From 812ffb67e783f1740abb52ee75b79285b96ee695 Mon Sep 17 00:00:00 2001 From: Rico Date: Sat, 23 Nov 2019 20:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AFhandle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Gateway/YMQ.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Services/Gateway/YMQ.php b/app/Services/Gateway/YMQ.php index 60b9346e..1513d4ac 100644 --- a/app/Services/Gateway/YMQ.php +++ b/app/Services/Gateway/YMQ.php @@ -93,8 +93,13 @@ class YMQ extends AbstractPayment $data['sign'] = $this->sign($params); $contents = utf8_encode($this->post($data)); $result = json_decode($contents,true); - return json_encode(['code' => $result['code'], "msg"=>$result['msg'],'url' => $result['data']['qr'], 'pid' => $data['out_order_sn'], - "pay_way"=>$type,"expire_in"=>$result['data']['expire_in']]); + if (array_key_exists('data', $result)){ + return json_encode(['code' => $result['code'], "msg"=>$result['msg'],'url' => $result['data']['qr'], 'pid' => $data['out_order_sn'], + "pay_way"=>$type,"expire_in"=>$result['data']['expire_in']]); + }else{ + return json_encode(['code' => $result['code'], "msg"=>$result['msg'], 'pid' => $data['out_order_sn']]); + } + //$result = json_decode($this->post($data), true); //$result['pid'] = $pl->tradeno; //return json_encode($result);