Browse Source

修改代理商授权

yumeng 3 years ago
parent
commit
31ea717581

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/OauthAgentToken.java

@@ -76,6 +76,11 @@ public class OauthAgentToken {
     @Excel(name = "代理商类型 0:三方代理商 1:本代理商", width = 15)
     @ApiModelProperty(value = "代理商类型 0:三方代理商 1:本代理商")
     private Integer agentType;
+
+
+    private  Long appId;
+    private String secret;
+
     /**
      * 创建时间
      */

+ 3 - 3
module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java

@@ -38,15 +38,15 @@ public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
 
     CtopOauthToken selectOneByMediaId(String platformTypeKuaishou);
 
-    void getKuaiShouAgentRefreshToken(Long agentId, String accessToken, String refreshToken);
+    void getKuaiShouAgentRefreshToken(Long agentId, String accessToken, String refreshToken, Long appId, String secret);
 
     /**
-     *查询 快手 有效规则帐户token
+     * 查询 快手 有效规则帐户token
      */
     List<CtopOauthToken> queryKsValidRuleAccountsToken();
 
     /**
-     *查询 头条 有效规则帐户token
+     * 查询 头条 有效规则帐户token
      */
     List<CtopOauthToken> queryTtValidRuleAccountsToken();
 }

+ 3 - 6
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -7,7 +7,6 @@ import cn.com.ctop.common.module.mapper.OauthAgentTokenMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -18,8 +17,6 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 /**
  * @Description: oauth授权码
@@ -248,15 +245,15 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
     }
 
     @Override
-    public void getKuaiShouAgentRefreshToken(Long agentId, String accessToken, String refreshToken) {
+    public void getKuaiShouAgentRefreshToken(Long agentId, String accessToken, String refreshToken, Long appId, String secret) {
         log.info("快手刷新token入参,token:{},refreshToken:{}", accessToken, refreshToken);
         String url = kuaishouApiUrl + "/rest/openapi/oauth2/authorize/refresh_token";
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", " application/json");
         Map<String, Object> param = new HashMap<>();
 
-        param.put("app_id", PropertiesUtils.getConfig("kuaishou_appid"));
-        param.put("secret", PropertiesUtils.getConfig("kuaishou_secret"));
+        param.put("app_id", agentId);
+        param.put("secret", secret);
         param.put("refresh_token", refreshToken);
         try {
             String result = HttpUtils.httpPostRequest(url, param, headers);

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/RefreshTokenServiceImpl.java

@@ -88,7 +88,7 @@ public class RefreshTokenServiceImpl implements IRefreshTokenService {
         List<OauthAgentToken> list = agentTokenService.list(agentTokenQueryWrapper);
         if (!Check.isNull(list)) {
             for (OauthAgentToken agentToken : list) {
-                oauthTokenService.getKuaiShouAgentRefreshToken(agentToken.getAgentId(), agentToken.getAccessToken(), agentToken.getRefreshToken());
+                oauthTokenService.getKuaiShouAgentRefreshToken(agentToken.getAgentId(), agentToken.getAccessToken(), agentToken.getRefreshToken(),agentToken.getAppId(),agentToken.getSecret());
 
             }