更改用户主页查询逻辑
This commit is contained in:
@@ -41,34 +41,16 @@ public class retUserServlet extends HttpServlet {
|
||||
resp.setContentType("application/json;charset=UTF-8");
|
||||
|
||||
PrintWriter writer = resp.getWriter();
|
||||
HttpSession session = req.getSession();
|
||||
userEntity userEntity= null;
|
||||
userEntity=(userEntity)session.getAttribute("user");
|
||||
if(userEntity ==null)
|
||||
String username = req.getParameter("username");
|
||||
String jsonString = JSONObject.toJSONString(userService.selectUserByName(username));
|
||||
if(jsonString.equals(""))
|
||||
{
|
||||
String username = req.getParameter("username");
|
||||
String jsonString = JSONObject.toJSONString(userService.selectUserByName(username));
|
||||
if(jsonString.equals(""))
|
||||
{
|
||||
setResultError("查询失败",writer);
|
||||
}
|
||||
else{
|
||||
writer.println(jsonString);
|
||||
setResultOK("查询成功",writer);
|
||||
}
|
||||
}
|
||||
else{
|
||||
String jsonString = JSONObject.toJSONString(userService.selectUserByName(userEntity.getUserName()));
|
||||
if(jsonString.equals(""))
|
||||
{
|
||||
setResultError("查询失败",writer);
|
||||
}
|
||||
else{
|
||||
writer.println(jsonString);
|
||||
setResultOK("查询成功",writer);
|
||||
}
|
||||
setResultError("查询失败",writer);
|
||||
}else{
|
||||
setResultOK("查询成功",writer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setResult(Integer code, String msg, PrintWriter writer) {
|
||||
|
Reference in New Issue
Block a user