houzhongjian
2024-10-16 7da8f196dee8e3c526c009a4bc7f5983ece6bb97
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.system.api.social;
H 2
3 import com.iailab.framework.common.pojo.CommonResult;
4 import com.iailab.module.system.api.social.dto.SocialUserBindReqDTO;
5 import com.iailab.module.system.api.social.dto.SocialUserRespDTO;
6 import com.iailab.module.system.api.social.dto.SocialUserUnbindReqDTO;
7 import com.iailab.module.system.service.social.SocialUserService;
8 import org.springframework.validation.annotation.Validated;
9 import org.springframework.web.bind.annotation.RestController;
10
11 import javax.annotation.Resource;
12
13 import static com.iailab.framework.common.pojo.CommonResult.success;
14
15 @RestController // 提供 RESTful API 接口,给 Feign 调用
16 @Validated
17 public class SocialUserApiImpl implements SocialUserApi {
18
19     @Resource
20     private SocialUserService socialUserService;
21
22     @Override
23     public CommonResult<String> bindSocialUser(SocialUserBindReqDTO reqDTO) {
24         return success(socialUserService.bindSocialUser(reqDTO));
25     }
26
27     @Override
28     public CommonResult<Boolean> unbindSocialUser(SocialUserUnbindReqDTO reqDTO) {
29         socialUserService.unbindSocialUser(reqDTO.getUserId(), reqDTO.getUserType(),
30                 reqDTO.getSocialType(), reqDTO.getOpenid());
31         return success(true);
32     }
33
34     @Override
35     public CommonResult<SocialUserRespDTO> getSocialUserByUserId(Integer userType, Long userId, Integer socialType) {
36         return success(socialUserService.getSocialUserByUserId(userType, userId, socialType));
37     }
38
39     @Override
40     public CommonResult<SocialUserRespDTO> getSocialUserByCode(Integer userType, Integer socialType, String code, String state) {
41         return success(socialUserService.getSocialUserByCode(userType, socialType, code, state));
42     }
43
44 }