jiangping
2023-12-05 6e873adc94aaeb4f918cf4fd45f7bdf936f45db4
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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;
 
import java.io.*;
import java.util.Scanner;
 
 
@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());
 
        try {
            File file = new File("D:\\doumeeplant.log");
            FileWriter out = new FileWriter(new File("D:\\out1.log"));
            BufferedWriter writer = new BufferedWriter(out);
            BufferedReader br = new BufferedReader(new FileReader(file));
                String line;
                int lineNum = 1;
                int num = 1;
                int tNum = -1;
                while ((line = br.readLine()) != null) {
                    if(line.contains("\"manager\":\"0\"") ){num++;
                        tNum++;
                        writer.write(line.replace("结果:",""));
writer.newLine();
                        System.out.printf("[%d]: %s%n", lineNum, line); // 输出这一行
                    }
                   /* if (line.contains("羚羊平台获取用户信息")) { // 如果这一行包含关键词
                        System.out.printf("[%d]: %s%n", lineNum, line); // 输出这一行
                        num++;
                        tNum++;
                    }else  if(tNum >=0 && tNum <=2){
                        System.out.printf("[%d]: %s%n", lineNum, line); // 输出这一行
                        tNum ++;
                    }
                    if(tNum ==3){
                        tNum=-1;
                    }*/
                    lineNum++;
 
                }
                out.close();
                System.out.println(num);
 
 
        }catch (Exception e){
            e.getMessage();
        }
 
    }
    /*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;
 
    }
 
}