xieruidong 2 years ago
parent
commit
dfa3a435d4
1 changed files with 13 additions and 2 deletions
  1. 13 2
      application/common/service/PayReturnService.php

+ 13 - 2
application/common/service/PayReturnService.php

@@ -24,16 +24,24 @@ class PayReturnService{
    }
    public function wechat(){
         $payed=Service::checkNotify('wechat');
+        $data=$payed?$payed->verify():[];
+        $this->setPayNo($data['transaction_id']??null);
         return [
             $payed!==false,
             'success'
         ];
    }
+   protected function setPayNo($no){
+        $this->payment->pay_no=$no;
+        $this->payment->save();
+   }
     public function returnUrl(){
         return request()->root(true);
     }
    public function alipay(){
        $payed=Service::checkNotify('alipay');
+       $data=$payed?$payed->verify():[];
+       $this->setPayNo($data['trade_no']??null);
        return [
            $payed!==false,
            'success'
@@ -44,11 +52,14 @@ class PayReturnService{
         $postData=input();
         $isPay=AcpService::validate($_POST);
         $queryPay=UnionQuery::query($postData['orderId'],$this->payment->create_time);
-        user_log('PayReturnService.bankUnion',compact('isPay','queryPay'));
-        return [
+        $res=[
             $isPay && $queryPay,
             'success'
         ];
+        if($res[0]){
+            $this->setPayNo($postData['queryId']);
+        }
+        return $res;
    }
    public function otherUser(){}
    public function offline(){}