绑定更换手机号

This commit is contained in:
2025-08-15 14:11:31 +08:00
parent af15c00456
commit 341c93da80
2 changed files with 5 additions and 5 deletions

View File

@@ -26,8 +26,8 @@ class Sms extends Model
if($type == 1 || $type == 2){ if($type == 1 || $type == 2){
//查询手机号绑定的数量 //查询手机号绑定的数量
$map = []; $map = [];
$map[] = ['mobile', '=', $mobile]; $map['mobile'] = $mobile;
$map[] = ['status', '=', 1]; $map['status'] = 1;
$user_info = db::name('user')->where($map)->count(); $user_info = db::name('user')->where($map)->count();
if($user_info >= 4){ if($user_info >= 4){
return ['code' => 0, 'msg' => '该手机号已达绑定上线','data' =>null]; return ['code' => 0, 'msg' => '该手机号已达绑定上线','data' =>null];

View File

@@ -252,7 +252,7 @@ class UserData extends Model
public function modify_mobile($new_mobile,$user_id) public function modify_mobile($new_mobile,$user_id)
{ {
//查询旧手机号 //查询旧手机号
$mobile = db::name('user')->where(['id' => $user_id])->value('user_name'); $mobile = db::name('user')->where(['id' => $user_id])->value('username');
//查询是否实名 //查询是否实名
$is_real = db::name('user_auth')->where(['mobile' => $mobile,'is_real' => 1])->find(); $is_real = db::name('user_auth')->where(['mobile' => $mobile,'is_real' => 1])->find();
if($is_real){ if($is_real){
@@ -260,7 +260,7 @@ class UserData extends Model
db::startTrans(); db::startTrans();
//修改实名手机号 //修改实名手机号
$red = db::name('user_auth')->where(['id' => $is_real['id']])->update(['mobile' => $new_mobile]); $red = db::name('user_auth')->where(['id' => $is_real['id']])->update(['mobile' => $new_mobile]);
$reslut = db::name('user')->where(['id' => $user_id])->update(['user_name' => $new_mobile]); $reslut = db::name('user')->where(['id' => $user_id])->update(['username' => $new_mobile]);
if ($reslut && $red) { if ($reslut && $red) {
Db::commit(); Db::commit();
return ['code' => 1, 'msg' => '修改成功','data' =>null]; return ['code' => 1, 'msg' => '修改成功','data' =>null];
@@ -269,7 +269,7 @@ class UserData extends Model
return ['code' => 0, 'msg' => '修改失败','data' =>null]; return ['code' => 0, 'msg' => '修改失败','data' =>null];
} }
}else{ }else{
$reslut = db::name('user')->where(['id' => $user_id])->update(['user_name' => $new_mobile]); $reslut = db::name('user')->where(['id' => $user_id])->update(['username' => $new_mobile]);
if ($reslut) { if ($reslut) {
return ['code' => 1, 'msg' => '修改成功','data' =>null]; return ['code' => 1, 'msg' => '修改成功','data' =>null];
} }