ソースを参照

完善支付的流程

jace 6 年 前
コミット
1814d52d0e

+ 10 - 0
normandcrm/crm/backend/modules/user/controllers/PayController.php

@@ -108,6 +108,16 @@ class PayController extends BaseController
                           exit;
                        }
                     }
+                    if($data['payType'] == 18){
+                        if($result['code']==200){
+                            $url = $result['pay_url'];
+                            header("location:$url");
+                            exit;
+                         }else{
+                            echo $result['error'];
+                            exit;
+                         }
+                     }
                     return $result['html'];
                 } else {
                     throw new BadRequestHttpException('支付异常');

+ 3 - 16
normandcrm/service/common/pay/globalpay/PayHandler.php

@@ -59,10 +59,10 @@ class PayHandler extends BasePayHandler
         $result = PayUtils::send($data, $this->payUrl);
         if (isset($result["code"]) && $result["code"] == 200) { 
             $order_id = $result["data"]["orderId"]; 
-            $pay_url = $this->confirmUrl.$order_id; 
-            return PayHandler::createGetHtml($pay_url);
+            $result['pay_url'] = $this->confirmUrl.$order_id; 
+            return $result;
         }else{
-            return $result['error'];
+            return $result;
         }
         
     }
@@ -141,17 +141,4 @@ class PayHandler extends BasePayHandler
 
     }
 
-
-            // 生成html模板文件
-    public static function createGetHtml($url)
-    {
-        $html = <<<eot
-        <div style="border: 1px solid green;width:800px;height: 350px;margin:10% auto;text-align: center;border-radius:30px;padding-top:70px; ">
-        <p>请求成功,支付链接如下:</p>
-        <p><a href="{$url}">点击跳转支付页面</a></p>
-        </div>
-eot;
-
-        return $html;
-    }
 }