Commit b7545fce5afd4f70b983bf78353162f5bc8062de

Authored by 陈浩
1 parent 00e9351b

update

src/main/java/com/cnlive/shenhe/controller/VideosController.java
@@ -23,7 +23,8 @@ import java.util.List; @@ -23,7 +23,8 @@ import java.util.List;
23 @RequestMapping("/videos") 23 @RequestMapping("/videos")
24 public class VideosController { 24 public class VideosController {
25 25
26 - 26 + @Autowired
  27 + AuditPass Pass;
27 @Autowired 28 @Autowired
28 VideosServiceImpl videosService; 29 VideosServiceImpl videosService;
29 @PostMapping("/import") 30 @PostMapping("/import")
@@ -42,7 +43,7 @@ public class VideosController { @@ -42,7 +43,7 @@ public class VideosController {
42 List<String> asList = Arrays.asList(business); 43 List<String> asList = Arrays.asList(business);
43 if(asList.contains(CommonConst.BUSINESS_VIDEO+"")){ 44 if(asList.contains(CommonConst.BUSINESS_VIDEO+"")){
44 shyVideos.setState(CommonConst.AUDIT_SUCCESS); 45 shyVideos.setState(CommonConst.AUDIT_SUCCESS);
45 - AuditPass.auditPass(json.getString("videoId"),CommonConst.AUDIT_SUCCESS,"",""); 46 + Pass.auditPass(json.getString("videoId"),CommonConst.AUDIT_SUCCESS,"","");
46 }else { 47 }else {
47 shyVideos.setState(CommonConst.AUDIT_INTT); 48 shyVideos.setState(CommonConst.AUDIT_INTT);
48 } 49 }
@@ -69,7 +70,7 @@ public class VideosController { @@ -69,7 +70,7 @@ public class VideosController {
69 @RequestMapping("/shenheNotify") 70 @RequestMapping("/shenheNotify")
70 @ResponseBody 71 @ResponseBody
71 public ResponseBean shenheInfo(String activity_id,int state,String attr_tags,String msg){ 72 public ResponseBean shenheInfo(String activity_id,int state,String attr_tags,String msg){
72 - String code = AuditPass.auditPass(activity_id, state, attr_tags, msg); 73 + String code = Pass.auditPass(activity_id, state, attr_tags, msg);
73 if(code.equals("-1")){ 74 if(code.equals("-1")){
74 return new ResponseBean(ErrorEnum.ERROR); 75 return new ResponseBean(ErrorEnum.ERROR);
75 } 76 }
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
1 package com.cnlive.shenhe.utils; 1 package com.cnlive.shenhe.utils;
2 2
3 import org.springframework.beans.factory.annotation.Value; 3 import org.springframework.beans.factory.annotation.Value;
  4 +import org.springframework.stereotype.Component;
4 5
5 import java.io.UnsupportedEncodingException; 6 import java.io.UnsupportedEncodingException;
6 import java.security.NoSuchAlgorithmException; 7 import java.security.NoSuchAlgorithmException;
@@ -12,15 +13,16 @@ import java.util.Map; @@ -12,15 +13,16 @@ import java.util.Map;
12 * @Date: 2018/12/3 16:00 13 * @Date: 2018/12/3 16:00
13 * @Description:如果是白名单直接审核通过 14 * @Description:如果是白名单直接审核通过
14 */ 15 */
  16 +@Component
15 public class AuditPass { 17 public class AuditPass {
16 18
17 @Value("${url}") 19 @Value("${url}")
18 - private static String url; 20 + private String url;
19 @Value("${platformKey}") 21 @Value("${platformKey}")
20 - private static String platformKey; 22 + private String platformKey;
21 @Value("${platformValue}") 23 @Value("${platformValue}")
22 - private static String platformValue;  
23 - public static String auditPass(String activity_id,int state,String attr_tags,String msg){ 24 + private String platformValue;
  25 + public String auditPass(String activity_id,int state,String attr_tags,String msg){
24 String token = null; 26 String token = null;
25 try { 27 try {
26 token = CommonUtils.md5(url+platformKey+platformValue); 28 token = CommonUtils.md5(url+platformKey+platformValue);
@@ -35,7 +37,7 @@ public class AuditPass { @@ -35,7 +37,7 @@ public class AuditPass {
35 params.put("attr_tags",attr_tags); 37 params.put("attr_tags",attr_tags);
36 params.put("msg",msg); 38 params.put("msg",msg);
37 HttpUtil httpUtil = HttpUtil.init(); 39 HttpUtil httpUtil = HttpUtil.init();
38 - String URL =url+"platform="+platformKey+"&token="+token; 40 + String URL =url+"?platform="+platformKey+"&token="+token;
39 httpUtil.setParamMap(params); 41 httpUtil.setParamMap(params);
40 Map<String, String> post = httpUtil.post(URL); 42 Map<String, String> post = httpUtil.post(URL);
41 String code = post.get("code"); 43 String code = post.get("code");