1
13693261870
2022-09-16 58d012f11dd34564d81b4eb3a6099eb689876597
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
package org.apereo.cas.web.landtool.log.service;
 
import java.util.HashMap;
import java.util.Map;
 
import org.apereo.cas.web.landtool.log.config.LogProperties;
import org.apereo.cas.web.landtool.utils.HttpUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
/**
 * @author Tanbin
 * @date  2018-12-12
 */
@Service
public class LogService {
    @Autowired
    private LogProperties logProperties;
 
    public LogService() {
 
    }
 
    public String addLog(String userId, String clientIp, int loginType, int rStatus, String browserInfo,
            String serviceUrl) {
        String result = "";
        if (!logProperties.isEnabled()) {
            return "";
        }
        String url = logProperties.getLogServiceUrl();
        Map<String, Object> params = new HashMap<>();
        params.put("loginname", userId);
        params.put("loginip", clientIp);
        params.put("logintype", loginType);
        params.put("rstatus", rStatus);
        params.put("broserversion", browserInfo);
        params.put("appurl", serviceUrl);
        try {
            result = HttpUtils.post(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
 
}