yangsai@163.com 6 months ago
parent 2d5e976554
commit dcfb4c1926
  1. 34
      application/controllers/Api/Login.php

@ -108,7 +108,39 @@
$ret = $this->Usermodel->save($data); $ret = $this->Usermodel->save($data);
if(!$ret) Tool_Fnc::apiMsg('注册失败', '500'); if(!$ret) Tool_Fnc::apiMsg('注册失败', '500');
Tool_Fnc::apiMsg('注册成功,等待管理员审核通过', '200'); Tool_Fnc::apiMsg('注册成功,等待管理员审核通过', '200');
} }
public function editinfoAction(){
$data['id'] = empty($this->POST['id'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['id'];
//用户名
$username = empty($this->POST['username'])||!isset($this->POST['username'])? Tool_Fnc::apiMsg('请输入用户名', '500'):Tool_fnc::safe_string($this->POST['username']);
//密码
// $password = empty($this->POST['password'])||!isset($this->POST['password'])? Tool_Fnc::apiMsg('请输入密码', '500'):Tool_fnc::safe_string($this->POST['password']);
//用户类型
// $type = empty($this->POST['type'])||!isset($this->POST['type'])? Tool_Fnc::apiMsg('请选择用户类型', '500'):Tool_fnc::safe_string($this->POST['type']);
//真实姓名
$realname = empty($this->POST['realname'])||!isset($this->POST['realname'])? Tool_Fnc::apiMsg('请输入真实姓名', '500'):Tool_fnc::safe_string($this->POST['realname']);
//院系
$faculties = empty($this->POST['faculties'])||!isset($this->POST['faculties'])? Tool_Fnc::apiMsg('请选择院系', '500'):Tool_fnc::safe_string($this->POST['faculties']);
//专业
$specialized = empty($this->POST['specialized'])||!isset($this->POST['specialized'])? Tool_Fnc::apiMsg('请选择专业', '500'):Tool_fnc::safe_string($this->POST['specialized']);
//课题组
$group = empty($this->POST['group'])||!isset($this->POST['group'])? Tool_Fnc::apiMsg('请选择课题组', '500'):Tool_fnc::safe_string($this->POST['group']);
//导师
$teacher = empty($this->POST['teacher'])||!isset($this->POST['teacher'])? Tool_Fnc::apiMsg('请选择导师', '500'):Tool_fnc::safe_string($this->POST['teacher']);
//查询用户名是否存在
$Userinfo = $this->Usermodel->field('*')->where("username='{$username}' and type={$type} and is_delete=0 and id!={$data['id']}")->fRow();
if(!empty($Userinfo)) Tool_Fnc::apiMsg('当前选择人员类型已存在此用户名,请重新填写用户名', '500');
$data['username'] = $username;
// $data['password'] = md5($password.Yaf_Registry::get("config")->psd->default->appsecret);
$data['realname'] = $realname;
// $data['type'] = $type;
$data['faculties'] = $faculties;
$data['specialized'] = $specialized;
$data['group'] = $group;
$data['teacher'] = $teacher;
$ret = $this->Usermodel->save($data);
if(!$ret) Tool_Fnc::apiMsg('信息未变更', '500');
Tool_Fnc::apiMsg('编辑成功', '200');
}
} }

Loading…
Cancel
Save