发布项目时查询
This commit is contained in:
@@ -35,7 +35,28 @@ public class ret_Github_infoServlet extends HttpServlet {
|
||||
|
||||
PrintWriter writer = resp.getWriter();
|
||||
String projectid = req.getParameter("projectId");
|
||||
writer.println(githubservice.ret_Github_info(Integer.parseInt(projectid)));
|
||||
String json = githubservice.ret_Github_info(Integer.parseInt(projectid));
|
||||
if(json == null){
|
||||
setResultError("该信息未收录", writer);
|
||||
}else{
|
||||
writer.println(json);
|
||||
}
|
||||
writer.close();
|
||||
}
|
||||
public void setResult(Integer code, String msg, PrintWriter writer) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
result.put("code", code);
|
||||
result.put("msg", msg);
|
||||
String jsonString = JSONObject.toJSONString(result);
|
||||
writer.println(jsonString);
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public void setResultError(String msg, PrintWriter writer) {
|
||||
setResult(500, msg, writer);
|
||||
}
|
||||
|
||||
public void setResultOK(String msg, PrintWriter writer) {
|
||||
setResult(200, msg, writer);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user