fix: 临时登录、一些bug

This commit is contained in:
TS-QD1 2025-04-24 19:30:59 +08:00
parent a79e7c54df
commit 2537bdcffa
8 changed files with 31 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# 20250409
# 20250409已上线20250424
## 微信oauth2扫码登录
@ -14,10 +14,19 @@ ADD COLUMN `wx_union_id` varchar(255) NULL COMMENT '微信-开放平台-unionid'
### 临时登录接口
```
```text
/router/systemuser/temporary-login
```
### 微信
```text
/api/user-wx/login
/api/user-wx/register
```
### 小程序登录
# 20250325已上线
## user_expand

View File

@ -12,7 +12,7 @@ import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "微信用户接口")
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "微信小程序用户接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/user-wx")
public class UserWxController extends DefaultBaseController {

View File

@ -3,14 +3,12 @@ package cn.com.tenlion.operator.login.wx.oauth2.auth;
import cn.com.tenlion.operator.properties.WxOauth2Properties;
import cn.com.tenlion.operator.remote.wx.IWxOauth2RemoteService;
import cn.com.tenlion.operator.remote.wx.entity.WxOauth2AccessToken;
import com.sun.xml.internal.bind.v2.runtime.output.SAXOutput;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

View File

@ -153,6 +153,10 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
po = new UserExpandPO();
po.setUserId(userId);
}
if (!StringUtils.isBlank(po.getWxOpenId())) {
UserPO userPO = userService.getPO(po.getUserId());
po.setIsUpdateWxUsernamePhone(RegexUtil.isPhone(userPO.getUserUsername()) ? 0 : 1);
}
updateRedis(po);
}

View File

@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -34,7 +35,7 @@ public class UserWxMiniappService {
private static final Logger LOG = LoggerFactory.getLogger(UserWxMiniappService.class);
private WxMiniappAccessToken miniappAccessToken = null;
private static WxMiniappAccessToken miniappAccessToken = null;
@Autowired
private WxMiniappProperties wxMiniappProperties;
@Autowired
@ -54,11 +55,13 @@ public class UserWxMiniappService {
/**
* 保存openid和session_key的映射关系需要创建用户时使用
*/
private final Map<String, String> openIdSessionKeyMap = new ConcurrentHashMap<>();
private static final Map<String, String> openIdSessionKeyMap = new ConcurrentHashMap<>();
/**
* 刷新access_token
*/
@PostConstruct
public void refreshAccessToken() {
long currentTimeMillis = System.currentTimeMillis();
if (miniappAccessToken != null && (currentTimeMillis - miniappAccessToken.getUpdateTime() < 5400000)) {

View File

@ -143,7 +143,7 @@ api-path:
#
# 短信验证码服务
sms:
active: false
active: true
type: default
default-sms:
account: xd001382
@ -210,5 +210,5 @@ wx-miniapp:
wx-oauth2:
appid: wxb6296ee6223aafa0
appsecret: 09c423893098cd5566aead093ea5c25c
# redirect-uri: https://www.aimzhu.com/operator/oauth/wx/oauth2
# redirect-uri: https://www.aimzhu.com/operator/oauth/wx/qrcode
redirect-uri: http://121.36.71.250:58038/operator/oauth/wx/qrcode

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

View File

@ -9,11 +9,15 @@
<title>AI喵著</title>
<style>
html, body {margin: 0;padding: 0;height: 100%;}
.container {width: 100%;height: 100%; display: flex; justify-content: center; align-items: center;}
.container {width: 100%;height: 100%; display: flex; justify-content: center; align-items: center; background: url('assets/images/system-select-bg.jpg') no-repeat center center; background-size: cover;}
.container .systems {display: flex; }
.container .systems .system {width: 200px; height: 200px; margin: 10px; cursor: pointer; border-radius: 5px; box-shadow: 0 0 5px silver; padding: 15px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; align-items: center;}
.container .systems .system .logo {}
.container .systems .system .title {margin-top: 10px;}
.container .systems .system {
width: 200px; height: 200px; margin: 10px; cursor: pointer; border-radius: 5px; box-shadow: 0 0 5px rgba(51,200,255,1);
padding: 15px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center;
align-items: center; background-color: rgba(51,200,255,0.5); transition: background-color 0.3s ease;
}
.container .systems .system:hover {background-color: rgba(51,200,255,0.9);}
.container .systems .system .title { font-size: 30px; color: #FFFFFF;}
</style>
</head>
<body>