Skip to content

Commit

Permalink
fix username passowrd login
Browse files Browse the repository at this point in the history
  • Loading branch information
itwanger committed Jul 4, 2023
1 parent 19c71f0 commit 57ba58a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ private void updateInviteCnt(Long id, int incr) {
userAiMapper.update(null, updateWrapper);
}

public void saveOrUpdateAiBindInfo(UserAiDO ai) {
saveOrUpdateAiBindInfo(ai, null);
}

/**
* 更新userAi绑定信息
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ public String register(String username, String password) {
throw ExceptionUtil.of(StatusEnum.USER_PWD_ERROR);
}

Long userId = bindUserAccount(user.getId());

// 登录成功,返回对应的session
ReqInfoContext.getReqInfo().setUserId(user.getId());
return userSessionHelper.genSession(user.getId());
ReqInfoContext.getReqInfo().setUserId(userId);
return userSessionHelper.genSession(userId);
}


Expand Down Expand Up @@ -150,4 +152,11 @@ private Long bindUserAccount(Long userId, String starNumber, String invitationCo
userAiDao.saveOrUpdateAiBindInfo(userAiDO, invitationCode);
return userId;
}

private Long bindUserAccount(Long userId) {
// 根据星球编号直接查询用户是否存在,存在则直接登录,不存在则进行注册
UserAiDO userAiDO = userAiDao.getByUserId(userId);
userAiDao.saveOrUpdateAiBindInfo(userAiDO);
return userId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
transition: width .05s ease;
}

.name .test {
font-size: small;
padding-left: 6px;
color: var(--pai-color-3-gray);
}

.window-header-title .name {
display: flex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
th:data-target="${global.isLogin ? '' : '#registerModal'}"
th:data-toggle="${global.isLogin ? '' : 'modal'}"
>点击登录</div>
<span class="test" th:if="${global.user != null && global.user.starStatus == 1}">试用中</span>
<div class="c-bubble-trigger com-verification" th:if="${global.user != null && global.user.starStatus == 2}">
<i class="verified"></i>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void handleOptions(HtmlSourceOption option) {
"div#article_content", // CSDN
"article.article-content", // 小白学堂
".article-content", // 思否
".post-topic-des, .post-content-box", // 牛客
".post-topic-des, .post-content-box, .nc-post-content", // 牛客
"article.markdown-body", // GitHub
".e13l6k8o9", // LeetCode
// .writing-content 墨滴
Expand Down

0 comments on commit 57ba58a

Please sign in to comment.