增加用户删除账号

This commit is contained in:
tsf 2024-08-26 14:49:12 +08:00
parent 70ce8fc268
commit f2124fe291
2 changed files with 22 additions and 1 deletions

View File

@ -35,7 +35,7 @@ class Login extends Base{
if($montage_data == false){
return $this->msg(10005);
}
$inspect_repeat = Db::table('app_account_number')->where([$montage_data=>$data['data']])->count();
$inspect_repeat = Db::table('app_account_number')->where([$montage_data=>$data['data'],'is_del'=>0])->count();
if($inspect_repeat >= 0){
return $this->msg(10002,'注册失败,账号已存在');
}
@ -112,6 +112,7 @@ class Login extends Base{
return $this->msg(10005);
}
$verify_result[$montage_data] = $data['data'];
$verify_result['is_del'] = 0;
// 检测校验途径
if($data['validate_type'] == 'code'){
$code_name = $data['data'];
@ -174,6 +175,24 @@ class Login extends Base{
return $this->msg([]);
}
// 删除账号
public function delete_account($data=['token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
if(count(input('post.')) > 0){
$data = input('post.');
}
if(!array_key_exists('token', $data)){
return $this->msg(10001);
}
$result = Db::table('app_account_number')->where(['token'=>$data['token']])->update(['is_del'=>1]);
cache($data['token'], NULL);
if($result){
return $this->msg([]);
}else{
return $this->msg(10002);
}
}
################################################################接口################################################################
################################################################接口################################################################
################################################################接口################################################################

View File

@ -108,6 +108,8 @@ Route::any('/login_action', 'app/login/login_action');
Route::any('/send_phone_email_code', 'app/login/send_phone_email_code');
// 退出登录操作
Route::any('/user_quit_account', 'app/login/user_quit_account');
// 删除账号
Route::any('/delete_account', 'app/login/delete_account');
// ################################APP首页接口################################
// 创建用户