AccessTokenService.java
984 Bytes
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
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 cn.com.glsx.modules.model.param.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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();
}
}