Browse Source

苹果异步回调,VIP充值

lizhen_gitee 1 year ago
parent
commit
be72c96298
1 changed files with 6 additions and 1 deletions
  1. 6 1
      application/api/controller/Payios.php

+ 6 - 1
application/api/controller/Payios.php

@@ -75,7 +75,7 @@ class Payios extends Api
         //苹果内购的验证收据
         $receipt_data = input('apple_receipt', '', 'trim');
         $order_no = input('order_no', '', 'trim');
-
+        filePut('VIP ios充值:参数apple_receipt='.$receipt_data.',order_no='.$order_no);
         if (!$receipt_data || !$order_no) {
             $this->error('缺少参数');
         }
@@ -85,6 +85,7 @@ class Payios extends Api
         $order_info = Db::name('pay_order')->where(['out_trade_no' => $order_no])->lock(true)->find();
         if (!$order_info) {
             Db::rollback();
+            filePut('VIP ios充值:订单丢失out_trade_no='.$order_no);
             $this->error('订单丢失');
         }
         if ($order_info['order_status'] == 1) {
@@ -96,6 +97,7 @@ class Payios extends Api
         $result = $this->validate_apple_pay($receipt_data);
         if (!$result['status']) {// 验证不通过
             Db::rollback();
+            filePut('VIP ios充值:验证out_trade_no='.$order_no.','.$result['message']);
             $this->error($result['message']);
         }
 
@@ -104,6 +106,7 @@ class Payios extends Api
         $args = json_decode($order_info['args'],true);
         if ($result['data']['receipt']['in_app'][$use_count]['product_id'] != $args['bundle_id']) {
             Db::rollback();
+            filePut('VIP ios充值:非法请求,请立刻停止out_trade_no='.$order_no.','.$result['message'].','.$result['data']['receipt']['in_app'][$use_count]['product_id'].'!='.$args['bundle_id']);
             $this->error('非法请求,请立刻停止');
         }
 
@@ -124,12 +127,14 @@ class Payios extends Api
         if($result === false)
         {
             Db::rollback();
+            filePut('VIP ios充值:验证out_trade_no='.$order_no.',逻辑续费vip时间失败');
             $this->error('充值失败');
         }
 
         // 修改订单状态
         $ros = Db::name('pay_order')->where(['out_trade_no' => $order_no])->update(['order_status'=>1,'notifytime'=>time()]);
         if($ros === false) {
+            filePut('VIP ios充值:充值失败out_trade_no='.$order_no.','.$result['message'].','.'修改订单状态失败');
             Db::rollback();
             $this->error('充值失败');
         }