mirror of
https://gitee.com/zhijiantianya/yudao-cloud.git
synced 2025-12-25 23:00:06 +08:00
feat:【SocialClient】 支付宝小程序登录补充
This commit is contained in:
parent
16e66ba175
commit
f4ba70ec5a
@ -1240,6 +1240,7 @@ INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_t
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3000, 16, '百川智能', 'BaiChuan', 'ai_platform', 0, '', '', '', '1', '2025-03-23 12:15:46', '1', '2025-03-23 12:15:46', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3001, 50, 'Vben5.0 Ant Design Schema 模版', '40', 'infra_codegen_front_type', 0, '', '', NULL, '1', '2025-04-23 21:47:47', '1', '2025-05-02 12:01:15', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3002, 6, '支付宝余额', '6', 'brokerage_withdraw_type', 0, '', '', 'API 打款', '1', '2025-05-10 08:24:49', '1', '2025-05-10 08:24:49', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3035, 40, '支付宝小程序', '40', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:38', '1', '2023-11-04 13:07:16', '0');
|
||||
COMMIT;
|
||||
SET IDENTITY_INSERT system_dict_data OFF;
|
||||
-- @formatter:on
|
||||
@ -4179,7 +4180,8 @@ CREATE TABLE system_social_client
|
||||
social_type smallint NOT NULL,
|
||||
user_type smallint NOT NULL,
|
||||
client_id varchar(255) NOT NULL,
|
||||
client_secret varchar(255) NOT NULL,
|
||||
client_secret varchar(2048) NOT NULL,
|
||||
public_key varchar(2048) DEFAULT NULL NULL,
|
||||
agent_id varchar(255) DEFAULT NULL NULL,
|
||||
status smallint NOT NULL,
|
||||
creator varchar(64) DEFAULT '' NULL,
|
||||
@ -4195,6 +4197,7 @@ COMMENT ON COLUMN system_social_client.name IS '应用名';
|
||||
COMMENT ON COLUMN system_social_client.social_type IS '社交平台的类型';
|
||||
COMMENT ON COLUMN system_social_client.user_type IS '用户类型';
|
||||
COMMENT ON COLUMN system_social_client.client_id IS '客户端编号';
|
||||
COMMENT ON COLUMN system_social_client.public_key IS 'publicKey公钥';
|
||||
COMMENT ON COLUMN system_social_client.client_secret IS '客户端密钥';
|
||||
COMMENT ON COLUMN system_social_client.agent_id IS '代理编号';
|
||||
COMMENT ON COLUMN system_social_client.status IS '状态';
|
||||
|
||||
@ -1354,6 +1354,7 @@ INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_t
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3000, 16, '百川智能', 'BaiChuan', 'ai_platform', 0, '', '', '', '1', '2025-03-23 12:15:46', '1', '2025-03-23 12:15:46', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3001, 50, 'Vben5.0 Ant Design Schema 模版', '40', 'infra_codegen_front_type', 0, '', '', NULL, '1', '2025-04-23 21:47:47', '1', '2025-05-02 12:01:15', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3002, 6, '支付宝余额', '6', 'brokerage_withdraw_type', 0, '', '', 'API 打款', '1', '2025-05-10 08:24:49', '1', '2025-05-10 08:24:49', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3035, 40, '支付宝小程序', 40, '', '', '', '1', '2023-11-04 13:05:38', '1', '2023-11-04 13:07:16', '0');
|
||||
COMMIT;
|
||||
-- @formatter:on
|
||||
|
||||
@ -4461,7 +4462,8 @@ CREATE TABLE system_social_client
|
||||
social_type int2 NOT NULL,
|
||||
user_type int2 NOT NULL,
|
||||
client_id varchar(255) NOT NULL,
|
||||
client_secret varchar(255) NOT NULL,
|
||||
client_secret varchar(2048) NOT NULL,
|
||||
public_key varchar(2048) NULL DEFAULT NULL,
|
||||
agent_id varchar(255) NULL DEFAULT NULL,
|
||||
status int2 NOT NULL,
|
||||
creator varchar(64) NULL DEFAULT '',
|
||||
@ -4481,6 +4483,7 @@ COMMENT ON COLUMN system_social_client.social_type IS '社交平台的类型';
|
||||
COMMENT ON COLUMN system_social_client.user_type IS '用户类型';
|
||||
COMMENT ON COLUMN system_social_client.client_id IS '客户端编号';
|
||||
COMMENT ON COLUMN system_social_client.client_secret IS '客户端密钥';
|
||||
COMMENT ON COLUMN system_social_client.public_key IS 'publicKey公钥';
|
||||
COMMENT ON COLUMN system_social_client.agent_id IS '代理编号';
|
||||
COMMENT ON COLUMN system_social_client.status IS '状态';
|
||||
COMMENT ON COLUMN system_social_client.creator IS '创建者';
|
||||
|
||||
@ -1092,6 +1092,7 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3032, 50, 'Vben5.0 Element Plus Schema 模版', '50', 'infra_codegen_front_type', 0, '', '', '', '1', '2025-09-04 23:26:38', '1', '2025-09-04 23:26:38', b'0');
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3033, 51, 'Vben5.0 Element Plus 标准模版', '51', 'infra_codegen_front_type', 0, '', '', '', '1', '2025-09-04 23:26:49', '1', '2025-09-04 23:26:49', b'0');
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3034, 1, 'ttt', 'tt', 'iot_ota_task_record_status', 0, 'success', '', NULL, '1', '2025-09-06 00:02:21', '1', '2025-09-06 00:02:31', b'0');
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3035, 40, '支付宝小程序', '40', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:38', '1', '2023-11-04 13:07:16', b'0');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@ -3669,7 +3670,8 @@ CREATE TABLE `system_social_client` (
|
||||
`social_type` tinyint NOT NULL COMMENT '社交平台的类型',
|
||||
`user_type` tinyint NOT NULL COMMENT '用户类型',
|
||||
`client_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端编号',
|
||||
`client_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端密钥',
|
||||
`client_secret` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端密钥',
|
||||
`public_key` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT 'publicKey公钥',
|
||||
`agent_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '代理编号',
|
||||
`status` tinyint NOT NULL COMMENT '状态',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
|
||||
@ -1354,6 +1354,7 @@ INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_t
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3000, 16, '百川智能', 'BaiChuan', 'ai_platform', 0, '', '', '', '1', '2025-03-23 12:15:46', '1', '2025-03-23 12:15:46', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3001, 50, 'Vben5.0 Ant Design Schema 模版', '40', 'infra_codegen_front_type', 0, '', '', NULL, '1', '2025-04-23 21:47:47', '1', '2025-05-02 12:01:15', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3002, 6, '支付宝余额', '6', 'brokerage_withdraw_type', 0, '', '', 'API 打款', '1', '2025-05-10 08:24:49', '1', '2025-05-10 08:24:49', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3035, 40, '支付宝小程序', '40', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:38', '1', '2023-11-04 13:07:16', '0');
|
||||
COMMIT;
|
||||
-- @formatter:on
|
||||
|
||||
@ -4461,7 +4462,8 @@ CREATE TABLE system_social_client
|
||||
social_type int2 NOT NULL,
|
||||
user_type int2 NOT NULL,
|
||||
client_id varchar(255) NOT NULL,
|
||||
client_secret varchar(255) NOT NULL,
|
||||
client_secret varchar(2048) NOT NULL,
|
||||
public_key varchar(2048) NULL DEFAULT NULL,
|
||||
agent_id varchar(255) NULL DEFAULT NULL,
|
||||
status int2 NOT NULL,
|
||||
creator varchar(64) NULL DEFAULT '',
|
||||
@ -4481,6 +4483,7 @@ COMMENT ON COLUMN system_social_client.social_type IS '社交平台的类型';
|
||||
COMMENT ON COLUMN system_social_client.user_type IS '用户类型';
|
||||
COMMENT ON COLUMN system_social_client.client_id IS '客户端编号';
|
||||
COMMENT ON COLUMN system_social_client.client_secret IS '客户端密钥';
|
||||
COMMENT ON COLUMN system_social_client.public_key IS 'publicKey公钥';
|
||||
COMMENT ON COLUMN system_social_client.agent_id IS '代理编号';
|
||||
COMMENT ON COLUMN system_social_client.status IS '状态';
|
||||
COMMENT ON COLUMN system_social_client.creator IS '创建者';
|
||||
|
||||
@ -1306,6 +1306,7 @@ INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_t
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3000, 16, '百川智能', 'BaiChuan', 'ai_platform', 0, '', '', '', '1', to_date('2025-03-23 12:15:46', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2025-03-23 12:15:46', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3001, 50, 'Vben5.0 Ant Design Schema 模版', '40', 'infra_codegen_front_type', 0, '', '', NULL, '1', to_date('2025-04-23 21:47:47', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2025-05-02 12:01:15', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3002, 6, '支付宝余额', '6', 'brokerage_withdraw_type', 0, '', '', 'API 打款', '1', to_date('2025-05-10 08:24:49', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2025-05-10 08:24:49', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3035, 40, '支付宝小程序', '40', 'system_social_type', 0, '', '', '', '1', to_date('2023-11-04 13:05:38', 'SYYYY-MM-DD HH24:MI:SS'), '1', to_date('2023-11-04 13:07:16', 'SYYYY-MM-DD HH24:MI:SS'), '0');
|
||||
COMMIT;
|
||||
-- @formatter:on
|
||||
|
||||
@ -4355,7 +4356,8 @@ CREATE TABLE system_social_client
|
||||
social_type smallint NOT NULL,
|
||||
user_type smallint NOT NULL,
|
||||
client_id varchar2(255) NULL,
|
||||
client_secret varchar2(255) NULL,
|
||||
client_secret varchar2(2048) NULL,
|
||||
public_key varchar2(2048) DEFAULT NULL NULL,
|
||||
agent_id varchar2(255) DEFAULT NULL NULL,
|
||||
status smallint NOT NULL,
|
||||
creator varchar2(64) DEFAULT '' NULL,
|
||||
@ -4375,6 +4377,7 @@ COMMENT ON COLUMN system_social_client.social_type IS '社交平台的类型';
|
||||
COMMENT ON COLUMN system_social_client.user_type IS '用户类型';
|
||||
COMMENT ON COLUMN system_social_client.client_id IS '客户端编号';
|
||||
COMMENT ON COLUMN system_social_client.client_secret IS '客户端密钥';
|
||||
COMMENT ON COLUMN system_social_client.public_key IS 'publicKey公钥';
|
||||
COMMENT ON COLUMN system_social_client.agent_id IS '代理编号';
|
||||
COMMENT ON COLUMN system_social_client.status IS '状态';
|
||||
COMMENT ON COLUMN system_social_client.creator IS '创建者';
|
||||
|
||||
@ -1354,6 +1354,7 @@ INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_t
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3000, 16, '百川智能', 'BaiChuan', 'ai_platform', 0, '', '', '', '1', '2025-03-23 12:15:46', '1', '2025-03-23 12:15:46', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3001, 50, 'Vben5.0 Ant Design Schema 模版', '40', 'infra_codegen_front_type', 0, '', '', NULL, '1', '2025-04-23 21:47:47', '1', '2025-05-02 12:01:15', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3002, 6, '支付宝余额', '6', 'brokerage_withdraw_type', 0, '', '', 'API 打款', '1', '2025-05-10 08:24:49', '1', '2025-05-10 08:24:49', '0');
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3035, 40, '支付宝小程序', '40', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:38', '1', '2023-11-04 13:07:16', '0');
|
||||
COMMIT;
|
||||
-- @formatter:on
|
||||
|
||||
@ -4461,7 +4462,8 @@ CREATE TABLE system_social_client
|
||||
social_type int2 NOT NULL,
|
||||
user_type int2 NOT NULL,
|
||||
client_id varchar(255) NOT NULL,
|
||||
client_secret varchar(255) NOT NULL,
|
||||
client_secret varchar(2048) NOT NULL,
|
||||
public_key varchar(2048) NULL DEFAULT NULL,
|
||||
agent_id varchar(255) NULL DEFAULT NULL,
|
||||
status int2 NOT NULL,
|
||||
creator varchar(64) NULL DEFAULT '',
|
||||
@ -4481,6 +4483,7 @@ COMMENT ON COLUMN system_social_client.social_type IS '社交平台的类型';
|
||||
COMMENT ON COLUMN system_social_client.user_type IS '用户类型';
|
||||
COMMENT ON COLUMN system_social_client.client_id IS '客户端编号';
|
||||
COMMENT ON COLUMN system_social_client.client_secret IS '客户端密钥';
|
||||
COMMENT ON COLUMN system_social_client.public_key IS 'publicKey公钥';
|
||||
COMMENT ON COLUMN system_social_client.agent_id IS '代理编号';
|
||||
COMMENT ON COLUMN system_social_client.status IS '状态';
|
||||
COMMENT ON COLUMN system_social_client.creator IS '创建者';
|
||||
|
||||
@ -3299,6 +3299,8 @@ INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_t
|
||||
GO
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3002, 6, N'支付宝余额', N'6', N'brokerage_withdraw_type', 0, N'', N'', N'API 打款', N'1', N'2025-05-10 08:24:49', N'1', N'2025-05-10 08:24:49', N'0')
|
||||
GO
|
||||
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted) VALUES (3035, 40, N'支付宝小程序', N'40', N'system_social_type', 0, N'', N'', N'', N'1', N'2023-11-04 13:05:38', N'1', N'2023-11-04 13:07:16', N'0')
|
||||
GO
|
||||
SET IDENTITY_INSERT system_dict_data OFF
|
||||
GO
|
||||
COMMIT
|
||||
@ -10433,7 +10435,8 @@ CREATE TABLE system_social_client
|
||||
social_type tinyint NOT NULL,
|
||||
user_type tinyint NOT NULL,
|
||||
client_id nvarchar(255) NOT NULL,
|
||||
client_secret nvarchar(255) NOT NULL,
|
||||
client_secret nvarchar(2048) NOT NULL,
|
||||
public_key nvarchar(2048) DEFAULT NULL NULL,
|
||||
agent_id nvarchar(255) DEFAULT NULL NULL,
|
||||
status tinyint NOT NULL,
|
||||
creator nvarchar(64) DEFAULT '' NULL,
|
||||
@ -10487,6 +10490,13 @@ EXEC sp_addextendedproperty
|
||||
'COLUMN', N'client_secret'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'publicKey公钥',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'system_social_client',
|
||||
'COLUMN', N'public_key'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'代理编号',
|
||||
'SCHEMA', N'dbo',
|
||||
|
||||
@ -53,6 +53,12 @@ public enum SocialTypeEnum implements ArrayValuable<Integer> {
|
||||
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html">接入文档</a>
|
||||
*/
|
||||
WECHAT_MINI_PROGRAM(34, "WECHAT_MINI_PROGRAM"),
|
||||
/**
|
||||
* 支付宝小程序
|
||||
*
|
||||
* @see <a href="https://opendocs.alipay.com/mini/05dxgc?pathHash=1a3ecb13">接入文档</a>
|
||||
*/
|
||||
ALIPAY_MINI_PROGRAM(40, "ALIPAY"),
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(SocialTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
@ -27,9 +27,12 @@ public class SocialClientRespVO {
|
||||
@Schema(description = "客户端密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "peter")
|
||||
private String clientSecret;
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
@ -45,6 +45,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)
|
||||
@ -58,4 +61,12 @@ public class SocialClientSaveReqVO {
|
||||
|| !StrUtil.isEmpty(agentId);
|
||||
}
|
||||
|
||||
@AssertTrue(message = "publicKey 不能为空")
|
||||
@JsonIgnore
|
||||
public boolean isPublicKeyValid() {
|
||||
// 如果是支付宝,必须填写 publicKey 属性
|
||||
return !Objects.equals(socialType, SocialTypeEnum.ALIPAY_MINI_PROGRAM.getType())
|
||||
|| !StrUtil.isEmpty(publicKey);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -73,4 +73,12 @@ public class SocialClientDO extends TenantBaseDO {
|
||||
*/
|
||||
private String agentId;
|
||||
|
||||
/**
|
||||
* publicKey 公钥
|
||||
*
|
||||
* 目前只有部分“社交类型”在使用:
|
||||
* 1. 支付宝:支付宝公钥
|
||||
*/
|
||||
private String publicKey;
|
||||
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
|
||||
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
@ -52,6 +51,7 @@ import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthAlipayRequest;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -169,7 +169,7 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
public AuthUser getAuthUser(Integer socialType, Integer userType, String code, String state) {
|
||||
// 构建请求
|
||||
AuthRequest authRequest = buildAuthRequest(socialType, userType);
|
||||
AuthCallback authCallback = AuthCallback.builder().code(code).state(state).build();
|
||||
AuthCallback authCallback = AuthCallback.builder().code(code).auth_code(code).state(state).build();
|
||||
// 执行请求
|
||||
AuthResponse<?> authResponse = authRequest.login(authCallback);
|
||||
log.info("[getAuthUser][请求社交平台 type({}) request({}) response({})]", socialType,
|
||||
@ -206,6 +206,10 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
newAuthConfig.setAgentId(client.getAgentId());
|
||||
}
|
||||
// 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;
|
||||
|
||||
@ -180,6 +180,12 @@ justauth:
|
||||
client-id: ${wx.mp.app-id}
|
||||
client-secret: ${wx.mp.secret}
|
||||
ignore-check-redirect-uri: true
|
||||
ALIPAY: # 支付宝小程序
|
||||
client-id: xx
|
||||
client-secret: xx
|
||||
alipay-public-key: xx
|
||||
ignore-check-redirect-uri: true
|
||||
ignore-check-state: true
|
||||
cache:
|
||||
type: REDIS
|
||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||
|
||||
@ -209,6 +209,12 @@ justauth:
|
||||
client-id: ${wx.mp.app-id}
|
||||
client-secret: ${wx.mp.secret}
|
||||
ignore-check-redirect-uri: true
|
||||
ALIPAY: # 支付宝小程序
|
||||
client-id: xx
|
||||
client-secret: xx
|
||||
alipay-public-key: xx
|
||||
ignore-check-redirect-uri: true
|
||||
ignore-check-state: true
|
||||
cache:
|
||||
type: REDIS
|
||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||
|
||||
@ -175,6 +175,12 @@ justauth:
|
||||
client-id: ${wx.mp.app-id}
|
||||
client-secret: ${wx.mp.secret}
|
||||
ignore-check-redirect-uri: true
|
||||
ALIPAY: # 支付宝小程序
|
||||
client-id: xx
|
||||
client-secret: xx
|
||||
alipay-public-key: xx
|
||||
ignore-check-redirect-uri: true
|
||||
ignore-check-state: true
|
||||
cache:
|
||||
type: REDIS
|
||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||
|
||||
@ -237,6 +237,12 @@ justauth:
|
||||
client-id: ${wx.mp.app-id}
|
||||
client-secret: ${wx.mp.secret}
|
||||
ignore-check-redirect-uri: true
|
||||
ALIPAY: # 支付宝小程序
|
||||
client-id: xx
|
||||
client-secret: xx
|
||||
alipay-public-key: xx
|
||||
ignore-check-redirect-uri: true
|
||||
ignore-check-state: true
|
||||
cache:
|
||||
type: REDIS
|
||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user