544782275@qq.com 2 years ago
parent
commit
f2aa4895c4
2 changed files with 19 additions and 22 deletions
  1. 2 5
      application/api/controller/Recharge.php
  2. 17 17
      application/common/library/Shande.php

+ 2 - 5
application/api/controller/Recharge.php

@@ -25,9 +25,7 @@ class Recharge extends BaseController
             return json(Response::fail($check));
         }
         $user=$this->userInfo;
-        if(empty($user['bank_no'])){
-            return json(Response::fail('请先实名认证'));
-        }
+        DB::startTrans();
         $log=UserChargeLog::create([
             'user_id'=>$user['id'],
             'amount'=>$data['amount'],
@@ -43,8 +41,7 @@ class Recharge extends BaseController
                     str_pad($log['amount']*100,12,'0',STR_PAD_LEFT),
                     '充值',
                     str_replace('http://','https://',url('api/notify/charge',['no'=>$log['order_no'],'type'=>$log['type']],true,true)),
-                    $data['url']??'',
-                    $user['bank_no']
+                    $data['url']??''
                 );
                 $res['data']=$resp['data']['body']['credential'];
                 if(!is_array($res)){

+ 17 - 17
application/common/library/Shande.php

@@ -9,7 +9,7 @@ class Shande extends Controller
 {
     // 统一下单接口
     // https://open.sandpay.com.cn/product/detail/43308/43720/43721
-    public static function orderPay($order_no,$amout,$body,$notifyurl,$frontUrl,$card_no)
+    public static function orderPay($order_no,$amout,$body,$notifyurl,$frontUrl)
     {
         $client = new H5FastPay;
         // 参数
@@ -20,13 +20,13 @@ class Shande extends Controller
             'subject'     => $body,
             'body'        => $body,
             'payMode'     => 'sand_h5',
-            'payExtra'      => json_encode(array('cardNo'=>$card_no)),
             'clientIp'    => get_client_ip(),
             //'notifyUrl'   => 'http://192.168.1.66/sandpay-qr-phpdemo/notifyurl.php',
             'notifyUrl'   => $notifyurl,
             //'frontUrl'    => 'http://192.168.1.66/sandpay-qr-phpdemo/notifyurl.php',
-            'frontUrl'    => $frontUrl
+            'frontUrl'    => $frontUrl,
         );
+
         // 返回结果
         $ret = $client->request('orderPay');
         return $ret;
@@ -72,21 +72,21 @@ class Shande extends Controller
     // 异步通知通用接口
     public function notify()
     {
-     /*   $client = new H5FastPay;
-        $sign   = $_POST['sign']; //签名
-        $data   = stripslashes($_POST['data']); //支付数据
+        /*   $client = new H5FastPay;
+           $sign   = $_POST['sign']; //签名
+           $data   = stripslashes($_POST['data']); //支付数据
 
-        // 验签
-        try {
-            $verifyFlag = $client->verify($data, $sign);
-            if ($verifyFlag) {
-                echo '签名正确';
-            } else {
-                echo '签名错误';
-            }
-        } catch (\Exception $e) {
-            echo $e->getMessage();
-        }*/
+           // 验签
+           try {
+               $verifyFlag = $client->verify($data, $sign);
+               if ($verifyFlag) {
+                   echo '签名正确';
+               } else {
+                   echo '签名错误';
+               }
+           } catch (\Exception $e) {
+               echo $e->getMessage();
+           }*/
     }
 
     // 商户自主重发异步通知接口