package doumeemes.core.utils.dingding; 
 | 
  
 | 
import com.alibaba.fastjson.JSONObject; 
 | 
import com.iflytek.antelope.other.client.dto.resp.Result; 
 | 
import com.iflytek.antelope.other.client.dto.resp.UserDTO; 
 | 
import com.iflytek.antelope.other.client.sdk.UserInfoSdk; 
 | 
import lombok.extern.slf4j.Slf4j; 
 | 
  
 | 
  
 | 
@Slf4j 
 | 
public class LingyangUtil { 
 | 
    public static final String LINGYANG_APPKEY = "appKey"; 
 | 
    public static final String LINGYANG_AESKEY = "aesKey"; 
 | 
    public static final String LINGYANG_SECRET = "secret"; 
 | 
  
 | 
    private String aesKey;// = "vczfadepbqrdcdae"; 
 | 
    private String appKey ;//="rqwryznqsl"; 
 | 
    private String appSecret ;//="b2da06d8bb4eae0f0701649571640a203e80ccdc"; 
 | 
  
 | 
    public static void main(String[] args) { 
 | 
        JSONObject j = new JSONObject(); 
 | 
        j.put(LINGYANG_AESKEY,"vczfadepbqrdcdae"); 
 | 
        j.put(LINGYANG_APPKEY,"rqwryznqsl"); 
 | 
        j.put(LINGYANG_SECRET,"b2da06d8bb4eae0f0701649571640a203e80ccdc"); 
 | 
        System.out.println(j.toJSONString()); 
 | 
    } 
 | 
    /*public  LingyangUtil(String param){ 
 | 
        JSONObject p = JSONObject.parseObject(param); 
 | 
        if(p !=null){ 
 | 
            this.aesKey = p.getString(LINGYANG_AESKEY); 
 | 
            this.appKey =  p.getString(LINGYANG_APPKEY); 
 | 
            this.appSecret =  p.getString(LINGYANG_SECRET); 
 | 
        } 
 | 
    }*/ 
 | 
    public  LingyangUtil(String aesKey,String appKey,String appSecret){ 
 | 
            this.aesKey =aesKey; 
 | 
            this.appKey = appKey; 
 | 
            this.appSecret = appSecret; 
 | 
    } 
 | 
    public   UserDTO getUserInfoByToken(String token)   { 
 | 
        try { 
 | 
            Result<UserDTO> result = UserInfoSdk.getUserInfo (appKey, appSecret, aesKey, token); 
 | 
            if(result!=null){ 
 | 
                log.info("羚羊平台获取用户信息:========================================================================================================" + 
 | 
                        "\ntoken:"+token+"\n结果:"+JSONObject.toJSONString(result)); 
 | 
            } 
 | 
            if(result!=null && result.getCode() == 0){ 
 | 
                return result.getResult(); 
 | 
            } 
 | 
        }catch (Exception e){ 
 | 
        } 
 | 
        return  null; 
 | 
  
 | 
    } 
 | 
} 
 |