Commit 7a00747e47d1247fa1f59eebf650164b46186bd1

Authored by 周伟鹏
1 parent 7e16cbee

回调地址修改

src/main/java/com/cnlive/shenhe/utils/AuditPass.java
@@ -6,6 +6,8 @@ import org.slf4j.LoggerFactory; @@ -6,6 +6,8 @@ import org.slf4j.LoggerFactory;
6 import org.springframework.beans.factory.annotation.Value; 6 import org.springframework.beans.factory.annotation.Value;
7 import org.springframework.stereotype.Component; 7 import org.springframework.stereotype.Component;
8 8
  9 +import java.io.UnsupportedEncodingException;
  10 +import java.security.NoSuchAlgorithmException;
9 import java.util.HashMap; 11 import java.util.HashMap;
10 import java.util.Map; 12 import java.util.Map;
11 13
@@ -18,36 +20,46 @@ import java.util.Map; @@ -18,36 +20,46 @@ import java.util.Map;
18 public class AuditPass { 20 public class AuditPass {
19 private static Logger logger = LoggerFactory.getLogger(AuditPass.class); 21 private static Logger logger = LoggerFactory.getLogger(AuditPass.class);
20 @Value("${platformKey}") 22 @Value("${platformKey}")
21 - private String platformKey;//点播platformKey 23 + private String platformKey;//点播platformKey
22 @Value("${platformValue}") 24 @Value("${platformValue}")
23 - private String platformValue;//点播platformValue  
24 - @Value("${token}")  
25 - private String token; 25 + private String platformValue;//点播platformValue
  26 +
26 /** 27 /**
27 * 点播视频回调 28 * 点播视频回调
  29 + *
28 * @param video_id 30 * @param video_id
29 * @param state 31 * @param state
30 * @param attr_tags 32 * @param attr_tags
31 * @param msg 33 * @param msg
32 * @return 34 * @return
33 */ 35 */
34 - public JSONObject auditPass(String video_id,int state,String attr_tags,String msg,String callBack){  
35 - logger.info("点播回调:video_id:{},state:{},attr_tags:{},msg:{}",video_id,state,attr_tags,msg); 36 + public JSONObject auditPass(String video_id, int state, String attr_tags, String msg, String callBack) {
  37 + logger.info("点播回调:video_id:{},state:{},attr_tags:{},msg:{}", video_id, state, attr_tags, msg);
36 JSONObject params = new JSONObject(); 38 JSONObject params = new JSONObject();
37 - params.put("video_id",video_id);  
38 - params.put("state",state+"");  
39 - params.put("attr_tags",attr_tags);  
40 - params.put("msg",msg); 39 + params.put("video_id", video_id);
  40 + params.put("state", state + "");
  41 + params.put("attr_tags", attr_tags);
  42 + params.put("msg", msg);
41 HttpUtil httpUtil = HttpUtil.init(); 43 HttpUtil httpUtil = HttpUtil.init();
42 - httpUtil.setParam("param",params.toJSONString());  
43 - String URL =callBack+"?platform="+platformKey+"&token="+token; 44 + httpUtil.setParam("param", params.toJSONString());
  45 + String token = "";
  46 + try {
  47 + String cb = callBack.replace("//", "");
  48 + cb.substring(cb.indexOf("/"));
  49 + token = CommonUtils.md5(cb + platformKey + platformValue);
  50 + } catch (NoSuchAlgorithmException e) {
  51 + e.printStackTrace();
  52 + } catch (UnsupportedEncodingException e) {
  53 + e.printStackTrace();
  54 + }
  55 + String URL = callBack + "?platform=" + platformKey + "&token=" + token;
44 Map<String, String> post = httpUtil.post(URL); 56 Map<String, String> post = httpUtil.post(URL);
45 - return JSONObject.parseObject(post.get("result")); 57 + return JSONObject.parseObject(post.get("result"));
46 } 58 }
47 59
48 - public JSONObject commentPass(JSONObject json,String callBack){ 60 + public JSONObject commentPass(JSONObject json, String callBack) {
49 Map<String, String> map = new HashMap<>(); 61 Map<String, String> map = new HashMap<>();
50 - map.put("param",json.toJSONString()); 62 + map.put("param", json.toJSONString());
51 String result = HttpUtil.form(callBack, map); 63 String result = HttpUtil.form(callBack, map);
52 return JSONObject.parseObject(result); 64 return JSONObject.parseObject(result);
53 } 65 }
src/main/resources/application.properties
@@ -27,7 +27,6 @@ sync_users_app_key=314a9dd4-a9b7-4c12-bbbe-1150a36491ae @@ -27,7 +27,6 @@ sync_users_app_key=314a9dd4-a9b7-4c12-bbbe-1150a36491ae
27 url=http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify 27 url=http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify
28 platformKey =AUDIT 28 platformKey =AUDIT
29 platformValue=10011438 29 platformValue=10011438
30 -token=2718c88930175686e40398994cead75c  
31 30
32 #ÆÀÂۻص÷µØÖ· 31 #ÆÀÂۻص÷µØÖ·
33 commenturl=http://comment.cnlive.com/services/commentForHd/auditCallBack 32 commenturl=http://comment.cnlive.com/services/commentForHd/auditCallBack
34 \ No newline at end of file 33 \ No newline at end of file