提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.api.social; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.exception.ServiceException; |
|
4 |
import com.iailab.framework.common.pojo.CommonResult; |
|
5 |
import com.iailab.module.system.api.social.dto.SocialUserBindReqDTO; |
|
6 |
import com.iailab.module.system.api.social.dto.SocialUserRespDTO; |
|
7 |
import com.iailab.module.system.api.social.dto.SocialUserUnbindReqDTO; |
|
8 |
import com.iailab.module.system.enums.ApiConstants; |
|
9 |
import io.swagger.v3.oas.annotations.Operation; |
|
10 |
import io.swagger.v3.oas.annotations.Parameter; |
|
11 |
import io.swagger.v3.oas.annotations.Parameters; |
|
12 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
13 |
import org.springframework.cloud.openfeign.FeignClient; |
|
14 |
import org.springframework.web.bind.annotation.*; |
|
15 |
|
|
16 |
import javax.validation.Valid; |
|
17 |
|
1ecdfb
|
18 |
@FeignClient(name = ApiConstants.NAME) |
e7c126
|
19 |
@Tag(name = "RPC 服务 - 社交用户") |
H |
20 |
public interface SocialUserApi { |
|
21 |
|
|
22 |
String PREFIX = ApiConstants.PREFIX + "/social-user"; |
|
23 |
|
|
24 |
@PostMapping(PREFIX + "/bind") |
|
25 |
@Operation(summary = "绑定社交用户") |
|
26 |
CommonResult<String> bindSocialUser(@Valid @RequestBody SocialUserBindReqDTO reqDTO); |
|
27 |
|
|
28 |
@DeleteMapping(PREFIX + "/unbind") |
|
29 |
@Operation(summary = "取消绑定社交用户") |
|
30 |
CommonResult<Boolean> unbindSocialUser(@Valid @RequestBody SocialUserUnbindReqDTO reqDTO); |
|
31 |
|
|
32 |
@GetMapping(PREFIX + "/get-by-user-id") |
|
33 |
@Operation(summary = "获得社交用户,基于 userId") |
|
34 |
@Parameters({ |
|
35 |
@Parameter(name = "userType", description = "用户类型", example = "2", required = true), |
|
36 |
@Parameter(name = "userId", description = "用户编号", example = "1024", required = true), |
|
37 |
@Parameter(name = "socialType", description = "社交平台的类型", example = "1", required = true), |
|
38 |
}) |
|
39 |
CommonResult<SocialUserRespDTO> getSocialUserByUserId(@RequestParam("userType") Integer userType, |
|
40 |
@RequestParam("userId") Long userId, |
|
41 |
@RequestParam("socialType") Integer socialType); |
|
42 |
|
|
43 |
@GetMapping(PREFIX + "/get-by-code") |
|
44 |
@Operation(summary = "获得社交用") // 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常 |
|
45 |
@Parameters({ |
|
46 |
@Parameter(name = "userType", description = "用户类型", example = "2", required = true), |
|
47 |
@Parameter(name = "socialType", description = "社交平台的类型", example = "1", required = true), |
|
48 |
@Parameter(name = "code", description = "授权码", example = "88888", required = true), |
|
49 |
@Parameter(name = "state", description = "state", example = "666", required = true), |
|
50 |
}) |
|
51 |
CommonResult<SocialUserRespDTO> getSocialUserByCode(@RequestParam("userType") Integer userType, |
|
52 |
@RequestParam("socialType") Integer socialType, |
|
53 |
@RequestParam("code") String code, |
|
54 |
@RequestParam("state") String state); |
|
55 |
|
|
56 |
} |