@SecurityAnnotation
@RequestMapping(value = "addBlog", method = RequestMethod.POST)
@ResponseBody
public ReturnT<String> addBlog(Model model, HttpServletRequest request, HttpServletResponse response, @RequestParam("blog") String blog) {
HeadPrinter.printHead(model);
UserAuthDO userAuthDO = UserAuth.getCurrentUser(request);
JSONObject jsonObject = JSONObject.parseObject(blog);
String title = jsonObject.getString("title");
String img = jsonObject.getString("img");
String content = jsonObject.getString("content");
Article article = new Article();
article.setUserId(userService.getByName(userAuthDO.getName()).getId());
article.setCategory(ArcticleCategoryEnums.BLOG.getMessage());
article.setTitle(title);
article.setTag(TagEnums.TAG_2.getMessage());
article.setImg(img);
article.setContent(content);
article.setCreateDate(new Date());
article.setUpdateDate(new Date());
Integer id = arcticleService.addArcticle(article);
if (id <= 0) {
return ReturnT.FAIL;
}
return ReturnT.SUCCESS;
}
ArcticleController.java 文件源码
java
阅读 40
收藏 0
点赞 0
评论 0
项目:dooo
作者:
评论列表
文章目录