|
|
@@ -14,8 +14,10 @@ use app\common\repositories\merchant\order\OrderGzcRepository;
|
|
14
|
14
|
use app\common\repositories\merchant\order\OrderMerchantRepository;
|
|
15
|
15
|
use crmeb\basic\BaseController;
|
|
16
|
16
|
use app\common\repositories\store\ExcelRepository;
|
|
|
17
|
+use Nette\Utils\DateTime;
|
|
17
|
18
|
use think\App;
|
|
18
|
19
|
use think\facade\Db;
|
|
|
20
|
+use think\facade\Log;
|
|
19
|
21
|
|
|
20
|
22
|
class GzcLogs extends BaseController
|
|
21
|
23
|
{
|
|
|
@@ -69,7 +71,7 @@ class GzcLogs extends BaseController
|
|
69
|
71
|
* created: 2021/3/24 13:56
|
|
70
|
72
|
*/
|
|
71
|
73
|
public function inGzc()
|
|
72
|
|
- {
|
|
|
74
|
+ {
|
|
73
|
75
|
$id = intval($this->request->param('id'));
|
|
74
|
76
|
$log = Db::table('rrx_gzc_logs')
|
|
75
|
77
|
->where('id', $id)
|
|
|
@@ -77,16 +79,19 @@ class GzcLogs extends BaseController
|
|
77
|
79
|
->where('success', 0)
|
|
78
|
80
|
->where('pension', '>', 0)
|
|
79
|
81
|
->find();
|
|
80
|
|
-
|
|
|
82
|
+
|
|
81
|
83
|
if(!$log){
|
|
82
|
|
- return app('json')->fail('请选择未入账的记录', );
|
|
|
84
|
+ return app('json')->fail('请选择未入账的记录');
|
|
83
|
85
|
}
|
|
84
|
|
-
|
|
|
86
|
+
|
|
85
|
87
|
$mobile= $log['mobile'];
|
|
86
|
88
|
$user_name = Db::name('user_certification')->where('uid',$log['uid'])->value('user_name');
|
|
87
|
89
|
$user_card = Db::name('user_certification')->where('uid',$log['uid'])->value('user_card');
|
|
88
|
90
|
$card_positive = Db::name('user_certification')->where('uid',$log['uid'])->value('card_positive');
|
|
89
|
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
|
95
|
if(!$mobile || !$user_name || !$user_card || !$card_positive || !$card_reverse){
|
|
91
|
96
|
return app('json')->fail('存在实名数据缺失');
|
|
92
|
97
|
}
|
|
|
@@ -97,7 +102,12 @@ class GzcLogs extends BaseController
|
|
97
|
102
|
if($register['status'] != 200) return app('json')->fail('入账失败:'.$register['message']);
|
|
98
|
103
|
$uid = $register['data']['uid'] ?? 0;
|
|
99
|
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
|
111
|
if($certification['status'] != 200) return app('json')->fail('实名认证失败:'.$certification['message']);
|
|
102
|
112
|
$gzc = $OrderGzcRepository->gzc($uid,$log['pension']);
|
|
103
|
113
|
if($gzc['status'] != 200) return app('json')->fail('入账失败:'.$gzc['message']);
|
|
|
@@ -106,18 +116,18 @@ class GzcLogs extends BaseController
|
|
106
|
116
|
$OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
|
|
107
|
117
|
$orderId = $OrderMerchantRepository->getNewOrderId('IN10');
|
|
108
|
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
|
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
|
135
|
$bill = Db::name('user_bill')->where('link_id', $order_id)->where('commission_type', 5)->where('is_gzc', 'in', [0, 1])->find();
|
|
126
|
136
|
if($bill){
|
|
127
|
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
|
145
|
return app('json')->success('发起成功', $log);
|
|
136
|
146
|
}
|
|
137
|
147
|
|
|
|
@@ -168,8 +178,8 @@ class GzcLogs extends BaseController
|
|
168
|
178
|
$card_positive = Db::name('user_certification')->where('uid',$log['uid'])->value('card_positive');
|
|
169
|
179
|
$card_reverse = Db::name('user_certification')->where('uid',$log['uid'])->value('card_reverse');
|
|
170
|
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
|
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
|
183
|
if(!$mobile || !$user_name || !$user_card || !$card_positive || !$card_reverse){
|
|
174
|
184
|
return app('json')->fail('存在实名数据缺失');
|
|
175
|
185
|
}
|
|
|
@@ -180,7 +190,11 @@ class GzcLogs extends BaseController
|
|
180
|
190
|
if($register['status'] != 200) return app('json')->fail('入账失败:'.$register['message']);
|
|
181
|
191
|
$uid = $register['data']['uid'] ?? 0;
|
|
182
|
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
|
198
|
if($certification['status'] != 200) return app('json')->fail('实名认证失败:'.$certification['message']);
|
|
185
|
199
|
$gzc = $OrderGzcRepository->gzc($uid,$log['pension']);
|
|
186
|
200
|
if($gzc['status'] != 200) return app('json')->fail('入账失败:'.$gzc['message']);
|