合并 master 代码

修复单测报错的问题
This commit is contained in:
YunaiV
2021-12-15 09:45:37 +08:00
parent 712067979c
commit 52631a0af8
10 changed files with 36 additions and 21 deletions

View File

@ -9,8 +9,8 @@ import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreS
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory;
import com.google.common.annotations.VisibleForTesting;
import com.xkcoding.justauth.AuthRequestFactory;
import lombok.extern.slf4j.Slf4j;
import me.zhyd.oauth.model.AuthCallback;
import me.zhyd.oauth.model.AuthResponse;
@ -41,7 +41,7 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString
public class SysSocialCoreServiceImpl implements SysSocialCoreService {
@Resource
private YudaoAuthRequestFactory yudaoAuthRequestFactory;
private AuthRequestFactory authRequestFactory;
@Resource
private SysSocialAuthUserRedisDAO authSocialUserRedisDAO;
@ -52,7 +52,7 @@ public class SysSocialCoreServiceImpl implements SysSocialCoreService {
@Override
public String getAuthorizeUrl(Integer type, String redirectUri) {
// 获得对应的 AuthRequest 实现
AuthRequest authRequest = yudaoAuthRequestFactory.get(SysSocialTypeEnum.valueOfType(type).getSource());
AuthRequest authRequest = authRequestFactory.get(SysSocialTypeEnum.valueOfType(type).getSource());
// 生成跳转地址
String authorizeUri = authRequest.authorize(AuthStateUtils.createState());
return HttpUtils.replaceUrlQuery(authorizeUri, "redirect_uri", redirectUri);
@ -161,7 +161,7 @@ public class SysSocialCoreServiceImpl implements SysSocialCoreService {
* @return 授权的用户
*/
private AuthUser getAuthUser0(Integer type, AuthCallback authCallback) {
AuthRequest authRequest = yudaoAuthRequestFactory.get(SysSocialTypeEnum.valueOfType(type).getSource());
AuthRequest authRequest = authRequestFactory.get(SysSocialTypeEnum.valueOfType(type).getSource());
AuthResponse<?> authResponse = authRequest.login(authCallback);
log.info("[getAuthUser0][请求社交平台 type({}) request({}) response({})]", type, toJsonString(authCallback),
toJsonString(authResponse));

View File

@ -8,3 +8,4 @@ DELETE FROM "sys_user_session";
DELETE FROM "sys_dict_data";
DELETE FROM "sys_sms_template";
DELETE FROM "sys_sms_log";
DELETE FROM "sys_social_user";

View File

@ -177,3 +177,23 @@ CREATE TABLE IF NOT EXISTS `sys_login_log` (
"tenant_id" bigint not null default '0',
PRIMARY KEY (`id`)
) COMMENT ='系统访问记录';
CREATE TABLE IF NOT EXISTS "sys_social_user" (
"id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"user_id" bigint NOT NULL,
"user_type" tinyint NOT NULL DEFAULT '0',
"type" tinyint NOT NULL,
"openid" varchar(32) NOT NULL,
"token" varchar(256) DEFAULT NULL,
"union_id" varchar(32) NOT NULL,
"raw_token_info" varchar(1024) NOT NULL,
"nickname" varchar(32) NOT NULL,
"avatar" varchar(255) DEFAULT NULL,
"raw_user_info" varchar(1024) NOT NULL,
"creator" varchar(64) DEFAULT '',
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar(64) DEFAULT '',
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '社交用户';