Commit a003f04a authored by wangzhengwen's avatar wangzhengwen

手机号重复提示

parent 30fb9f1e
......@@ -56,9 +56,14 @@ class User extends BaseController
}
$data = $request->param();
$is_exit = userModel::where(['mobile' => $data['mobile']])->where('is_del', 0)->count();
if ($is_exit) {
return $this->returnMsg('用户已存在', 0);
$userRole = userModel::where(['mobile' => $data['mobile']])->where('is_del', 0)->value('role');
if ($userRole) {
return match ((int)$userRole) {
1 => $this->returnMsg('当前手机号已注册成普通用户'),
2 => $this->returnMsg('当前手机号已注册成企业用户'),
3 => $this->returnMsg('当前手机号已注册成高校用户'),
default => $this->returnMsg('当前手机号已存在'),
};
}
//只有普通用户验证验证码
......@@ -287,12 +292,22 @@ class User extends BaseController
}
$data = $request->param();
$count = userModel::where(['mobile' => $data['mobile']])->count();
if ($count > 0) {
return $this->returnMsg('手机号已存在');
$userRole = userModel::where(['mobile' => $data['mobile']])
->where('is_del', 0)
->value('role');
if (!$userRole)
{
return $this->returnMsg('success', 1);
}
return $this->returnMsg('success', 1);
return match ((int)$userRole) {
1 => $this->returnMsg('当前手机号已注册成普通用户'),
2 => $this->returnMsg('当前手机号已注册成企业用户'),
3 => $this->returnMsg('当前手机号已注册成高校用户'),
default => $this->returnMsg('当前手机号已存在'),
};
}
......
......@@ -72,7 +72,7 @@ class Project extends Model
public function getuserdata()
{
return $this->belongsTo(User::class, 'user_id')
->field('username,mobile,id');
->field('username,mobile,id,headico');
}
public function getShStatusTextAttr($value, $data)
......@@ -191,7 +191,7 @@ class Project extends Model
}
$list = $query->field('id,sn,title,createtime,cate_id,yusuan,zhouqi,tag_ids,put_end_time,thumb,user_id')
->with(['thumb','getuserdata'])
->with(['thumb','getuserdata'=>['headico']])
->paginate([
'page' => $page,
'list_rows' => $pageSize
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment