Commit ce50a481f8a57912645b6c8853af95f84976834f

Authored by liwei2917
2 parents 9b5ba621 ede69b2b

Merge branch 'dev'

src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
... ... @@ -14,6 +14,9 @@ import org.slf4j.Logger;
14 14 import org.slf4j.LoggerFactory;
15 15 import org.springframework.beans.factory.annotation.Autowired;
16 16 import org.springframework.stereotype.Controller;
  17 +import org.springframework.ui.Model;
  18 +import org.springframework.web.bind.annotation.GetMapping;
  19 +import org.springframework.web.bind.annotation.PathVariable;
17 20 import org.springframework.web.bind.annotation.PostMapping;
18 21 import org.springframework.web.bind.annotation.RequestBody;
19 22 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -22,6 +25,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
22 25 import java.util.Date;
23 26 import java.util.List;
24 27  
  28 +import javax.servlet.http.HttpSession;
  29 +
25 30 @Controller
26 31 @RequestMapping("/api/content")
27 32 public class ContentControllerApi {
... ... @@ -60,6 +65,7 @@ public class ContentControllerApi {
60 65 shyContent1.setContent_status(json.getInteger("contentStatus"));//当前图文的审核状态
61 66 shyContent1.setSource(json.getString("source"));//来源
62 67 shyContent1.setAuthor(json.getString("author"));//作者
  68 + shyContent1.setContent_text(json.getString("content_text"));//图文内容
63 69 String contentTime = json.getString("contentTime");//图文创建时间
64 70 if (CommonUtils.isNotEmpty(contentTime)) {
65 71 Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss");
... ... @@ -91,6 +97,7 @@ public class ContentControllerApi {
91 97 shyContent.setContent_status(json.getInteger("contentStatus"));//当前图文的审核状态
92 98 shyContent.setSource(json.getString("source"));//来源
93 99 shyContent.setAuthor(json.getString("author"));//作者
  100 + shyContent.setContent_text(json.getString("content_text"));//图文内容
94 101 String contentTime = json.getString("contentTime");//创建时间
95 102 if (CommonUtils.isNotEmpty(contentTime)) {
96 103 Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss");
... ... @@ -189,5 +196,14 @@ public class ContentControllerApi {
189 196 return new ResponseBean(ErrorEnum.ERROR);
190 197 }
191 198 }
  199 +
  200 + @GetMapping("/detail/{id}.html")
  201 + public Object getContentDetail(Model model, @PathVariable Integer id) {
  202 + System.out.println("1111");
  203 + ShyContent content = contentService.selectByPrimaryKey(id);
  204 + model.addAttribute("content", content.getContent_text());
  205 + return "html/contentPage.html";
  206 + }
  207 +
192 208  
193 209 }
... ...
src/main/java/com/cnlive/shenhe/entity/ShyContent.java
... ... @@ -107,14 +107,17 @@ public class ShyContent {
107 107 * 内容标题
108 108 */
109 109 private String title;
110   -
  110 +
111 111 /**
112 112 * sp名称
113 113 */
114 114 @Transient
115 115 private String sp_desc;
116 116  
117   -
  117 + /**
  118 + * 图文文本内容
  119 + */
  120 + private String content_text;
118 121  
119 122 /**
120 123 * @return id
... ... @@ -496,4 +499,22 @@ public class ShyContent {
496 499 public void setTitle(String title) {
497 500 this.title = title;
498 501 }
  502 +
  503 + /**
  504 + * 获取图文文本内容
  505 + *
  506 + * @return content_text - 图文文本内容
  507 + */
  508 + public String getContent_text() {
  509 + return content_text;
  510 + }
  511 +
  512 + /**
  513 + * 设置图文文本内容
  514 + *
  515 + * @param content_text 图文文本内容
  516 + */
  517 + public void setContent_text(String content_text) {
  518 + this.content_text = content_text;
  519 + }
499 520 }
500 521 \ No newline at end of file
... ...
src/main/java/com/cnlive/shenhe/job/ContentJob.java
... ... @@ -58,7 +58,7 @@ public class ContentJob {
58 58 /**
59 59 * 定时发送数美检测视频
60 60 */
61   -// @Scheduled(cron="0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次
  61 + @Scheduled(cron="0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次
62 62 public void videofilter() {
63 63 ShyContent shyContent = new ShyContent();
64 64 shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);//审核类型为机审
... ... @@ -67,7 +67,7 @@ public class ContentJob {
67 67 if (shyContentList.size() > 0) {
68 68 for (ShyContent content : shyContentList) {
69 69 logger.info("定时发送数美检测的content_id:"+content.getId());
70   - //数美图过滤
  70 + //数美图过滤
71 71 contentService.contentFilter(content,"DEFAULT_LOGO");
72 72 }
73 73 }
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
... ... @@ -23,6 +23,7 @@ import org.apache.ibatis.session.RowBounds;
23 23 import org.slf4j.Logger;
24 24 import org.slf4j.LoggerFactory;
25 25 import org.springframework.beans.factory.annotation.Autowired;
  26 +import org.springframework.beans.factory.annotation.Value;
26 27 import org.springframework.stereotype.Service;
27 28 import tk.mybatis.mapper.entity.Example;
28 29  
... ... @@ -60,6 +61,9 @@ public class ContentServiceImpl {
60 61 VideosServiceImpl videosService;
61 62 @Autowired
62 63 VideofilterServiceImpl videofilterServiceImpl;
  64 +
  65 + @Value("${spring.localhost.url}")
  66 + String localhost_url;
63 67  
64 68 public ShyContent getShyContent(ShyContent shyContent) {
65 69 List<ShyContent> shyContentList = shyContentMapper.select(shyContent);
... ... @@ -367,9 +371,10 @@ public class ContentServiceImpl {
367 371 String type="";//数美返回结果的类型
368 372 String desc="";//数美失败结果的详情
369 373 String Token_id=UUID.randomUUID().toString();
  374 + String contentUrl=localhost_url+"/api/content/detail/"+shyContent.getContent_id()+".html";
370 375 try{
371 376 //调用数美接口
372   - result = AntiFraudUtil.filterArticle(Token_id,shyContent.getContent_url(),channel);
  377 + result = AntiFraudUtil.filterArticle(Token_id,contentUrl,channel);
373 378 type=result.getString("riskLevel");
374 379 desc=result.getString("desc");//数美失败结果的详情
375 380 }catch(Exception e){
... ...
src/main/java/com/cnlive/shenhe/utils/AntiFraudUtil.java
... ... @@ -42,7 +42,7 @@ public class AntiFraudUtil {
42 42 // String btId = uuid.toString();
43 43  
44 44 // System.out.println("文本:"+AntiFraudUtil.filterText("0000001", "王八蛋", "DYNAMIC_USER") + "---");
45   -// System.out.println(AntiFraudUtil.filterArticle("000111","http://shineup.china.com.cn/WJJ/detail2_2019_08/13/1365957.html",null));
  45 +// System.out.println(AntiFraudUtil.filterArticle("000111","http://ffyl.cnlive.com/tgtw/detail2_2019_08/29/1400477.html",null));
46 46 //System.out.println("图片:"+AntiFraudUtil.filterImg("0000001", jsonArray,"DYNAMIC_BUSINESS") + "---");
47 47 //System.out.println("视频:"+AntiFraudUtil.filterVideo("http://wjj.ys1.cnliveimg.com/testVideo/test1.mp4",btId,null) + "---");
48 48 //queryVideoResult("02b649b7-3451-403e-abd0-592302cec2a0");
... ...
src/main/resources/application.properties
... ... @@ -49,6 +49,9 @@ url=http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify
49 49 platformKey =AUDIT
50 50 platformValue=10011438
51 51  
  52 +#\u672c\u673a\u5730\u5740
  53 +spring.localhost.url=http://test.shen.cnlive.com
  54 +
52 55 #\u62bd\u5e27\u5e38\u91cf
53 56 avsmple_appKey=1eac30dfbee311e7a2f0fa163e771cf9
54 57 avsmple_appSecret=28ce1e1fbee311e7a2f0fa163e771cf92ea58ebfbee311e7a2f0fa163e771cf9
... ...
src/main/resources/mapper/ShyContentMapper.xml
... ... @@ -26,5 +26,6 @@
26 26 <result column="updater" jdbcType="VARCHAR" property="updater" />
27 27 <result column="shenhe_msg" jdbcType="VARCHAR" property="shenhe_msg" />
28 28 <result column="title" jdbcType="LONGVARCHAR" property="title" />
  29 + <result column="content_text" jdbcType="LONGVARCHAR" property="content_text" />
29 30 </resultMap>
30 31 </mapper>
31 32 \ No newline at end of file
... ...
src/main/resources/templates/html/contentPage.html 0 → 100644
  1 +<!DOCTYPE HTML>
  2 +<html xmlns:th="http://www.thymeleaf.org">
  3 +<head>
  4 + <title>图文内容</title>
  5 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  6 +</head>
  7 +<body>
  8 + <div th:utext=" ${content}">3333</div>
  9 +</body>
  10 +</html>
0 11 \ No newline at end of file
... ...