shichen месяцев назад: 10
Родитель
Сommit
60dee8df03

+ 5 - 4
app/common/repositories/merchant/order/OrderGzcRepository.php

@@ -356,7 +356,7 @@ class OrderGzcRepository extends BaseRepository
356
 
356
 
357
 
357
 
358
 
358
 
359
-    public function certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse,$cardType,$birthday,$gender)
359
+    public function certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse,$cardType,$birthday,$gender,$age)
360
     {
360
     {
361
         $thirdKey = "xingfubao";
361
         $thirdKey = "xingfubao";
362
         $thirdsignKey = "xfb@86868.";
362
         $thirdsignKey = "xfb@86868.";
@@ -386,9 +386,10 @@ class OrderGzcRepository extends BaseRepository
386
                 'user_card' => $user_card,
386
                 'user_card' => $user_card,
387
                 'card_positive'=> $card_positive,
387
                 'card_positive'=> $card_positive,
388
                 'card_reverse'=> $card_reverse,
388
                 'card_reverse'=> $card_reverse,
389
-                'concertType' => $concertType,
390
-                'birthday' => $birthday,
391
-                'conSex' => $gender
389
+                'conCertType' => strval($concertType),
390
+                'birthday' => strval($birthday),
391
+                'conSex' => strval($gender),
392
+                'age' => intval($age)
392
             ];
393
             ];
393
         }
394
         }
394
 
395
 

+ 38 - 24
app/controller/admin/system/merchant/GzcLogs.php

@@ -14,8 +14,10 @@ use app\common\repositories\merchant\order\OrderGzcRepository;
14
 use app\common\repositories\merchant\order\OrderMerchantRepository;
14
 use app\common\repositories\merchant\order\OrderMerchantRepository;
15
 use crmeb\basic\BaseController;
15
 use crmeb\basic\BaseController;
16
 use app\common\repositories\store\ExcelRepository;
16
 use app\common\repositories\store\ExcelRepository;
17
+use Nette\Utils\DateTime;
17
 use think\App;
18
 use think\App;
18
 use think\facade\Db;
19
 use think\facade\Db;
20
+use think\facade\Log;
19
 
21
 
20
 class GzcLogs extends BaseController
22
 class GzcLogs extends BaseController
21
 {
23
 {
@@ -69,7 +71,7 @@ class GzcLogs extends BaseController
69
      * created: 2021/3/24 13:56
71
      * created: 2021/3/24 13:56
70
      */
72
      */
71
     public function inGzc()
73
     public function inGzc()
72
-    { 
74
+    {
73
         $id = intval($this->request->param('id'));
75
         $id = intval($this->request->param('id'));
74
         $log = Db::table('rrx_gzc_logs')
76
         $log = Db::table('rrx_gzc_logs')
75
             ->where('id', $id)
77
             ->where('id', $id)
@@ -77,16 +79,19 @@ class GzcLogs extends BaseController
77
             ->where('success', 0)
79
             ->where('success', 0)
78
             ->where('pension', '>', 0)
80
             ->where('pension', '>', 0)
79
             ->find();
81
             ->find();
80
-        
82
+
81
         if(!$log){
83
         if(!$log){
82
-            return app('json')->fail('请选择未入账的记录', );
84
+            return app('json')->fail('请选择未入账的记录');
83
         }
85
         }
84
-            
86
+
85
         $mobile= $log['mobile'];
87
         $mobile= $log['mobile'];
86
         $user_name =  Db::name('user_certification')->where('uid',$log['uid'])->value('user_name');
88
         $user_name =  Db::name('user_certification')->where('uid',$log['uid'])->value('user_name');
87
         $user_card =  Db::name('user_certification')->where('uid',$log['uid'])->value('user_card');
89
         $user_card =  Db::name('user_certification')->where('uid',$log['uid'])->value('user_card');
88
         $card_positive = Db::name('user_certification')->where('uid',$log['uid'])->value('card_positive');
90
         $card_positive = Db::name('user_certification')->where('uid',$log['uid'])->value('card_positive');
89
         $card_reverse = Db::name('user_certification')->where('uid',$log['uid'])->value('card_reverse');
91
         $card_reverse = Db::name('user_certification')->where('uid',$log['uid'])->value('card_reverse');
92
+        $cardType = Db::name('user_certification')->where('uid',$log['uid'])->value('card_type');
93
+        $gender = Db::name('user_certification')->where('uid',$log['uid'])->value('gender');
94
+        $birthday = Db::name('user_certification')->where('uid',$log['uid'])->value('birthday');
90
         if(!$mobile || !$user_name || !$user_card || !$card_positive || !$card_reverse){
95
         if(!$mobile || !$user_name || !$user_card || !$card_positive || !$card_reverse){
91
             return app('json')->fail('存在实名数据缺失');
96
             return app('json')->fail('存在实名数据缺失');
92
         }
97
         }
@@ -97,7 +102,12 @@ class GzcLogs extends BaseController
97
         if($register['status'] != 200) return app('json')->fail('入账失败:'.$register['message']);
102
         if($register['status'] != 200) return app('json')->fail('入账失败:'.$register['message']);
98
         $uid = $register['data']['uid'] ?? 0;
103
         $uid = $register['data']['uid'] ?? 0;
99
         if(!$uid) return app('json')->fail('创建或获取用户失败');
104
         if(!$uid) return app('json')->fail('创建或获取用户失败');
100
-        $certification = $OrderGzcRepository->certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse);
105
+        // 兼容港澳台用户认证
106
+        $age = (new DateTime())->diff(
107
+            DateTime::createFromFormat('Ymd', strval($birthday))
108
+        )->y;
109
+        $certification = $OrderGzcRepository->certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse,$cardType,$birthday,$gender,$age);
110
+        Log::info('pcpc认证结果' . json_encode($certification));
101
         if($certification['status'] != 200) return app('json')->fail('实名认证失败:'.$certification['message']);
111
         if($certification['status'] != 200) return app('json')->fail('实名认证失败:'.$certification['message']);
102
         $gzc = $OrderGzcRepository->gzc($uid,$log['pension']);
112
         $gzc = $OrderGzcRepository->gzc($uid,$log['pension']);
103
         if($gzc['status'] != 200) return app('json')->fail('入账失败:'.$gzc['message']);
113
         if($gzc['status'] != 200) return app('json')->fail('入账失败:'.$gzc['message']);
@@ -106,18 +116,18 @@ class GzcLogs extends BaseController
106
         $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
116
         $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
107
         $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
117
         $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
108
         Db::table('rrx_gzc_logs')
118
         Db::table('rrx_gzc_logs')
109
-        ->where('id', $id)
110
-        ->where('gzc', 0)
111
-        ->where('success', 0)
112
-        ->where('pension', '>', 0)
113
-        ->update([
114
-            'gzc' => 1,
115
-            'platform_no' => $orderId,
116
-            'gzc_deposit_no' => $gzc_deposit_no,
117
-            'gzc_confirm_result' => $gzc_confirm_result,
118
-            'success' => 1,
119
-            'update_time' => date('Y-m-d H:i:s')
120
-        ]);
119
+            ->where('id', $id)
120
+            ->where('gzc', 0)
121
+            ->where('success', 0)
122
+            ->where('pension', '>', 0)
123
+            ->update([
124
+                'gzc' => 1,
125
+                'platform_no' => $orderId,
126
+                'gzc_deposit_no' => $gzc_deposit_no,
127
+                'gzc_confirm_result' => $gzc_confirm_result,
128
+                'success' => 1,
129
+                'update_time' => date('Y-m-d H:i:s')
130
+            ]);
121
 
131
 
122
         //发起成功更新记录值
132
         //发起成功更新记录值
123
         $order_id = Db::name('store_order')->where('order_sn', $log['out_trade_no'])->value('order_id');
133
         $order_id = Db::name('store_order')->where('order_sn', $log['out_trade_no'])->value('order_id');
@@ -125,13 +135,13 @@ class GzcLogs extends BaseController
125
             $bill = Db::name('user_bill')->where('link_id', $order_id)->where('commission_type', 5)->where('is_gzc', 'in', [0, 1])->find();
135
             $bill = Db::name('user_bill')->where('link_id', $order_id)->where('commission_type', 5)->where('is_gzc', 'in', [0, 1])->find();
126
             if($bill){
136
             if($bill){
127
                 Db::name('user_bill')
137
                 Db::name('user_bill')
128
-                ->where('bill_id', $bill['bill_id'])
129
-                ->update([
130
-                    'is_gzc' => 2
131
-                ]);
138
+                    ->where('bill_id', $bill['bill_id'])
139
+                    ->update([
140
+                        'is_gzc' => 2
141
+                    ]);
132
             }
142
             }
133
         }
143
         }
134
-        
144
+
135
         return app('json')->success('发起成功', $log);
145
         return app('json')->success('发起成功', $log);
136
     }
146
     }
137
 
147
 
@@ -168,8 +178,8 @@ class GzcLogs extends BaseController
168
             $card_positive = Db::name('user_certification')->where('uid',$log['uid'])->value('card_positive');
178
             $card_positive = Db::name('user_certification')->where('uid',$log['uid'])->value('card_positive');
169
             $card_reverse = Db::name('user_certification')->where('uid',$log['uid'])->value('card_reverse');
179
             $card_reverse = Db::name('user_certification')->where('uid',$log['uid'])->value('card_reverse');
170
             $cardType = Db::name('user_certification')->where('uid',$log['uid'])->value('card_type');
180
             $cardType = Db::name('user_certification')->where('uid',$log['uid'])->value('card_type');
171
-            $birthday = Db::name('user_certification')->where('uid',$log['uid'])->value('birthday');
172
             $gender = Db::name('user_certification')->where('uid',$log['uid'])->value('gender');
181
             $gender = Db::name('user_certification')->where('uid',$log['uid'])->value('gender');
182
+            $birthday = Db::name('user_certification')->where('uid',$log['uid'])->value('birthday');
173
             if(!$mobile || !$user_name || !$user_card || !$card_positive || !$card_reverse){
183
             if(!$mobile || !$user_name || !$user_card || !$card_positive || !$card_reverse){
174
                 return app('json')->fail('存在实名数据缺失');
184
                 return app('json')->fail('存在实名数据缺失');
175
             }
185
             }
@@ -180,7 +190,11 @@ class GzcLogs extends BaseController
180
             if($register['status'] != 200) return app('json')->fail('入账失败:'.$register['message']);
190
             if($register['status'] != 200) return app('json')->fail('入账失败:'.$register['message']);
181
             $uid = $register['data']['uid'] ?? 0;
191
             $uid = $register['data']['uid'] ?? 0;
182
             if(!$uid) return app('json')->fail('创建或获取用户失败');
192
             if(!$uid) return app('json')->fail('创建或获取用户失败');
183
-            $certification = $OrderGzcRepository->certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse,$cardType,$birthday,$gender);
193
+            // 兼容港澳台用户认证
194
+            $age = (new DateTime())->diff(
195
+                DateTime::createFromFormat('Ymd', strval($birthday))
196
+            )->y;
197
+            $certification = $OrderGzcRepository->certification($uid, $mobile, $user_name, $user_card, $card_positive, $card_reverse,$cardType,$birthday,$gender,$age);
184
             if($certification['status'] != 200) return app('json')->fail('实名认证失败:'.$certification['message']);
198
             if($certification['status'] != 200) return app('json')->fail('实名认证失败:'.$certification['message']);
185
             $gzc = $OrderGzcRepository->gzc($uid,$log['pension']);
199
             $gzc = $OrderGzcRepository->gzc($uid,$log['pension']);
186
             if($gzc['status'] != 200) return app('json')->fail('入账失败:'.$gzc['message']);
200
             if($gzc['status'] != 200) return app('json')->fail('入账失败:'.$gzc['message']);