|
@@ -1,17 +1,11 @@
|
|
package org.jeecg.modules.ctop.controller;
|
|
package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
|
+import cn.com.ctop.common.module.entity.OauthDetail;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.mapper.UserAllocationMapper;
|
|
import cn.com.ctop.common.module.mapper.UserAllocationMapper;
|
|
-import cn.com.ctop.common.module.service.IBindAccountAuthService;
|
|
|
|
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
|
-import cn.com.ctop.common.module.service.ISysDepartService;
|
|
|
|
-import cn.com.ctop.common.module.service.ISysUserService;
|
|
|
|
-import cn.com.ctop.common.module.utils.BytedanceInterfaceConstant;
|
|
|
|
-import cn.com.ctop.common.module.utils.Check;
|
|
|
|
-import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
|
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
|
|
-import cn.com.ctop.common.module.utils.PropertiesUtils;
|
|
|
|
|
|
+import cn.com.ctop.common.module.service.*;
|
|
|
|
+import cn.com.ctop.common.module.utils.*;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
|
|
import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
|
|
@@ -69,6 +63,8 @@ public class CallbackController {
|
|
private IReportService reportService;
|
|
private IReportService reportService;
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouAppPackageService kuaishouAppPackageService;
|
|
private IKuaishouAppPackageService kuaishouAppPackageService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IOauthDetailService detailService;
|
|
|
|
|
|
@GetMapping("/qywexin")
|
|
@GetMapping("/qywexin")
|
|
public void qywexin(HttpServletRequest request,
|
|
public void qywexin(HttpServletRequest request,
|
|
@@ -120,13 +116,27 @@ public class CallbackController {
|
|
* @param state
|
|
* @param state
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+
|
|
@GetMapping("/kuaishou")
|
|
@GetMapping("/kuaishou")
|
|
public String kuaishouCallback(HttpServletRequest request, HttpServletResponse response, @RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
|
|
public String kuaishouCallback(HttpServletRequest request, HttpServletResponse response, @RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
|
|
|
|
+ Long id = Long.valueOf(state);
|
|
try {
|
|
try {
|
|
- JSONObject json = JSONObject.parseObject(state);
|
|
|
|
- if (Check.isNull(json)) {
|
|
|
|
|
|
+ // JSONObject json = JSONObject.parseObject(state);
|
|
|
|
+
|
|
|
|
+ OauthDetail byId = detailService.getById(id);
|
|
|
|
+ if (Check.isNull(byId)) {
|
|
throw new Exception("回调信息为空");
|
|
throw new Exception("回调信息为空");
|
|
}
|
|
}
|
|
|
|
+ String detailText = byId.getDetailText();
|
|
|
|
+ if (Check.isNull(detailText)) {
|
|
|
|
+ throw new Exception("用户授权信息为空");
|
|
|
|
+ }
|
|
|
|
+ JSONObject json = JSONObject.parseObject(detailText);
|
|
|
|
+ if (Check.isNull(json)) {
|
|
|
|
+ throw new Exception("数据转化异常");
|
|
|
|
+ }
|
|
|
|
+
|
|
log.info("快手授权返回信息:{}", json);
|
|
log.info("快手授权返回信息:{}", json);
|
|
log.info("快手授权返回oauthCode:{}", authCode);
|
|
log.info("快手授权返回oauthCode:{}", authCode);
|
|
Integer agentType = json.getInteger("agentType");
|
|
Integer agentType = json.getInteger("agentType");
|
|
@@ -244,11 +254,13 @@ public class CallbackController {
|
|
};
|
|
};
|
|
t.start();
|
|
t.start();
|
|
}
|
|
}
|
|
|
|
+ detailService.removeById(id);
|
|
return "授权绑定成功";
|
|
return "授权绑定成功";
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
+ detailService.removeById(id);
|
|
return "授权绑定失败!";
|
|
return "授权绑定失败!";
|
|
}
|
|
}
|
|
|
|
|