doctor = $doctorDao; } public function getToken($token) { $user = $this->doctor->getToken($token); return $user; } public function changePwd($params,$token) { if($params['newpass'] != $params['newrepass']){ $this->throwError('修改的密码两次输出不一致,请重新填写',0030); } $pattern = '/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[\W_]).+$/'; if(!preg_match($pattern, $params['newpass'])) { // $this->throwError('密码必须由数字、字母、特殊符号一起组成',0033); } $info = $this->doctor->getToken($token); if($info['password'] != md5($params['password'])){ $this->throwError('原密码输入错误,请重新输入',0031); } $data = $this->doctor->changePwd($info['id'],$params['newpass']); if(!$data){ $this->throwError('密码修改失败,请重新尝试',0032); } return $data; } public function changeInfo($info,$token) { $user = $this->doctor->getToken($token); $id = $user['id']; $data = array(); $data['realname'] = $info['realname']; $data['email'] = $info['email']; $data['phone'] = $info['phone']; $data['doctor_title'] = $info['doctor_title']; $data['message_push'] = $info['message_push']; $data['send_sms'] = $info['send_sms']; $data['attachment'] = $info['attachment']; $data['is_use_autograph'] = $info['is_use_autograph']; $data['autograph'] = $info['autograph']; $data['report_full'] = $info['report_full']; $data['autograph_type'] = $info['autograph_type'] ?? 1; $data['attachment_type'] = $info['attachment_type'] ?? 1; $return = $this->doctor->changeInfo($data,$id,$token); return $return; } public function getPower($id) { $info = $this->doctor->getPower($id); $data = []; if(!empty($info)){ if(strpos($info,'2')){ //本地写 $data[] = 1; } if(strpos($info,'3')){ //本地审核 $data[] = 2; } if(strpos($info,'4')){ //本地确认 $data[] = 3; } if(strpos($info,'6')){ //本地申请 $data[] = 4; } if(strpos($info,'7')){ //远程写 $data[] = 5; } if(strpos($info,'8')){ //远程审核 $data[] = 6; } } return $data; } // 获取登录代码 public function getLoginCode($token) { $doctor = $this->doctor->getCache($token); if(!$doctor){ return false; } $admin = $this->doctor->getFaAdmin($doctor['phone']); if(!$admin){ return false; } $login_code = $this->doctor->getLoginCode($doctor['id']); if($login_code){ return [ 'code' => $login_code, 'phone' => $doctor['phone'] ]; } return false; } public function doctorList($institution) { $list = $this->doctor->getDoctorList($institution); return $list; } }