package com.qmth.paper.library.common.util;

import com.qmth.boot.core.enums.Platform;
import com.qmth.paper.library.common.bean.auth.ExpireTimeBean;
import com.qmth.paper.library.common.contant.SystemConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Calendar;
import java.util.Date;

/**
 * @Description: 鉴权工具类util
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/11/12
 */
public class AuthUtil {
    private final static Logger log = LoggerFactory.getLogger(AuthUtil.class);

    /**
     * 获取过期时间
     *
     * @param platform
     * @return
     */
    public static ExpireTimeBean getExpireTime(Platform platform) {
        ExpireTimeBean expireTimeBean = new ExpireTimeBean();
        Date now = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(now);
        calendar.add(Calendar.DAY_OF_YEAR, SystemConstant.DEFAULT_SESSION_EXPIRE);
        expireTimeBean.setDate(calendar.getTime());
        expireTimeBean.setExpireSeconds(SystemConstant.REDIS_DEFAULT_EXPIRE_TIME);
        return expireTimeBean;
    }
}
