1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-21 01:10:39 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

第三方账号取消授权功能完成

This commit is contained in:
2022-04-04 23:23:41 +08:00
parent 7cca39d2de
commit 3986458622
7 changed files with 94 additions and 1 deletions

View File

@@ -93,6 +93,21 @@ public class ThirdPartyController extends BaseController {
return CommonReturnType.create(bindingPlatformList);
}
@ApiOperation(value = "取消第三方平台绑定", notes = "传入当前登录用户 token 和平台 platform (不区分大小写),返回 bool 值true 为取消绑定成功")
@RequestMapping(value = "withdrawThirdPartyBings", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
@ResponseBody
public CommonReturnType unbindThirdPartAccount(@RequestParam(value = "token", required = true) String token,
@RequestParam(value = "platform", required = true) String platform) throws BusinessException {
if(platform == null || platform.isEmpty()){
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "参数错误,第三方平台不能为空");
}
Boolean isSuccess = thirdPartyUserService.unbindThirdPartAccount(token, platform);
if(!isSuccess){
throw new BusinessException(BusinessErrorCode.THIRD_PARTY_UNBIND_FAIL, "取消绑定失败,系统错误");
}
return CommonReturnType.create("success");
}
// 创建授权request
private AuthRequest getAuthRequest(String platform) throws BusinessException {
switch (platform.toLowerCase()) {