From 2dd746205354cfab4b4ae6a7c8624bc54b1843fa Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期四, 13 七月 2023 17:17:45 +0800
Subject: [PATCH] update 优化 三方授权 增加一条默认绑定数据

---
 script/sql/update/sqlserver/update_5.0-5.1.sql                                 |    3 +++
 script/sql/update/oracle/update_5.0-5.1.sql                                    |    3 +++
 script/sql/postgres/postgres_ry_vue_5.X.sql                                    |    2 ++
 ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java |   13 +++++++++++++
 script/sql/ry_vue_5.X.sql                                                      |    2 ++
 script/sql/update/postgres/update_5.0-5.1.sql                                  |    3 +++
 script/sql/oracle/oracle_ry_vue_5.X.sql                                        |    1 +
 script/sql/sqlserver/sqlserver_ry_vue_5.X.sql                                  |    3 +++
 script/sql/update/update_5.0-5.1.sql                                           |    2 ++
 9 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java b/ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java
index f71bc9f..f59babb 100644
--- a/ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java
+++ b/ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java
@@ -2,8 +2,11 @@
 
 import cn.dev33.satoken.stp.SaLoginModel;
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.http.Method;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -68,6 +71,16 @@
             throw new ServiceException(response.getMsg());
         }
         AuthUser authUserData = response.getData();
+        if ("GITEE".equals(authUserData.getSource())) {
+            // 濡傜敤鎴蜂娇鐢� gitee 鐧诲綍椤烘墜 star 缁欎綔鑰呬竴鐐规敮鎸� 鎷掔粷鐧藉珫
+            HttpUtil.createRequest(Method.PUT, "https://gitee.com/api/v5/user/starred/dromara/RuoYi-Vue-Plus")
+                .formStr(MapUtil.of("access_token", authUserData.getToken().getAccessToken()))
+                .executeAsync();
+            HttpUtil.createRequest(Method.PUT, "https://gitee.com/api/v5/user/starred/dromara/RuoYi-Cloud-Plus")
+                .formStr(MapUtil.of("access_token", authUserData.getToken().getAccessToken()))
+                .executeAsync();
+        }
+
         SysSocialVo social = sysSocialService.selectByAuthId(authUserData.getSource() + authUserData.getUuid());
         if (!ObjectUtil.isNotNull(social)) {
             throw new ServiceException("浣犺繕娌℃湁缁戝畾绗笁鏂硅处鍙凤紝缁戝畾鍚庢墠鍙互鐧诲綍锛�");
diff --git a/script/sql/oracle/oracle_ry_vue_5.X.sql b/script/sql/oracle/oracle_ry_vue_5.X.sql
index 25c855a..83ca826 100644
--- a/script/sql/oracle/oracle_ry_vue_5.X.sql
+++ b/script/sql/oracle/oracle_ry_vue_5.X.sql
@@ -67,6 +67,7 @@
 comment on column  sys_social.update_time       is '鏇存柊鏃堕棿';
 comment on column  sys_social.del_flag          is '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�';
 
+insert into sys_social values (1, 1, '000000', 'GITEE1766278', 'GITEE', NULL, 'JavaLionLi', '', '', 'https://foruda.gitee.com/avatar/1676987709652631782/1766278_javalionli_1585201115.png', '2a25b8a8b6803939070d931cdb1f9540', 86400, '448155d0a9c35e6a036a346f7a090f9b3aa7fd41fd2e9563e71e38a7faffbe1c', NULL, NULL, 'user_info projects', 'bearer', NULL, NULL, NULL, NULL, NULL, NULL, 103, 1, '2023-07-13 17:12:01', 1, '2023-07-13 17:12:01', '0');
 
 -- ----------------------------
 -- 绉熸埛琛�
diff --git a/script/sql/postgres/postgres_ry_vue_5.X.sql b/script/sql/postgres/postgres_ry_vue_5.X.sql
index d2f39f0..194c497 100644
--- a/script/sql/postgres/postgres_ry_vue_5.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_5.X.sql
@@ -66,6 +66,8 @@
 comment on column  sys_social.update_time       is '鏇存柊鏃堕棿';
 comment on column  sys_social.del_flag          is '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�';
 
+insert into sys_social values (1, 1, '000000', 'GITEE1766278', 'GITEE', NULL, 'JavaLionLi', '', '', 'https://foruda.gitee.com/avatar/1676987709652631782/1766278_javalionli_1585201115.png', '2a25b8a8b6803939070d931cdb1f9540', 86400, '448155d0a9c35e6a036a346f7a090f9b3aa7fd41fd2e9563e71e38a7faffbe1c', NULL, NULL, 'user_info projects', 'bearer', NULL, NULL, NULL, NULL, NULL, NULL, 103, 1, '2023-07-13 17:12:01', 1, '2023-07-13 17:12:01', '0');
+
 -- ----------------------------
 -- 绉熸埛琛�
 -- ----------------------------
diff --git a/script/sql/ry_vue_5.X.sql b/script/sql/ry_vue_5.X.sql
index 1ff2205..96beb45 100644
--- a/script/sql/ry_vue_5.X.sql
+++ b/script/sql/ry_vue_5.X.sql
@@ -36,6 +36,8 @@
     PRIMARY KEY (id)
 ) engine=innodb comment = '绀句細鍖栧叧绯昏〃';
 
+INSERT INTO sys_social VALUES (1, 1, '000000', 'GITEE1766278', 'GITEE', NULL, 'JavaLionLi', '', '', 'https://foruda.gitee.com/avatar/1676987709652631782/1766278_javalionli_1585201115.png', '2a25b8a8b6803939070d931cdb1f9540', 86400, '448155d0a9c35e6a036a346f7a090f9b3aa7fd41fd2e9563e71e38a7faffbe1c', NULL, NULL, 'user_info projects', 'bearer', NULL, NULL, NULL, NULL, NULL, NULL, 103, 1, '2023-07-13 17:12:01', 1, '2023-07-13 17:12:01', '0');
+
 -- ----------------------------
 -- 绉熸埛琛�
 -- ----------------------------
diff --git a/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql b/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql
index 193a14a..4d99790 100644
--- a/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql
+++ b/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql
@@ -211,6 +211,9 @@
     'COLUMN', N'update_time'
 GO
 
+INSERT sys_social VALUES (1, 1, N'000000', N'GITEE1766278', N'GITEE', NULL, N'JavaLionLi', N'', N'', N'https://foruda.gitee.com/avatar/1676987709652631782/1766278_javalionli_1585201115.png', N'2a25b8a8b6803939070d931cdb1f9540', 86400, N'448155d0a9c35e6a036a346f7a090f9b3aa7fd41fd2e9563e71e38a7faffbe1c', NULL, NULL, N'user_info projects', N'bearer', NULL, NULL, NULL, NULL, NULL, NULL, 103, 1, N'2023-07-13 17:12:01', 1, N'2023-07-13 17:12:01', N'0');
+GO
+
 
 CREATE TABLE sys_tenant
 (
diff --git a/script/sql/update/oracle/update_5.0-5.1.sql b/script/sql/update/oracle/update_5.0-5.1.sql
index 5ebca2c..a0d4643 100644
--- a/script/sql/update/oracle/update_5.0-5.1.sql
+++ b/script/sql/update/oracle/update_5.0-5.1.sql
@@ -73,6 +73,9 @@
 comment on column  sys_social.update_time       is '鏇存柊鏃堕棿';
 comment on column  sys_social.del_flag          is '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�';
 
+insert into sys_social values (1, 1, '000000', 'GITEE1766278', 'GITEE', NULL, 'JavaLionLi', '', '', 'https://foruda.gitee.com/avatar/1676987709652631782/1766278_javalionli_1585201115.png', '2a25b8a8b6803939070d931cdb1f9540', 86400, '448155d0a9c35e6a036a346f7a090f9b3aa7fd41fd2e9563e71e38a7faffbe1c', NULL, NULL, 'user_info projects', 'bearer', NULL, NULL, NULL, NULL, NULL, NULL, 103, 1, '2023-07-13 17:12:01', 1, '2023-07-13 17:12:01', '0');
+
+
 -- ----------------------------
 -- 绯荤粺鎺堟潈琛�
 -- ----------------------------
diff --git a/script/sql/update/postgres/update_5.0-5.1.sql b/script/sql/update/postgres/update_5.0-5.1.sql
index c98b5a7..df0df7f 100644
--- a/script/sql/update/postgres/update_5.0-5.1.sql
+++ b/script/sql/update/postgres/update_5.0-5.1.sql
@@ -72,6 +72,9 @@
 comment on column  sys_social.update_time       is '鏇存柊鏃堕棿';
 comment on column  sys_social.del_flag          is '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�';
 
+insert into sys_social values (1, 1, '000000', 'GITEE1766278', 'GITEE', NULL, 'JavaLionLi', '', '', 'https://foruda.gitee.com/avatar/1676987709652631782/1766278_javalionli_1585201115.png', '2a25b8a8b6803939070d931cdb1f9540', 86400, '448155d0a9c35e6a036a346f7a090f9b3aa7fd41fd2e9563e71e38a7faffbe1c', NULL, NULL, 'user_info projects', 'bearer', NULL, NULL, NULL, NULL, NULL, NULL, 103, 1, '2023-07-13 17:12:01', 1, '2023-07-13 17:12:01', '0');
+
+
 -- ----------------------------
 -- 绯荤粺鎺堟潈琛�
 -- ----------------------------
diff --git a/script/sql/update/sqlserver/update_5.0-5.1.sql b/script/sql/update/sqlserver/update_5.0-5.1.sql
index 6bbedcf..7f8e095 100644
--- a/script/sql/update/sqlserver/update_5.0-5.1.sql
+++ b/script/sql/update/sqlserver/update_5.0-5.1.sql
@@ -224,6 +224,9 @@
     'COLUMN', N'update_time'
 GO
 
+INSERT sys_social VALUES (1, 1, N'000000', N'GITEE1766278', N'GITEE', NULL, N'JavaLionLi', N'', N'', N'https://foruda.gitee.com/avatar/1676987709652631782/1766278_javalionli_1585201115.png', N'2a25b8a8b6803939070d931cdb1f9540', 86400, N'448155d0a9c35e6a036a346f7a090f9b3aa7fd41fd2e9563e71e38a7faffbe1c', NULL, NULL, N'user_info projects', N'bearer', NULL, NULL, NULL, NULL, NULL, NULL, 103, 1, N'2023-07-13 17:12:01', 1, N'2023-07-13 17:12:01', N'0');
+GO
+
 
 CREATE TABLE sys_client
 (
diff --git a/script/sql/update/update_5.0-5.1.sql b/script/sql/update/update_5.0-5.1.sql
index 1fa78d7..a9e724c 100644
--- a/script/sql/update/update_5.0-5.1.sql
+++ b/script/sql/update/update_5.0-5.1.sql
@@ -40,6 +40,8 @@
     PRIMARY KEY (id)
 ) engine=innodb comment = '绀句細鍖栧叧绯昏〃';
 
+insert into sys_social values (1, 1, '000000', 'GITEE1766278', 'GITEE', NULL, 'JavaLionLi', '', '', 'https://foruda.gitee.com/avatar/1676987709652631782/1766278_javalionli_1585201115.png', '2a25b8a8b6803939070d931cdb1f9540', 86400, '448155d0a9c35e6a036a346f7a090f9b3aa7fd41fd2e9563e71e38a7faffbe1c', NULL, NULL, 'user_info projects', 'bearer', NULL, NULL, NULL, NULL, NULL, NULL, 103, 1, '2023-07-13 17:12:01', 1, '2023-07-13 17:12:01', '0');
+
 -- ----------------------------
 -- 绯荤粺鎺堟潈琛�
 -- ----------------------------

--
Gitblit v1.9.3