jiangping
2023-08-10 e3523883aadf423cb78647c38f0648c2143d2a89
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
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;
 
    }
}