AccessTokenService.java 832 Bytes
package cn.com.glsx.modules.service;

import cn.com.glsx.common.Constants;
import cn.com.glsx.common.redis.AccessTokenRedis;
import cn.com.glsx.modules.model.param.AccessToken;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 获取涂鸦令牌
 *
 * @author zhouhaibao
 * @date 2021/3/4 14:39
 */
@Service
@Slf4j
public class AccessTokenService {

    @Autowired
    private AccessTokenRedis accessTokenRedis;

    /**
     * 获取涂鸦令牌
     *
     * @return
     */
    public String getAccessToken() {
        AccessToken accessToken = accessTokenRedis.readCache(Constants.ACCESSTOKEN_REDISKEY);
        if(accessToken==null){
            return null;
        }
        return accessToken.getAccess_token();
    }

}