AuditPass.java 1.43 KB
package com.cnlive.shenhe.utils;

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;
    @Value("${platformKey}")
    private  String platformKey;
    @Value("${platformValue}")
    private  String platformValue;
    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;
    }
}