$name,'password'=>$password])->find(); if(!$user){ throw new JsonException(1,"用户名或密码输入错误,请重试!"); } // if($user->status == \app\lib\enum\User::DELETED){ // throw new JsonException(1,"该用户已经被删除!"); // } return $user; } //获取性别 public function getSexAttr($var){ switch($var){ case '1': return "男"; break; case '2': return "女"; break; default: return "未知"; } } //获取科室 public function getDepartmentAttr($var){ switch($var){ case '1': return "内科"; break; case '2': return "儿科"; break; case '3': return "神经科"; break; case '4': return "口腔科"; break; case '5': return "眼科"; break; case '6': return "耳鼻喉科"; break; case '7': return "妇科"; break; case '8': return "中医科"; break; default: return "无"; } } //获取职位 public function getPositionAttr($var){ switch($var){ case '1': return "管理员"; break; case '2': return "医生"; break; case '3': return "护士"; break; default: return "无职位"; } } //获取任职时间 public function getEntryTimeAttr($val,$data) { if (empty($data['entry_time'])) return '暂无记录'; return date("Y-m-d",$data['entry_time']); } }