Commit 8552e86d8adec7b8dab4985c9606e896160fcb32
1 parent
12ae5bf1
完善三方登录
Showing
4 changed files
with
14 additions
and
2 deletions
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/vo/client/SocialClientBaseVO.java
| ... | ... | @@ -24,14 +24,17 @@ public class SocialClientBaseVO { |
| 24 | 24 | @NotNull(message = "用户类型不能为空") |
| 25 | 25 | private Integer userType; |
| 26 | 26 | |
| 27 | - @Schema(description = "客户端编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "145442115") | |
| 27 | + @Schema(description = "客户端编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "wwd411c69a39ad2e54") | |
| 28 | 28 | @NotNull(message = "客户端编号不能为空") |
| 29 | 29 | private String clientId; |
| 30 | 30 | |
| 31 | - @Schema(description = "客户端密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "215151515154446") | |
| 31 | + @Schema(description = "客户端密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw") | |
| 32 | 32 | @NotNull(message = "客户端密钥不能为空") |
| 33 | 33 | private String clientSecret; |
| 34 | 34 | |
| 35 | + @Schema(description = "授权方的网页应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000045") | |
| 36 | + private String agentId; | |
| 37 | + | |
| 35 | 38 | @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 36 | 39 | @NotNull(message = "状态不能为空") |
| 37 | 40 | private Integer status; | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/social/SocialUserConvert.java
| ... | ... | @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUser |
| 9 | 9 | import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserUpdateReqVO; |
| 10 | 10 | import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO; |
| 11 | 11 | import org.mapstruct.Mapper; |
| 12 | +import org.mapstruct.Mapping; | |
| 12 | 13 | import org.mapstruct.factory.Mappers; |
| 13 | 14 | |
| 14 | 15 | import java.util.List; |
| ... | ... | @@ -18,6 +19,7 @@ public interface SocialUserConvert { |
| 18 | 19 | |
| 19 | 20 | SocialUserConvert INSTANCE = Mappers.getMapper(SocialUserConvert.class); |
| 20 | 21 | |
| 22 | + @Mapping(target = "socialType", source = "reqVO.type") | |
| 21 | 23 | SocialUserBindReqDTO convert(Long userId, Integer userType, SocialUserBindReqVO reqVO); |
| 22 | 24 | |
| 23 | 25 | SocialUserUnbindReqDTO convert(Long userId, Integer userType, SocialUserUnbindReqVO reqVO); | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SocialClientDO.java
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
| ... | ... | @@ -159,6 +159,9 @@ public class SocialClientServiceImpl implements SocialClientService { |
| 159 | 159 | // 2.2 修改对应的 clientId + clientSecret 密钥 |
| 160 | 160 | newAuthConfig.setClientId(client.getClientId()); |
| 161 | 161 | newAuthConfig.setClientSecret(client.getClientSecret()); |
| 162 | + if (client.getAgentId() != null) { // 如果有 agentId 则修改 agentId | |
| 163 | + newAuthConfig.setAgentId(client.getAgentId()); | |
| 164 | + } | |
| 162 | 165 | // 2.3 设置会 request 里,进行后续使用 |
| 163 | 166 | ReflectUtil.setFieldValue(request, "config", newAuthConfig); |
| 164 | 167 | } | ... | ... |