| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | return R.data(articleService.selectArticlePage(Condition.getPage(query),article)); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 敏感词预警 |
| | | * @param response |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageWords") |
| | | public R<IPage<Article>> pageWords(HttpServletResponse response, ArticleVo article, Query query){ |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | return R.data(articleService.pageWords(Condition.getPage(query),article)); |
| | | } |
| | | |
| | | /** |
| | |
| | | article.setCreateTime(new Date()); |
| | | } |
| | | } |
| | | //默认为正常 |
| | | article.setIswords("0"); |
| | | |
| | | if (article.getContent() != null && article.getContent() != ""){ |
| | | String content = ""; |
| | | Map<String,String> content = new HashMap(); |
| | | content = DemoApplication.interceptWords(article.getContent()); |
| | | article.setContent(content); |
| | | System.out.println(content.get("iswords")); |
| | | if (content.get("iswords") == "true"){ |
| | | article.setContent(content.get("content")); |
| | | article.setIswords("1"); |
| | | article.setWordsContent(content.get("words")); |
| | | } |
| | | |
| | | } |
| | | article.setUpdateTime(new Date()); |
| | | return R.status(articleService.saveOrUpdate(article)); |