# Conflicts:
#	yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/vo/client/SocialClientRespVO.java
This commit is contained in:
YunaiV
2025-11-29 09:56:44 +08:00
4 changed files with 27 additions and 4 deletions

View File

@@ -27,12 +27,12 @@ public class SocialClientRespVO {
@Schema(description = "客户端密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "peter")
private String clientSecret;
@Schema(description = "publicKey公钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000045")
private String publicKey;
@Schema(description = "授权方的网页应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000045")
@Schema(description = "授权方的网页应用编号", example = "2000045")
private String agentId;
@Schema(description = "publicKey 公钥", example = "2000045")
private String publicKey;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;

View File

@@ -48,6 +48,9 @@ public class SocialClientSaveReqVO {
@Schema(description = "授权方的网页应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000045")
private String agentId;
@Schema(description = "publicKey 公钥", example = "2000045")
private String publicKey;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
@InEnum(CommonStatusEnum.class)
@@ -61,4 +64,12 @@ public class SocialClientSaveReqVO {
|| !StrUtil.isEmpty(agentId);
}
@AssertTrue(message = "publicKey 不能为空")
@JsonIgnore
public boolean isPublicKeyValid() {
// 如果是支付宝,必须填写 publicKey 属性
return !Objects.equals(socialType, SocialTypeEnum.ALIPAY.getType())
|| !StrUtil.isEmpty(publicKey);
}
}

View File

@@ -81,4 +81,12 @@ public class SocialClientDO extends TenantBaseDO {
*/
private String agentId;
/**
* publicKey 公钥
*
* 目前只有部分“社交类型”在使用:
* 1. 支付宝:支付宝公钥
*/
private String publicKey;
}

View File

@@ -210,6 +210,10 @@ public class SocialClientServiceImpl implements SocialClientService {
return new AuthAlipayRequest(newAuthConfig, client.getPublicKey());
}
// 2.3 设置会 request 里,进行后续使用
if (SocialTypeEnum.ALIPAY_MINI_PROGRAM.getType().equals(socialType)) {
// 特殊:如果是支付宝的小程序,多了 publicKey 属性,可见 AuthConfig 里的 alipayPublicKey 字段说明
return new AuthAlipayRequest(newAuthConfig, client.getPublicKey());
}
ReflectUtil.setFieldValue(request, "config", newAuthConfig);
}
return request;