| | |
| | | private final IMgcxService mgcxService; |
| | | |
| | | /** |
| | | * |
| | | * 查询资讯分页信息 |
| | | * |
| | | * @param response |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/page") |
| | | public R<IPage<Article>> page(HttpServletResponse response, ArticleVo article, Query query){ |
| | | public R<IPage<Article>> page(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.selectArticlePage(Condition.getPage(query),article)); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | return R.data(articleService.selectArticlePage(Condition.getPage(query), article)); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 敏感词预警 |
| | | * |
| | | * @param response |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageWords") |
| | | public R<IPage<Article>> pageWords(HttpServletResponse response, ArticleVo article, Query query){ |
| | | 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)); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | return R.data(articleService.pageWords(Condition.getPage(query), article)); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 查询资讯分页信息(角色权限) |
| | | * |
| | | * @param response |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageDate") |
| | | public R<IPage<Article>> pageDate(HttpServletResponse response, ArticleVo article, Query query){ |
| | | public R<IPage<Article>> pageDate(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.pageDate(Condition.getPage(query),article)); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | return R.data(articleService.pageDate(Condition.getPage(query), article)); |
| | | } |
| | | |
| | | @GetMapping("/pageCollectList") |
| | | public R<IPage<Article>> pageCollectList(HttpServletResponse response, ArticleVo article, Query query){ |
| | | public R<IPage<Article>> pageCollectList(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.pageCollectList(Condition.getPage(query),article)); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | return R.data(articleService.pageCollectList(Condition.getPage(query), article)); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 查询资讯分页信息(角色权限)附带点赞评论数 |
| | | * |
| | | * @param response |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageLikes") |
| | | public R<IPage<Article>> pageLikes(HttpServletResponse response, ArticleVo article, Query query){ |
| | | public R<IPage<Article>> pageLikes(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.pageLikes(Condition.getPage(query),article)); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | return R.data(articleService.pageLikes(Condition.getPage(query), article)); |
| | | } |
| | | |
| | | /** |
| | | * 查询已收藏的资讯 |
| | | */ |
| | | @GetMapping("/pageCollect") |
| | | public R<IPage<Article>> pageCollect(HttpServletResponse response, ArticleVo article, Query query){ |
| | | public R<IPage<Article>> pageCollect(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.pageCollect(Condition.getPage(query),article)); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | return R.data(articleService.pageCollect(Condition.getPage(query), article)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 资讯详情 |
| | | * @param article 资讯查询对象 |
| | | * |
| | | * @param article 资讯查询对象 |
| | | * @param response |
| | | */ |
| | | @GetMapping("/detail") |
| | |
| | | public R<Article> detail(Article article, HttpServletResponse response) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | Article detail = articleService.getOne(Condition.getQueryWrapper(article)); |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 新增资讯信息 |
| | | * |
| | | * @param article 资讯对象 |
| | | */ |
| | | @PostMapping("/save") |
| | |
| | | |
| | | /** |
| | | * 修改资讯信息 |
| | | * |
| | | * @param article 资讯对象 |
| | | */ |
| | | @PostMapping("/update") |
| | |
| | | |
| | | /** |
| | | * 新增或修改资讯信息 |
| | | * |
| | | * @param article 资讯对象信息 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入article") |
| | | public R submit(@Valid @RequestBody ArticleVo article) { |
| | | if (null==article.getId()){ |
| | | if (null==article.getCreateTime()){ |
| | | if (null == article.getId()) { |
| | | if (null == article.getCreateTime()) { |
| | | article.setCreateTime(new Date()); |
| | | } |
| | | } |
| | | //默认为正常 |
| | | article.setIswords("0"); |
| | | |
| | | if (article.getContent() != null && article.getContent() != ""){ |
| | | Map<String,String> content = new HashMap(); |
| | | if (article.getContent() != null && article.getContent() != "") { |
| | | Map<String, String> content = new HashMap(); |
| | | content = DemoApplication.interceptWords(article.getContent()); |
| | | System.out.println(content.get("iswords")); |
| | | if (content.get("iswords") == "true"){ |
| | | if (content.get("iswords") == "true") { |
| | | article.setContent(content.get("content")); |
| | | article.setIswords("1"); |
| | | article.setWordsContent(content.get("words")); |
| | |
| | | Mgcx mgcx = new Mgcx(); |
| | | mgcx.setUid(userid); |
| | | Mgcx one = mgcxService.getOne(Condition.getQueryWrapper(mgcx)); |
| | | if (one==null){ |
| | | if (one == null) { |
| | | mgcx.setUid(userid); |
| | | mgcx.setPhone(detail.getPhone()); |
| | | mgcx.setCardid(detail.getCardid()); |
| | | mgcx.setCountx(10); |
| | | mgcx.setCountx(mgcxService.sel()); |
| | | mgcx.setCounts(1); |
| | | mgcxService.save(mgcx); |
| | | } |
| | | else { |
| | | } else { |
| | | Integer counts = one.getCounts(); |
| | | int i = counts + 1; |
| | | one.setCounts(i); |
| | |
| | | |
| | | /** |
| | | * 删除资讯信息 |
| | | * |
| | | * @param ids 资讯主键id,id集合 |
| | | */ |
| | | @PostMapping("/remove") |
| | |
| | | * 批量修改评论区状态 |
| | | */ |
| | | @PostMapping("/upcomment") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids,String type) { |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, String type) { |
| | | String[] split = ids.split(","); |
| | | String strArrays = ""; |
| | | for (int i = 0; i < split.length; i++) { |
| | | strArrays += "'" + split[i] + "',"; |
| | | } |
| | | String code = strArrays.substring(0, strArrays.length() - 1); |
| | | return R.status(articleService.upcomment(code,type)); |
| | | return R.status(articleService.upcomment(code, type)); |
| | | } |
| | | } |