feat: 更新用户提现API,增加身份认证和提现限制

This commit is contained in:
mkm 2024-08-16 14:42:23 +08:00
parent 10557af2d3
commit 9a1002367c
2 changed files with 16 additions and 4 deletions

View File

@ -293,7 +293,7 @@ class UserController extends BaseApiController
*/
public function cash_info()
{
$info = User::where('id', $this->userId)->field('id,now_money,id_card')->find();
$info = User::where('id', $this->userId)->field('id,real_name,mobile,now_money,id_card')->find();
$info['notes'] = '提现金额需大于1元提现到微信零钱并财务审核审核通过后提现金额将自动到账';
$info['extract_price'] =StoreExtract::where('uid',$this->userId)->sum('extract_price');
return $this->data($info);
@ -312,6 +312,9 @@ class UserController extends BaseApiController
if ($money < 1) {
return $this->fail('提现金额不能小于1元');
}
if ($find['id_card']=='') {
return $this->fail('请先完成身份认证');
}
$data['uid'] = $this->userId;
$data['create_time'] = time();
$data['status'] = 0;
@ -358,9 +361,9 @@ class UserController extends BaseApiController
* 更新身份证号
*/
public function update_id_card(){
$id_card = $this->request->post('id_card');
if($id_card){
User::where('id',$this->userId)->update(['id_card'=>$id_card]);
$data= (new UserValidate())->post()->goCheck('card');
if($data){
User::where('id',$this->userId)->update(['id_card'=>$data['id_card'],'real_name'=>$data['real_name'],'nickname'=>$data['real_name']]);
return $this->success('设置成功');
}
return $this->fail('请输入身份证号');

View File

@ -24,6 +24,8 @@ class UserValidate extends BaseValidate
'rePassword' => 'require|requireWith:password|confirm:password',
'type' => 'require',
'account' => 'require',
'real_name' => 'require',
'id_card' => 'require|idCard',
];
@ -36,6 +38,8 @@ class UserValidate extends BaseValidate
'password.require' => '密码缺失',
'rePassword.require' => '确认密码缺失',
'type' => '查询类型',
'id_card' => '身份证格式错误',
'real_name' => '姓名不能为空',
];
@ -49,6 +53,11 @@ class UserValidate extends BaseValidate
{
return $this->only(['type']);
}
public function sceneCard()
{
return $this->only(['id_card','real_name']);
}
//设置/更新密码