添加:第三方账号绑定添加判断,银行卡持有人年龄只能在18~60岁

This commit is contained in:
wuhui_zzw 2023-12-21 14:36:58 +08:00
parent e5c68398b3
commit 83ef737b03
2 changed files with 15 additions and 1 deletions

View File

@ -32,6 +32,20 @@ class IndexController extends ApiController{
$info = request()->input('info');
$info['uid'] = \YunShop::app()->getMemberId();
try{
// 判断:银行卡是否已经存在
$isHas = (int)UseStaff::uniacid()
->where('card_num',$info['card_num'])
->where('uid','<>',$info['uid'])
->value('id');
if($isHas > 0) throw new \Exception('当前银行卡已被绑定,请更换银行卡!');
// 判断:年龄是否允许 已满18岁未满60岁
$accountId = $info['account_id'];
$birthday = strtotime(substr($accountId, 6, 8));// 出生日期时间戳
$yearsOld18 = strtotime("+18 year",$birthday);
$yearsOld60 = strtotime("+60 year",$birthday);
$time = time();
if($time < $yearsOld18 || $time > $yearsOld60) throw new \Exception('银行卡持有人年龄必须在18~60岁');
// 入户
$applyResult = (new ExternalApi())->personnelAccess($info);
(new ExternalApi())->personnelResult($applyResult['memberId'],$applyResult['transSeqId']);

View File

@ -164,7 +164,7 @@ class ExternalApi extends BaseModel{
$params['uid'] = $info['uid'];
$params['memberId'] = $result['memberId'];
$params['trans_seq_id'] = $result['transSeqId'];
$params['status'] = $result['state'];
$params['status'] = $result['state'] ?? 0;
// 判断:当前用户是否已经存在账号信息
$isHas = (int)UseStaff::uniacid()->where('uid',$info['uid'])->value('id');
if($isHas > 0) (new UseStaff())->updateRecord($params);