|
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.xxl.job.core.context.XxlJobHelper;
|
|
import com.xxl.job.core.context.XxlJobHelper;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -27,6 +28,14 @@ import java.util.*;
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper, CtopOauthToken> implements ICtopOauthTokenService {
|
|
public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper, CtopOauthToken> implements ICtopOauthTokenService {
|
|
|
|
+ @Value("${bytedance.appId}")
|
|
|
|
+ private String bytedanceAppId;
|
|
|
|
+ @Value("${bytedance.secret}")
|
|
|
|
+ private String bytedanceSecret;
|
|
|
|
+ @Value("${bytedance.url.api-prefix}")
|
|
|
|
+ private String bytedanceUrlApiPrefix;
|
|
|
|
+ @Value("${bytedance.url.refresh-token}")
|
|
|
|
+ private String bytedanceUrlRefreshToken;
|
|
@Autowired
|
|
@Autowired
|
|
private CtopOauthTokenMapper ctopOauthTokenMapper;
|
|
private CtopOauthTokenMapper ctopOauthTokenMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -57,10 +66,10 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> getByteDanceAccessToken(CtopOauthToken token) {
|
|
public Map<String, Object> getByteDanceAccessToken(CtopOauthToken token) {
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
- String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + "/oauth2/refresh_token";
|
|
|
|
|
|
+ String url = bytedanceUrlApiPrefix + bytedanceUrlRefreshToken;
|
|
Map<String, Object> param = new HashMap<>();
|
|
Map<String, Object> param = new HashMap<>();
|
|
- param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
|
|
|
|
- param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
|
|
|
|
|
|
+ param.put("app_id", bytedanceAppId);
|
|
|
|
+ param.put("secret", bytedanceSecret);
|
|
param.put("grant_type", "refresh_token");
|
|
param.put("grant_type", "refresh_token");
|
|
param.put("refresh_token", token.getRefreshToken());
|
|
param.put("refresh_token", token.getRefreshToken());
|
|
String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
|
|
String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
|