package com.ssyf.common.web.filter;

import cn.hutool.extra.servlet.ServletUtil;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;

/**
 * 
 * @author huwei
 * @date 2023/9/2 20:41
 */
@Data
@Accessors(chain = true)
public class RequestContext {

    private HttpServletRequest request;

    private HttpServletResponse response;

    /**
     * 进入业务时间
     */
    private LocalDateTime enterTime = LocalDateTime.now();

    /**
     * 获取客户端ip地址
     * @return
     */
    public String getClientIp() {
        return ServletUtil.getClientIP(request);
    }
}