Commit d256275099a57a95ae36cbf883298b637e2fd7be
1 parent
5842a361
saas:支持社交应用的多租户配置
Showing
17 changed files
with
375 additions
and
140 deletions
sql/mysql/ruoyi-vue-pro.sql
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | Target Server Version : 80034 |
| 12 | 12 | File Encoding : 65001 |
| 13 | 13 | |
| 14 | - Date: 17/10/2023 23:22:59 | |
| 14 | + Date: 18/10/2023 23:33:15 | |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | SET NAMES utf8mb4; |
| ... | ... | @@ -384,7 +384,7 @@ CREATE TABLE `infra_api_error_log` ( |
| 384 | 384 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 385 | 385 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 386 | 386 | PRIMARY KEY (`id`) USING BTREE |
| 387 | -) ENGINE = InnoDB AUTO_INCREMENT = 1735 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; | |
| 387 | +) ENGINE = InnoDB AUTO_INCREMENT = 1739 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; | |
| 388 | 388 | |
| 389 | 389 | -- ---------------------------- |
| 390 | 390 | -- Records of infra_api_error_log |
| ... | ... | @@ -422,7 +422,7 @@ CREATE TABLE `infra_codegen_column` ( |
| 422 | 422 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 423 | 423 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 424 | 424 | PRIMARY KEY (`id`) USING BTREE |
| 425 | -) ENGINE = InnoDB AUTO_INCREMENT = 1804 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义'; | |
| 425 | +) ENGINE = InnoDB AUTO_INCREMENT = 1805 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义'; | |
| 426 | 426 | |
| 427 | 427 | -- ---------------------------- |
| 428 | 428 | -- Records of infra_codegen_column |
| ... | ... | @@ -455,7 +455,7 @@ CREATE TABLE `infra_codegen_table` ( |
| 455 | 455 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 456 | 456 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 457 | 457 | PRIMARY KEY (`id`) USING BTREE |
| 458 | -) ENGINE = InnoDB AUTO_INCREMENT = 136 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义'; | |
| 458 | +) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义'; | |
| 459 | 459 | |
| 460 | 460 | -- ---------------------------- |
| 461 | 461 | -- Records of infra_codegen_table |
| ... | ... | @@ -615,7 +615,7 @@ CREATE TABLE `infra_job` ( |
| 615 | 615 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 616 | 616 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 617 | 617 | PRIMARY KEY (`id`) USING BTREE |
| 618 | -) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '定时任务表'; | |
| 618 | +) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '定时任务表'; | |
| 619 | 619 | |
| 620 | 620 | -- ---------------------------- |
| 621 | 621 | -- Records of infra_job |
| ... | ... | @@ -656,7 +656,7 @@ CREATE TABLE `infra_job_log` ( |
| 656 | 656 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 657 | 657 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 658 | 658 | PRIMARY KEY (`id`) USING BTREE |
| 659 | -) ENGINE = InnoDB AUTO_INCREMENT = 232 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '定时任务日志表'; | |
| 659 | +) ENGINE = InnoDB AUTO_INCREMENT = 233 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '定时任务日志表'; | |
| 660 | 660 | |
| 661 | 661 | -- ---------------------------- |
| 662 | 662 | -- Records of infra_job_log |
| ... | ... | @@ -709,7 +709,7 @@ CREATE TABLE `member_address` ( |
| 709 | 709 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 710 | 710 | PRIMARY KEY (`id`) USING BTREE, |
| 711 | 711 | INDEX `idx_userId`(`user_id` ASC) USING BTREE |
| 712 | -) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; | |
| 712 | +) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; | |
| 713 | 713 | |
| 714 | 714 | -- ---------------------------- |
| 715 | 715 | -- Records of member_address |
| ... | ... | @@ -768,7 +768,7 @@ CREATE TABLE `member_experience_record` ( |
| 768 | 768 | PRIMARY KEY (`id`) USING BTREE, |
| 769 | 769 | INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员经验记录-用户编号', |
| 770 | 770 | INDEX `idx_user_biz_type`(`user_id` ASC, `biz_type` ASC) USING BTREE COMMENT '会员经验记录-用户业务类型' |
| 771 | -) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员经验记录'; | |
| 771 | +) ENGINE = InnoDB AUTO_INCREMENT = 41 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员经验记录'; | |
| 772 | 772 | |
| 773 | 773 | -- ---------------------------- |
| 774 | 774 | -- Records of member_experience_record |
| ... | ... | @@ -883,7 +883,7 @@ CREATE TABLE `member_level_record` ( |
| 883 | 883 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 884 | 884 | PRIMARY KEY (`id`) USING BTREE, |
| 885 | 885 | INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员等级记录-用户编号' |
| 886 | -) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员等级记录'; | |
| 886 | +) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员等级记录'; | |
| 887 | 887 | |
| 888 | 888 | -- ---------------------------- |
| 889 | 889 | -- Records of member_level_record |
| ... | ... | @@ -913,7 +913,7 @@ CREATE TABLE `member_point_record` ( |
| 913 | 913 | PRIMARY KEY (`id`) USING BTREE, |
| 914 | 914 | INDEX `index_userId`(`user_id` ASC) USING BTREE, |
| 915 | 915 | INDEX `index_title`(`title` ASC) USING BTREE |
| 916 | -) ENGINE = InnoDB AUTO_INCREMENT = 59 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户积分记录'; | |
| 916 | +) ENGINE = InnoDB AUTO_INCREMENT = 60 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户积分记录'; | |
| 917 | 917 | |
| 918 | 918 | -- ---------------------------- |
| 919 | 919 | -- Records of member_point_record |
| ... | ... | @@ -1540,7 +1540,7 @@ CREATE TABLE `system_error_code` ( |
| 1540 | 1540 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 1541 | 1541 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1542 | 1542 | PRIMARY KEY (`id`) USING BTREE |
| 1543 | -) ENGINE = InnoDB AUTO_INCREMENT = 5932 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '错误码表'; | |
| 1543 | +) ENGINE = InnoDB AUTO_INCREMENT = 5933 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '错误码表'; | |
| 1544 | 1544 | |
| 1545 | 1545 | -- ---------------------------- |
| 1546 | 1546 | -- Records of system_error_code |
| ... | ... | @@ -1569,7 +1569,7 @@ CREATE TABLE `system_login_log` ( |
| 1569 | 1569 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1570 | 1570 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 1571 | 1571 | PRIMARY KEY (`id`) USING BTREE |
| 1572 | -) ENGINE = InnoDB AUTO_INCREMENT = 2582 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; | |
| 1572 | +) ENGINE = InnoDB AUTO_INCREMENT = 2599 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; | |
| 1573 | 1573 | |
| 1574 | 1574 | -- ---------------------------- |
| 1575 | 1575 | -- Records of system_login_log |
| ... | ... | @@ -1634,7 +1634,7 @@ CREATE TABLE `system_mail_log` ( |
| 1634 | 1634 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 1635 | 1635 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1636 | 1636 | PRIMARY KEY (`id`) USING BTREE |
| 1637 | -) ENGINE = InnoDB AUTO_INCREMENT = 354 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件日志表'; | |
| 1637 | +) ENGINE = InnoDB AUTO_INCREMENT = 355 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件日志表'; | |
| 1638 | 1638 | |
| 1639 | 1639 | -- ---------------------------- |
| 1640 | 1640 | -- Records of system_mail_log |
| ... | ... | @@ -2283,7 +2283,7 @@ CREATE TABLE `system_notify_template` ( |
| 2283 | 2283 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 2284 | 2284 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2285 | 2285 | PRIMARY KEY (`id`) USING BTREE |
| 2286 | -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '站内信模板表'; | |
| 2286 | +) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '站内信模板表'; | |
| 2287 | 2287 | |
| 2288 | 2288 | -- ---------------------------- |
| 2289 | 2289 | -- Records of system_notify_template |
| ... | ... | @@ -2311,7 +2311,7 @@ CREATE TABLE `system_oauth2_access_token` ( |
| 2311 | 2311 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2312 | 2312 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 2313 | 2313 | PRIMARY KEY (`id`) USING BTREE |
| 2314 | -) ENGINE = InnoDB AUTO_INCREMENT = 3056 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; | |
| 2314 | +) ENGINE = InnoDB AUTO_INCREMENT = 3063 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; | |
| 2315 | 2315 | |
| 2316 | 2316 | -- ---------------------------- |
| 2317 | 2317 | -- Records of system_oauth2_access_token |
| ... | ... | @@ -2433,7 +2433,7 @@ CREATE TABLE `system_oauth2_refresh_token` ( |
| 2433 | 2433 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2434 | 2434 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 2435 | 2435 | PRIMARY KEY (`id`) USING BTREE |
| 2436 | -) ENGINE = InnoDB AUTO_INCREMENT = 1063 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; | |
| 2436 | +) ENGINE = InnoDB AUTO_INCREMENT = 1070 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; | |
| 2437 | 2437 | |
| 2438 | 2438 | -- ---------------------------- |
| 2439 | 2439 | -- Records of system_oauth2_refresh_token |
| ... | ... | @@ -3481,7 +3481,7 @@ CREATE TABLE `system_sms_code` ( |
| 3481 | 3481 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 3482 | 3482 | PRIMARY KEY (`id`) USING BTREE, |
| 3483 | 3483 | INDEX `idx_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号' |
| 3484 | -) ENGINE = InnoDB AUTO_INCREMENT = 530 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码'; | |
| 3484 | +) ENGINE = InnoDB AUTO_INCREMENT = 531 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码'; | |
| 3485 | 3485 | |
| 3486 | 3486 | -- ---------------------------- |
| 3487 | 3487 | -- Records of system_sms_code |
| ... | ... | @@ -3575,6 +3575,33 @@ INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `cont |
| 3575 | 3575 | COMMIT; |
| 3576 | 3576 | |
| 3577 | 3577 | -- ---------------------------- |
| 3578 | +-- Table structure for system_social_client | |
| 3579 | +-- ---------------------------- | |
| 3580 | +DROP TABLE IF EXISTS `system_social_client`; | |
| 3581 | +CREATE TABLE `system_social_client` ( | |
| 3582 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | |
| 3583 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '应用名', | |
| 3584 | + `social_type` tinyint NOT NULL COMMENT '社交平台的类型', | |
| 3585 | + `user_type` tinyint NOT NULL COMMENT '用户类型', | |
| 3586 | + `client_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端编号', | |
| 3587 | + `client_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端密钥', | |
| 3588 | + `status` tinyint NOT NULL COMMENT '状态', | |
| 3589 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 3590 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 3591 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 3592 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 3593 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 3594 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 3595 | + PRIMARY KEY (`id`) USING BTREE | |
| 3596 | +) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交客户端表'; | |
| 3597 | + | |
| 3598 | +-- ---------------------------- | |
| 3599 | +-- Records of system_social_client | |
| 3600 | +-- ---------------------------- | |
| 3601 | +BEGIN; | |
| 3602 | +COMMIT; | |
| 3603 | + | |
| 3604 | +-- ---------------------------- | |
| 3578 | 3605 | -- Table structure for system_social_user |
| 3579 | 3606 | -- ---------------------------- |
| 3580 | 3607 | DROP TABLE IF EXISTS `system_social_user`; |
| ... | ... | @@ -3596,7 +3623,7 @@ CREATE TABLE `system_social_user` ( |
| 3596 | 3623 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 3597 | 3624 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 3598 | 3625 | PRIMARY KEY (`id`) USING BTREE |
| 3599 | -) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交用户表'; | |
| 3626 | +) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交用户表'; | |
| 3600 | 3627 | |
| 3601 | 3628 | -- ---------------------------- |
| 3602 | 3629 | -- Records of system_social_user |
| ... | ... | @@ -3621,7 +3648,7 @@ CREATE TABLE `system_social_user_bind` ( |
| 3621 | 3648 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 3622 | 3649 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 3623 | 3650 | PRIMARY KEY (`id`) USING BTREE |
| 3624 | -) ENGINE = InnoDB AUTO_INCREMENT = 76 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交绑定表'; | |
| 3651 | +) ENGINE = InnoDB AUTO_INCREMENT = 79 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交绑定表'; | |
| 3625 | 3652 | |
| 3626 | 3653 | -- ---------------------------- |
| 3627 | 3654 | -- Records of system_social_user_bind |
| ... | ... | @@ -3797,7 +3824,7 @@ CREATE TABLE `system_users` ( |
| 3797 | 3824 | -- Records of system_users |
| 3798 | 3825 | -- ---------------------------- |
| 3799 | 3826 | BEGIN; |
| 3800 | -INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-10-17 21:03:03', 'admin', '2021-01-05 17:03:47', NULL, '2023-10-17 21:03:03', b'0', 1); | |
| 3827 | +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-10-18 22:31:35', 'admin', '2021-01-05 17:03:47', NULL, '2023-10-18 22:31:35', b'0', 1); | |
| 3801 | 3828 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (100, 'yudao', '$2a$10$11U48RhyJ5pSBYWSn12AD./ld671.ycSzJHbyrtpeoMeYiw31eo8a', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 1, '127.0.0.1', '2022-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1); |
| 3802 | 3829 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (103, 'yuanma', '$2a$10$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '127.0.0.1', '2022-07-08 01:26:27', '', '2021-01-13 23:50:35', NULL, '2022-07-08 01:26:27', b'0', 1); |
| 3803 | 3830 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$10$GP8zvqHB//TekuzYZSBYAuBQJiNq1.fxQVDYJ.uBCOnWCtDVKE4H6', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2023-09-24 18:21:19', '', '2021-01-21 02:13:53', NULL, '2023-09-24 18:21:19', b'0', 1); |
| ... | ... | @@ -3805,7 +3832,7 @@ INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, |
| 3805 | 3832 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (108, 'admin108', '$2a$10$y6mfvKoNYL1GXWak8nYwVOH.kCWqjactkzdoIDgiKl93WN3Ejg.Lu', '芋艿', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '', NULL, '1', '2022-02-20 23:00:50', '1', '2022-02-27 08:26:53', b'0', 119); |
| 3806 | 3833 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (109, 'admin109', '$2a$10$JAqvH0tEc0I7dfDVBI7zyuB4E3j.uH6daIjV53.vUS6PknFkDJkuK', '芋艿', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '', NULL, '1', '2022-02-20 23:11:50', '1', '2022-02-27 08:26:56', b'0', 120); |
| 3807 | 3834 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (110, 'admin110', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '小王', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '127.0.0.1', '2022-09-25 22:47:33', '1', '2022-02-22 00:56:14', NULL, '2022-09-25 22:47:33', b'0', 121); |
| 3808 | -INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (111, 'test', '$2a$10$mExveopHUx9Q4QiLtAzhDeH3n4/QlNLzEsM4AqgxKrU.ciUZDXZCy', '测试用户', NULL, NULL, '[]', '', '', 0, '', 0, '', NULL, '110', '2022-02-23 13:14:33', '110', '2022-02-23 13:14:33', b'0', 121); | |
| 3835 | +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (111, 'test', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '测试用户', NULL, NULL, '[]', '', '', 0, '', 0, '0:0:0:0:0:0:0:1', '2023-10-18 23:31:51', '110', '2022-02-23 13:14:33', NULL, '2023-10-18 23:31:51', b'0', 121); | |
| 3809 | 3836 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (112, 'newobject', '$2a$10$3alwklxqfq8/hKoW6oUV0OJp0IdQpBDauLy4633SpUjrRsStl6kMa', '新对象', NULL, 100, '[]', '', '', 1, '', 0, '0:0:0:0:0:0:0:1', '2023-02-10 13:48:13', '1', '2022-02-23 19:08:03', NULL, '2023-02-10 13:48:13', b'0', 1); |
| 3810 | 3837 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (113, 'aoteman', '$2a$10$0acJOIk2D25/oC87nyclE..0lzeu9DtQ/n3geP4fkun/zIVRhHJIO', '芋道', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '127.0.0.1', '2022-03-19 18:38:51', '1', '2022-03-07 21:37:58', NULL, '2022-03-19 18:38:51', b'0', 122); |
| 3811 | 3838 | INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (114, 'hrmgr', '$2a$10$TR4eybBioGRhBmDBWkqWLO6NIh3mzYa8KBKDDB5woiGYFVlRAi.fu', 'hr 小姐姐', NULL, NULL, '[3]', '', '', 0, '', 0, '127.0.0.1', '2022-03-19 22:15:43', '1', '2022-03-19 21:50:58', NULL, '2022-03-19 22:15:43', b'0', 1); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/order/core/aop/TradeOrderLogAspect.java
| ... | ... | @@ -58,10 +58,6 @@ public class TradeOrderLogAspect { |
| 58 | 58 | */ |
| 59 | 59 | private static final ThreadLocal<Map<String, Object>> EXTS = new ThreadLocal<>(); |
| 60 | 60 | |
| 61 | - public TradeOrderLogAspect() { | |
| 62 | - System.out.println(); | |
| 63 | - } | |
| 64 | - | |
| 65 | 61 | @Resource |
| 66 | 62 | private TradeOrderLogService orderLogService; |
| 67 | 63 | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
| ... | ... | @@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi; |
| 19 | 19 | import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenCreateReqDTO; |
| 20 | 20 | import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenRespDTO; |
| 21 | 21 | import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; |
| 22 | +import cn.iocoder.yudao.module.system.api.social.SocialClientApi; | |
| 22 | 23 | import cn.iocoder.yudao.module.system.api.social.SocialUserApi; |
| 23 | 24 | import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO; |
| 24 | 25 | import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO; |
| ... | ... | @@ -56,6 +57,8 @@ public class MemberAuthServiceImpl implements MemberAuthService { |
| 56 | 57 | @Resource |
| 57 | 58 | private SocialUserApi socialUserApi; |
| 58 | 59 | @Resource |
| 60 | + private SocialClientApi socialClientApi; | |
| 61 | + @Resource | |
| 59 | 62 | private OAuth2TokenApi oauth2TokenApi; |
| 60 | 63 | |
| 61 | 64 | @Resource |
| ... | ... | @@ -154,7 +157,7 @@ public class MemberAuthServiceImpl implements MemberAuthService { |
| 154 | 157 | |
| 155 | 158 | @Override |
| 156 | 159 | public String getSocialAuthorizeUrl(Integer type, String redirectUri) { |
| 157 | - return socialUserApi.getAuthorizeUrl(type, redirectUri); | |
| 160 | + return socialClientApi.getAuthorizeUrl(type, UserTypeEnum.MEMBER.getValue(), redirectUri); | |
| 158 | 161 | } |
| 159 | 162 | |
| 160 | 163 | private MemberUserDO login0(String mobile, String password) { | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApi.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.api.social; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 社交应用的 API 接口 | |
| 7 | + * | |
| 8 | + * @author 芋道源码 | |
| 9 | + */ | |
| 10 | +public interface SocialClientApi { | |
| 11 | + | |
| 12 | + /** | |
| 13 | + * 获得社交平台的授权 URL | |
| 14 | + * | |
| 15 | + * @param type 社交平台的类型 {@link SocialTypeEnum} | |
| 16 | + * @param userType 用户类型 | |
| 17 | + * @param redirectUri 重定向 URL | |
| 18 | + * @return 社交平台的授权 URL | |
| 19 | + */ | |
| 20 | + String getAuthorizeUrl(Integer type, Integer userType, String redirectUri); | |
| 21 | + | |
| 22 | +} | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialUserApi.java
| ... | ... | @@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 4 | 4 | import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO; |
| 5 | 5 | import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO; |
| 6 | 6 | import cn.iocoder.yudao.module.system.api.social.dto.SocialUserUnbindReqDTO; |
| 7 | -import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; | |
| 8 | 7 | |
| 9 | 8 | import javax.validation.Valid; |
| 10 | 9 | |
| ... | ... | @@ -16,15 +15,6 @@ import javax.validation.Valid; |
| 16 | 15 | public interface SocialUserApi { |
| 17 | 16 | |
| 18 | 17 | /** |
| 19 | - * 获得社交平台的授权 URL | |
| 20 | - * | |
| 21 | - * @param type 社交平台的类型 {@link SocialTypeEnum} | |
| 22 | - * @param redirectUri 重定向 URL | |
| 23 | - * @return 社交平台的授权 URL | |
| 24 | - */ | |
| 25 | - String getAuthorizeUrl(Integer type, String redirectUri); | |
| 26 | - | |
| 27 | - /** | |
| 28 | 18 | * 绑定社交用户 |
| 29 | 19 | * |
| 30 | 20 | * @param reqDTO 绑定信息 | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/social/dto/SocialUserBindReqDTO.java
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/social/dto/SocialUserUnbindReqDTO.java
| ... | ... | @@ -33,12 +33,12 @@ public class SocialUserUnbindReqDTO { |
| 33 | 33 | */ |
| 34 | 34 | @InEnum(SocialTypeEnum.class) |
| 35 | 35 | @NotNull(message = "社交平台的类型不能为空") |
| 36 | - private Integer type; | |
| 36 | + private Integer socialType; | |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * 社交平台的 unionId | |
| 39 | + * 社交平台的 openid | |
| 40 | 40 | */ |
| 41 | - @NotEmpty(message = "社交平台的 unionId 不能为空") | |
| 42 | - private String unionId; | |
| 41 | + @NotEmpty(message = "社交平台的 openid 不能为空") | |
| 42 | + private String openid; | |
| 43 | 43 | |
| 44 | 44 | } | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/social/SocialTypeEnum.java
| ... | ... | @@ -18,33 +18,39 @@ public enum SocialTypeEnum implements IntArrayValuable { |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Gitee |
| 21 | - * 文档链接:https://gitee.com/api/v5/oauth_doc#/ | |
| 21 | + * | |
| 22 | + * @see <a href="https://gitee.com/api/v5/oauth_doc#/">接入文档</a> | |
| 22 | 23 | */ |
| 23 | 24 | GITEE(10, "GITEE"), |
| 24 | 25 | /** |
| 25 | 26 | * 钉钉 |
| 26 | - * 文档链接:https://developers.dingtalk.com/document/app/obtain-identity-credentials | |
| 27 | + * | |
| 28 | + * @see <a href="https://developers.dingtalk.com/document/app/obtain-identity-credentials">接入文档</a> | |
| 27 | 29 | */ |
| 28 | 30 | DINGTALK(20, "DINGTALK"), |
| 29 | 31 | |
| 30 | 32 | /** |
| 31 | 33 | * 企业微信 |
| 32 | - * 文档链接:https://xkcoding.com/2019/08/06/use-justauth-integration-wechat-enterprise.html | |
| 34 | + * | |
| 35 | + * @see <a href="https://xkcoding.com/2019/08/06/use-justauth-integration-wechat-enterprise.html">接入文档</a> | |
| 33 | 36 | */ |
| 34 | 37 | WECHAT_ENTERPRISE(30, "WECHAT_ENTERPRISE"), |
| 35 | 38 | /** |
| 36 | 39 | * 微信公众平台 - 移动端 H5 |
| 37 | - * 文档链接:https://www.cnblogs.com/juewuzhe/p/11905461.html | |
| 40 | + * | |
| 41 | + * @see <a href="https://www.cnblogs.com/juewuzhe/p/11905461.html">接入文档</a> | |
| 38 | 42 | */ |
| 39 | 43 | WECHAT_MP(31, "WECHAT_MP"), |
| 40 | 44 | /** |
| 41 | 45 | * 微信开放平台 - 网站应用 PC 端扫码授权登录 |
| 42 | - * 文档链接:https://justauth.wiki/guide/oauth/wechat_open/#_2-申请开发者资质认证 | |
| 46 | + * | |
| 47 | + * @see <a href="https://justauth.wiki/guide/oauth/wechat_open/#_2-申请开发者资质认证">接入文档</a> | |
| 43 | 48 | */ |
| 44 | 49 | WECHAT_OPEN(32, "WECHAT_OPEN"), |
| 45 | 50 | /** |
| 46 | 51 | * 微信小程序 |
| 47 | - * 文档链接:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html | |
| 52 | + * | |
| 53 | + * @see <a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html">接入文档</a> | |
| 48 | 54 | */ |
| 49 | 55 | WECHAT_MINI_APP(34, "WECHAT_MINI_APP"), |
| 50 | 56 | ; | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApiImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.api.social; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.system.service.social.SocialClientService; | |
| 4 | +import org.springframework.stereotype.Service; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | + | |
| 7 | +import javax.annotation.Resource; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 社交应用的 API 实现类 | |
| 11 | + * | |
| 12 | + * @author 芋道源码 | |
| 13 | + */ | |
| 14 | +@Service | |
| 15 | +@Validated | |
| 16 | +public class SocialClientApiImpl implements SocialClientApi { | |
| 17 | + | |
| 18 | + @Resource | |
| 19 | + private SocialClientService socialClientService; | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public String getAuthorizeUrl(Integer type, Integer userType, String redirectUri) { | |
| 23 | + return socialClientService.getAuthorizeUrl(type, userType, redirectUri); | |
| 24 | + } | |
| 25 | + | |
| 26 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialUserApiImpl.java
| ... | ... | @@ -22,11 +22,6 @@ public class SocialUserApiImpl implements SocialUserApi { |
| 22 | 22 | private SocialUserService socialUserService; |
| 23 | 23 | |
| 24 | 24 | @Override |
| 25 | - public String getAuthorizeUrl(Integer type, String redirectUri) { | |
| 26 | - return socialUserService.getAuthorizeUrl(type, redirectUri); | |
| 27 | - } | |
| 28 | - | |
| 29 | - @Override | |
| 30 | 25 | public String bindSocialUser(SocialUserBindReqDTO reqDTO) { |
| 31 | 26 | return socialUserService.bindSocialUser(reqDTO); |
| 32 | 27 | } |
| ... | ... | @@ -34,7 +29,7 @@ public class SocialUserApiImpl implements SocialUserApi { |
| 34 | 29 | @Override |
| 35 | 30 | public void unbindSocialUser(SocialUserUnbindReqDTO reqDTO) { |
| 36 | 31 | socialUserService.unbindSocialUser(reqDTO.getUserId(), reqDTO.getUserType(), |
| 37 | - reqDTO.getType(), reqDTO.getUnionId()); | |
| 32 | + reqDTO.getSocialType(), reqDTO.getOpenid()); | |
| 38 | 33 | } |
| 39 | 34 | |
| 40 | 35 | @Override | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.auth; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.StrUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 6 | 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 7 | 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 8 | 9 | import cn.iocoder.yudao.framework.security.config.SecurityProperties; |
| ... | ... | @@ -16,7 +17,7 @@ import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; |
| 16 | 17 | import cn.iocoder.yudao.module.system.service.permission.MenuService; |
| 17 | 18 | import cn.iocoder.yudao.module.system.service.permission.PermissionService; |
| 18 | 19 | import cn.iocoder.yudao.module.system.service.permission.RoleService; |
| 19 | -import cn.iocoder.yudao.module.system.service.social.SocialUserService; | |
| 20 | +import cn.iocoder.yudao.module.system.service.social.SocialClientService; | |
| 20 | 21 | import cn.iocoder.yudao.module.system.service.user.AdminUserService; |
| 21 | 22 | import io.swagger.v3.oas.annotations.Operation; |
| 22 | 23 | import io.swagger.v3.oas.annotations.Parameter; |
| ... | ... | @@ -57,7 +58,7 @@ public class AuthController { |
| 57 | 58 | @Resource |
| 58 | 59 | private PermissionService permissionService; |
| 59 | 60 | @Resource |
| 60 | - private SocialUserService socialUserService; | |
| 61 | + private SocialClientService socialClientService; | |
| 61 | 62 | |
| 62 | 63 | @Resource |
| 63 | 64 | private SecurityProperties securityProperties; |
| ... | ... | @@ -147,7 +148,7 @@ public class AuthController { |
| 147 | 148 | }) |
| 148 | 149 | public CommonResult<String> socialLogin(@RequestParam("type") Integer type, |
| 149 | 150 | @RequestParam("redirectUri") String redirectUri) { |
| 150 | - return CommonResult.success(socialUserService.getAuthorizeUrl(type, redirectUri)); | |
| 151 | + return success(socialClientService.getAuthorizeUrl(type, UserTypeEnum.ADMIN.getValue(), redirectUri)); | |
| 151 | 152 | } |
| 152 | 153 | |
| 153 | 154 | @PostMapping("/social-login") | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SocialClientDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.dataobject.social; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 5 | +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | |
| 6 | +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; | |
| 7 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 9 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 10 | +import com.xingyuv.jushauth.config.AuthConfig; | |
| 11 | +import lombok.*; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 社交客户端 DO | |
| 15 | + * | |
| 16 | + * 对应 {@link AuthConfig} 配置,满足不同租户,有自己的客户端配置,实现社交(三方)登录 | |
| 17 | + * | |
| 18 | + * @author 芋道源码 | |
| 19 | + */ | |
| 20 | +@TableName(value = "system_social_client", autoResultMap = true) | |
| 21 | +@KeySequence("system_social_client_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 22 | +@Data | |
| 23 | +@EqualsAndHashCode(callSuper = true) | |
| 24 | +@Builder | |
| 25 | +@NoArgsConstructor | |
| 26 | +@AllArgsConstructor | |
| 27 | +public class SocialClientDO extends TenantBaseDO { | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 编号,自增 | |
| 31 | + */ | |
| 32 | + @TableId | |
| 33 | + private Long id; | |
| 34 | + /** | |
| 35 | + * 应用名 | |
| 36 | + */ | |
| 37 | + private String name; | |
| 38 | + /** | |
| 39 | + * 社交类型 | |
| 40 | + * | |
| 41 | + * 枚举 {@link SocialTypeEnum} | |
| 42 | + */ | |
| 43 | + private Integer socialType; | |
| 44 | + /** | |
| 45 | + * 用户类型 | |
| 46 | + * | |
| 47 | + * 目的:不同用户类型,对应不同的小程序,需要自己的配置 | |
| 48 | + * | |
| 49 | + * 枚举 {@link UserTypeEnum} | |
| 50 | + */ | |
| 51 | + private Integer userType; | |
| 52 | + /** | |
| 53 | + * 状态 | |
| 54 | + * | |
| 55 | + * 枚举 {@link CommonStatusEnum} | |
| 56 | + */ | |
| 57 | + private Integer status; | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 客户端 id | |
| 61 | + */ | |
| 62 | + private String clientId; | |
| 63 | + /** | |
| 64 | + * 客户端 Secret | |
| 65 | + */ | |
| 66 | + private String clientSecret; | |
| 67 | + | |
| 68 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/social/SocialClientMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.mysql.social; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | +import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialClientDO; | |
| 5 | +import org.apache.ibatis.annotations.Mapper; | |
| 6 | + | |
| 7 | +@Mapper | |
| 8 | +public interface SocialClientMapper extends BaseMapperX<SocialClientDO> { | |
| 9 | + | |
| 10 | + default SocialClientDO selectBySocialTypeAndUserType(Integer socialType, Integer userType) { | |
| 11 | + return selectOne(SocialClientDO::getSocialType, socialType, | |
| 12 | + SocialClientDO::getUserType, userType); | |
| 13 | + } | |
| 14 | + | |
| 15 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.social; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; | |
| 4 | +import com.xingyuv.jushauth.model.AuthUser; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 社交应用 Service 接口 | |
| 8 | + * | |
| 9 | + * @author 芋道源码 | |
| 10 | + */ | |
| 11 | +public interface SocialClientService { | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * 获得社交平台的授权 URL | |
| 15 | + * | |
| 16 | + * @param socialType 社交平台的类型 {@link SocialTypeEnum} | |
| 17 | + * @param userType 用户类型 | |
| 18 | + * @param redirectUri 重定向 URL | |
| 19 | + * @return 社交平台的授权 URL | |
| 20 | + */ | |
| 21 | + String getAuthorizeUrl(Integer socialType, Integer userType, String redirectUri); | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 请求社交平台,获得授权的用户 | |
| 25 | + * | |
| 26 | + * @param socialType 社交平台的类型 | |
| 27 | + * @param userType 用户类型 | |
| 28 | + * @param code 授权码 | |
| 29 | + * @param state 授权 state | |
| 30 | + * @return 授权的用户 | |
| 31 | + */ | |
| 32 | + AuthUser getAuthUser(Integer socialType, Integer userType, String code, String state); | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.social; | |
| 2 | + | |
| 3 | +import cn.hutool.core.bean.BeanUtil; | |
| 4 | +import cn.hutool.core.lang.Assert; | |
| 5 | +import cn.hutool.core.util.ReflectUtil; | |
| 6 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.http.HttpUtils; | |
| 8 | +import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory; | |
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialClientDO; | |
| 10 | +import cn.iocoder.yudao.module.system.dal.mysql.social.SocialClientMapper; | |
| 11 | +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; | |
| 12 | +import com.xingyuv.jushauth.config.AuthConfig; | |
| 13 | +import com.xingyuv.jushauth.model.AuthCallback; | |
| 14 | +import com.xingyuv.jushauth.model.AuthResponse; | |
| 15 | +import com.xingyuv.jushauth.model.AuthUser; | |
| 16 | +import com.xingyuv.jushauth.request.AuthRequest; | |
| 17 | +import com.xingyuv.jushauth.utils.AuthStateUtils; | |
| 18 | +import lombok.extern.slf4j.Slf4j; | |
| 19 | +import org.springframework.stereotype.Service; | |
| 20 | + | |
| 21 | +import javax.annotation.Resource; | |
| 22 | +import java.util.Objects; | |
| 23 | + | |
| 24 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 25 | +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; | |
| 26 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SOCIAL_USER_AUTH_FAILURE; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * 社交应用 Service 实现类 | |
| 30 | + * | |
| 31 | + * @author 芋道源码 | |
| 32 | + */ | |
| 33 | +@Service | |
| 34 | +@Slf4j | |
| 35 | +public class SocialClientServiceImpl implements SocialClientService { | |
| 36 | + | |
| 37 | + @Resource // 由于自定义了 YudaoAuthRequestFactory 无法覆盖默认的 AuthRequestFactory,所以只能注入它 | |
| 38 | + private YudaoAuthRequestFactory yudaoAuthRequestFactory; | |
| 39 | + | |
| 40 | + @Resource | |
| 41 | + private SocialClientMapper socialClientMapper; | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public String getAuthorizeUrl(Integer socialType, Integer userType, String redirectUri) { | |
| 45 | + // 获得对应的 AuthRequest 实现 | |
| 46 | + AuthRequest authRequest = buildAuthRequest(socialType, userType); | |
| 47 | + // 生成跳转地址 | |
| 48 | + String authorizeUri = authRequest.authorize(AuthStateUtils.createState()); | |
| 49 | + return HttpUtils.replaceUrlQuery(authorizeUri, "redirect_uri", redirectUri); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Override | |
| 53 | + public AuthUser getAuthUser(Integer socialType, Integer userType, String code, String state) { | |
| 54 | + // 构建请求 | |
| 55 | + AuthRequest authRequest = buildAuthRequest(socialType, userType); | |
| 56 | + AuthCallback authCallback = AuthCallback.builder().code(code).state(state).build(); | |
| 57 | + // 执行请求 | |
| 58 | + AuthResponse<?> authResponse = authRequest.login(authCallback); | |
| 59 | + log.info("[getAuthUser][请求社交平台 type({}) request({}) response({})]", socialType, | |
| 60 | + toJsonString(authCallback), toJsonString(authResponse)); | |
| 61 | + if (!authResponse.ok()) { | |
| 62 | + throw exception(SOCIAL_USER_AUTH_FAILURE, authResponse.getMsg()); | |
| 63 | + } | |
| 64 | + return (AuthUser) authResponse.getData(); | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 构建 AuthRequest 对象,支持多租户配置 | |
| 69 | + * | |
| 70 | + * @param socialType 社交类型 | |
| 71 | + * @param userType 用户类型 | |
| 72 | + * @return AuthRequest 对象 | |
| 73 | + */ | |
| 74 | + private AuthRequest buildAuthRequest(Integer socialType, Integer userType) { | |
| 75 | + // 1. 先查找默认的配置项,从 application-*.yaml 中读取 | |
| 76 | + AuthRequest request = yudaoAuthRequestFactory.get(SocialTypeEnum.valueOfType(socialType).getSource()); | |
| 77 | + Assert.notNull(request, String.format("社交平台(%d) 不存在", socialType)); | |
| 78 | + // 2. 查询 DB 的配置项,如果存在则进行覆盖 | |
| 79 | + SocialClientDO client = socialClientMapper.selectBySocialTypeAndUserType(socialType, userType); | |
| 80 | + if (client != null && Objects.equals(client.getStatus(), CommonStatusEnum.ENABLE.getStatus())) { | |
| 81 | + // 2.1 构造新的 AuthConfig 对象 | |
| 82 | + AuthConfig authConfig = (AuthConfig) ReflectUtil.getFieldValue(request, "config"); | |
| 83 | + AuthConfig newAuthConfig = ReflectUtil.newInstance(authConfig.getClass()); | |
| 84 | + BeanUtil.copyProperties(authConfig, newAuthConfig); | |
| 85 | + // 2.2 修改对应的 clientId + clientSecret 密钥 | |
| 86 | + newAuthConfig.setClientId(client.getClientId()); | |
| 87 | + newAuthConfig.setClientSecret(client.getClientSecret()); | |
| 88 | + // 2.3 设置会 request 里,进行后续使用 | |
| 89 | + ReflectUtil.setFieldValue(request, "config", newAuthConfig); | |
| 90 | + } | |
| 91 | + return request; | |
| 92 | + } | |
| 93 | + | |
| 94 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserService.java
| ... | ... | @@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO; |
| 7 | 7 | import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; |
| 8 | 8 | |
| 9 | 9 | import javax.validation.Valid; |
| 10 | -import javax.validation.constraints.NotNull; | |
| 11 | 10 | import java.util.List; |
| 12 | 11 | |
| 13 | 12 | /** |
| ... | ... | @@ -18,27 +17,6 @@ import java.util.List; |
| 18 | 17 | public interface SocialUserService { |
| 19 | 18 | |
| 20 | 19 | /** |
| 21 | - * 获得社交平台的授权 URL | |
| 22 | - * | |
| 23 | - * @param type 社交平台的类型 {@link SocialTypeEnum} | |
| 24 | - * @param redirectUri 重定向 URL | |
| 25 | - * @return 社交平台的授权 URL | |
| 26 | - */ | |
| 27 | - String getAuthorizeUrl(Integer type, String redirectUri); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 授权获得对应的社交用户 | |
| 31 | - * 如果授权失败,则会抛出 {@link ServiceException} 异常 | |
| 32 | - * | |
| 33 | - * @param type 社交平台的类型 {@link SocialTypeEnum} | |
| 34 | - * @param code 授权码 | |
| 35 | - * @param state state | |
| 36 | - * @return 授权用户 | |
| 37 | - */ | |
| 38 | - @NotNull | |
| 39 | - SocialUserDO authSocialUser(Integer type, String code, String state); | |
| 40 | - | |
| 41 | - /** | |
| 42 | 20 | * 获得指定用户的社交用户列表 |
| 43 | 21 | * |
| 44 | 22 | * @param userId 用户编号 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
| ... | ... | @@ -2,8 +2,7 @@ package cn.iocoder.yudao.module.system.service.social; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.lang.Assert; |
| 5 | -import cn.iocoder.yudao.framework.common.util.http.HttpUtils; | |
| 6 | -import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory; | |
| 5 | +import cn.iocoder.yudao.framework.common.exception.ServiceException; | |
| 7 | 6 | import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO; |
| 8 | 7 | import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO; |
| 9 | 8 | import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserBindDO; |
| ... | ... | @@ -11,24 +10,22 @@ import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO; |
| 11 | 10 | import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserBindMapper; |
| 12 | 11 | import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserMapper; |
| 13 | 12 | import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; |
| 14 | -import com.xingyuv.jushauth.model.AuthCallback; | |
| 15 | -import com.xingyuv.jushauth.model.AuthResponse; | |
| 16 | 13 | import com.xingyuv.jushauth.model.AuthUser; |
| 17 | -import com.xingyuv.jushauth.request.AuthRequest; | |
| 18 | -import com.xingyuv.jushauth.utils.AuthStateUtils; | |
| 19 | 14 | import lombok.extern.slf4j.Slf4j; |
| 20 | 15 | import org.springframework.stereotype.Service; |
| 21 | 16 | import org.springframework.transaction.annotation.Transactional; |
| 22 | 17 | import org.springframework.validation.annotation.Validated; |
| 23 | 18 | |
| 24 | 19 | import javax.annotation.Resource; |
| 20 | +import javax.validation.constraints.NotNull; | |
| 25 | 21 | import java.util.Collections; |
| 26 | 22 | import java.util.List; |
| 27 | 23 | |
| 28 | 24 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 29 | 25 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| 30 | 26 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; |
| 31 | -import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | |
| 27 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.AUTH_THIRD_LOGIN_NOT_BIND; | |
| 28 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SOCIAL_USER_NOT_FOUND; | |
| 32 | 29 | |
| 33 | 30 | /** |
| 34 | 31 | * 社交用户 Service 实现类 |
| ... | ... | @@ -40,51 +37,13 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; |
| 40 | 37 | @Slf4j |
| 41 | 38 | public class SocialUserServiceImpl implements SocialUserService { |
| 42 | 39 | |
| 43 | - @Resource// 由于自定义了 YudaoAuthRequestFactory 无法覆盖默认的 AuthRequestFactory,所以只能注入它 | |
| 44 | - private YudaoAuthRequestFactory yudaoAuthRequestFactory; | |
| 45 | - | |
| 46 | 40 | @Resource |
| 47 | 41 | private SocialUserBindMapper socialUserBindMapper; |
| 48 | 42 | @Resource |
| 49 | 43 | private SocialUserMapper socialUserMapper; |
| 50 | 44 | |
| 51 | - @Override | |
| 52 | - public String getAuthorizeUrl(Integer type, String redirectUri) { | |
| 53 | - // 获得对应的 AuthRequest 实现 | |
| 54 | - AuthRequest authRequest = yudaoAuthRequestFactory.get(SocialTypeEnum.valueOfType(type).getSource()); | |
| 55 | - // 生成跳转地址 | |
| 56 | - String authorizeUri = authRequest.authorize(AuthStateUtils.createState()); | |
| 57 | - return HttpUtils.replaceUrlQuery(authorizeUri, "redirect_uri", redirectUri); | |
| 58 | - } | |
| 59 | - | |
| 60 | - @Override | |
| 61 | - public SocialUserDO authSocialUser(Integer type, String code, String state) { | |
| 62 | - // 优先从 DB 中获取,因为 code 有且可以使用一次。 | |
| 63 | - // 在社交登录时,当未绑定 User 时,需要绑定登录,此时需要 code 使用两次 | |
| 64 | - SocialUserDO socialUser = socialUserMapper.selectByTypeAndCodeAnState(type, code, state); | |
| 65 | - if (socialUser != null) { | |
| 66 | - return socialUser; | |
| 67 | - } | |
| 68 | - | |
| 69 | - // 请求获取 | |
| 70 | - AuthUser authUser = getAuthUser(type, code, state); | |
| 71 | - Assert.notNull(authUser, "三方用户不能为空"); | |
| 72 | - | |
| 73 | - // 保存到 DB 中 | |
| 74 | - socialUser = socialUserMapper.selectByTypeAndOpenid(type, authUser.getUuid()); | |
| 75 | - if (socialUser == null) { | |
| 76 | - socialUser = new SocialUserDO(); | |
| 77 | - } | |
| 78 | - socialUser.setType(type).setCode(code).setState(state) // 需要保存 code + state 字段,保证后续可查询 | |
| 79 | - .setOpenid(authUser.getUuid()).setToken(authUser.getToken().getAccessToken()).setRawTokenInfo((toJsonString(authUser.getToken()))) | |
| 80 | - .setNickname(authUser.getNickname()).setAvatar(authUser.getAvatar()).setRawUserInfo(toJsonString(authUser.getRawUserInfo())); | |
| 81 | - if (socialUser.getId() == null) { | |
| 82 | - socialUserMapper.insert(socialUser); | |
| 83 | - } else { | |
| 84 | - socialUserMapper.updateById(socialUser); | |
| 85 | - } | |
| 86 | - return socialUser; | |
| 87 | - } | |
| 45 | + @Resource | |
| 46 | + private SocialClientService socialClientService; | |
| 88 | 47 | |
| 89 | 48 | @Override |
| 90 | 49 | public List<SocialUserDO> getSocialUserList(Long userId, Integer userType) { |
| ... | ... | @@ -101,7 +60,8 @@ public class SocialUserServiceImpl implements SocialUserService { |
| 101 | 60 | @Transactional |
| 102 | 61 | public String bindSocialUser(SocialUserBindReqDTO reqDTO) { |
| 103 | 62 | // 获得社交用户 |
| 104 | - SocialUserDO socialUser = authSocialUser(reqDTO.getType(), reqDTO.getCode(), reqDTO.getState()); | |
| 63 | + SocialUserDO socialUser = authSocialUser(reqDTO.getSocialType(), reqDTO.getUserType(), | |
| 64 | + reqDTO.getCode(), reqDTO.getState()); | |
| 105 | 65 | Assert.notNull(socialUser, "社交用户不能为空"); |
| 106 | 66 | |
| 107 | 67 | // 社交用户可能之前绑定过别的用户,需要进行解绑 |
| ... | ... | @@ -134,7 +94,7 @@ public class SocialUserServiceImpl implements SocialUserService { |
| 134 | 94 | @Override |
| 135 | 95 | public SocialUserRespDTO getSocialUser(Integer userType, Integer type, String code, String state) { |
| 136 | 96 | // 获得社交用户 |
| 137 | - SocialUserDO socialUser = authSocialUser(type, code, state); | |
| 97 | + SocialUserDO socialUser = authSocialUser(type, userType, code, state); | |
| 138 | 98 | Assert.notNull(socialUser, "社交用户不能为空"); |
| 139 | 99 | |
| 140 | 100 | // 如果未绑定的社交用户,则无法自动登录,进行报错 |
| ... | ... | @@ -146,24 +106,44 @@ public class SocialUserServiceImpl implements SocialUserService { |
| 146 | 106 | return new SocialUserRespDTO(socialUser.getOpenid(), socialUserBind.getUserId()); |
| 147 | 107 | } |
| 148 | 108 | |
| 109 | + // TODO 芋艿:调整下单测 | |
| 149 | 110 | /** |
| 150 | - * 请求社交平台,获得授权的用户 | |
| 111 | + * 授权获得对应的社交用户 | |
| 112 | + * 如果授权失败,则会抛出 {@link ServiceException} 异常 | |
| 151 | 113 | * |
| 152 | - * @param type 社交平台的类型 | |
| 114 | + * @param type 社交平台的类型 {@link SocialTypeEnum} | |
| 115 | + * @param userType 用户类型 | |
| 153 | 116 | * @param code 授权码 |
| 154 | - * @param state 授权 state | |
| 155 | - * @return 授权的用户 | |
| 117 | + * @param state state | |
| 118 | + * @return 授权用户 | |
| 156 | 119 | */ |
| 157 | - private AuthUser getAuthUser(Integer type, String code, String state) { | |
| 158 | - AuthRequest authRequest = yudaoAuthRequestFactory.get(SocialTypeEnum.valueOfType(type).getSource()); | |
| 159 | - AuthCallback authCallback = AuthCallback.builder().code(code).state(state).build(); | |
| 160 | - AuthResponse<?> authResponse = authRequest.login(authCallback); | |
| 161 | - log.info("[getAuthUser][请求社交平台 type({}) request({}) response({})]", type, | |
| 162 | - toJsonString(authCallback), toJsonString(authResponse)); | |
| 163 | - if (!authResponse.ok()) { | |
| 164 | - throw exception(SOCIAL_USER_AUTH_FAILURE, authResponse.getMsg()); | |
| 120 | + @NotNull | |
| 121 | + public SocialUserDO authSocialUser(Integer type, Integer userType, String code, String state) { | |
| 122 | + // 优先从 DB 中获取,因为 code 有且可以使用一次。 | |
| 123 | + // 在社交登录时,当未绑定 User 时,需要绑定登录,此时需要 code 使用两次 | |
| 124 | + SocialUserDO socialUser = socialUserMapper.selectByTypeAndCodeAnState(type, code, state); | |
| 125 | + if (socialUser != null) { | |
| 126 | + return socialUser; | |
| 165 | 127 | } |
| 166 | - return (AuthUser) authResponse.getData(); | |
| 128 | + | |
| 129 | + // 请求获取 | |
| 130 | + AuthUser authUser = socialClientService.getAuthUser(type, userType, code, state); | |
| 131 | + Assert.notNull(authUser, "三方用户不能为空"); | |
| 132 | + | |
| 133 | + // 保存到 DB 中 | |
| 134 | + socialUser = socialUserMapper.selectByTypeAndOpenid(type, authUser.getUuid()); | |
| 135 | + if (socialUser == null) { | |
| 136 | + socialUser = new SocialUserDO(); | |
| 137 | + } | |
| 138 | + socialUser.setType(type).setCode(code).setState(state) // 需要保存 code + state 字段,保证后续可查询 | |
| 139 | + .setOpenid(authUser.getUuid()).setToken(authUser.getToken().getAccessToken()).setRawTokenInfo((toJsonString(authUser.getToken()))) | |
| 140 | + .setNickname(authUser.getNickname()).setAvatar(authUser.getAvatar()).setRawUserInfo(toJsonString(authUser.getRawUserInfo())); | |
| 141 | + if (socialUser.getId() == null) { | |
| 142 | + socialUserMapper.insert(socialUser); | |
| 143 | + } else { | |
| 144 | + socialUserMapper.updateById(socialUser); | |
| 145 | + } | |
| 146 | + return socialUser; | |
| 167 | 147 | } |
| 168 | 148 | |
| 169 | 149 | } | ... | ... |