AuditPass.java
1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.cnlive.shenhe.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.entity.StringEntity;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
/**
* @Auther: chenhao
* @Date: 2018/12/3 16:00
* @Description:如果是白名单直接审核通过
*/
@Component
public class AuditPass {
@Value("${url}")
private String url;//点播url
@Value("${platformKey}")
private String platformKey;//点播platformKey
@Value("${platformValue}")
private String platformValue;//点播platformValue
@Value("${commenturl}")
private String commentUrl;
/**
* 点播视频回调
* @param activity_id
* @param state
* @param attr_tags
* @param msg
* @return
*/
public String auditPass(String activity_id,int state,String attr_tags,String msg){
String token = null;
try {
token = CommonUtils.md5(url+platformKey+platformValue);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Map<String, String> params = new HashMap<>();
params.put("activity_id",activity_id);
params.put("state",state+"");
params.put("attr_tags",attr_tags);
params.put("msg",msg);
HttpUtil httpUtil = HttpUtil.init();
String URL =url+"?platform="+platformKey+"&token="+token;
httpUtil.setParamMap(params);
Map<String, String> post = httpUtil.post(URL);
String code = post.get("code");
return code;
}
public void commentPass(JSONObject json){
HttpUtil httpUtil = HttpUtil.init();
httpUtil.setStringParam(json.toJSONString());
httpUtil.post(commentUrl);
}
}