Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
6522ef48
Commit
6522ef48
authored
Dec 24, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录
parent
e8c18c66
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
22 deletions
+16
-22
ch-wx-api/src/main/java/com/wwdz/ch/wx/constant/CacheCodeConstants.java
...main/java/com/wwdz/ch/wx/constant/CacheCodeConstants.java
+6
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
...n/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
+10
-22
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/constant/CacheCodeConstants.java
View file @
6522ef48
...
@@ -15,6 +15,9 @@ public class CacheCodeConstants {
...
@@ -15,6 +15,9 @@ public class CacheCodeConstants {
*/
*/
public
static
final
String
USER_LOGIN_SMS_KEY
=
"cjxc:wx:user:sms:login:{0}"
;
public
static
final
String
USER_LOGIN_SMS_KEY
=
"cjxc:wx:user:sms:login:{0}"
;
public
static
final
String
QD_USER_LOGIN_SMS_KEY
=
"qiandao:wx:user:sms:login:{0}"
;
/**
/**
* 缓存用户修改密码验证码
* 缓存用户修改密码验证码
* <p>{0}:手机号</p>
* <p>{0}:手机号</p>
...
@@ -27,6 +30,9 @@ public class CacheCodeConstants {
...
@@ -27,6 +30,9 @@ public class CacheCodeConstants {
*/
*/
public
static
final
String
USER_INFO_KEY
=
"cjxc:wx:user:info:{0}"
;
public
static
final
String
USER_INFO_KEY
=
"cjxc:wx:user:info:{0}"
;
public
static
final
String
QD_USER_INFO_KEY
=
"qiandao:wx:user:info:{0}"
;
/**
/**
* 缓存关注者新发布藏品记录
* 缓存关注者新发布藏品记录
* <p>{0}被关注者id:粉丝id</p>
* <p>{0}被关注者id:粉丝id</p>
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
View file @
6522ef48
...
@@ -93,7 +93,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -93,7 +93,7 @@ public class QdUserServiceImpl implements QdUserService {
}
}
String
key
=
""
;
String
key
=
""
;
if
(
dto
.
getSmsType
().
equals
(
CacheCodeConstants
.
SmsTypeEnum
.
LOGIN
.
getCode
()))
{
if
(
dto
.
getSmsType
().
equals
(
CacheCodeConstants
.
SmsTypeEnum
.
LOGIN
.
getCode
()))
{
key
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_LOGIN_SMS_KEY
,
dto
.
getMobile
());
key
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_LOGIN_SMS_KEY
,
dto
.
getMobile
());
}
else
{
}
else
{
key
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_UPDATE_SMS_KEY
,
dto
.
getMobile
());
key
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_UPDATE_SMS_KEY
,
dto
.
getMobile
());
}
}
...
@@ -126,7 +126,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -126,7 +126,7 @@ public class QdUserServiceImpl implements QdUserService {
@Override
@Override
public
Result
loginByMobile
(
QdUserRequestDto
dto
,
HttpServletRequest
request
)
{
public
Result
loginByMobile
(
QdUserRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
try
{
String
key
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_LOGIN_SMS_KEY
,
dto
.
getMobile
());
String
key
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_LOGIN_SMS_KEY
,
dto
.
getMobile
());
Object
object
=
redisUtils
.
get
(
key
);
Object
object
=
redisUtils
.
get
(
key
);
if
(
Objects
.
isNull
(
object
))
{
if
(
Objects
.
isNull
(
object
))
{
return
Result
.
failed
(
"验证码已过期"
);
return
Result
.
failed
(
"验证码已过期"
);
...
@@ -164,18 +164,6 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -164,18 +164,6 @@ public class QdUserServiceImpl implements QdUserService {
if
(
getPhoneResult
.
getSuccess
())
{
if
(
getPhoneResult
.
getSuccess
())
{
mobile
=
getPhoneResult
.
getData
();
mobile
=
getPhoneResult
.
getData
();
}
}
/* if (StringUtils.equals("false", mobile)) {
return Result.failed("获取access_token失败");
}
if (StringUtils.equals("sessionFalse", mobile)) {
return Result.failed("获取sessionKey失败");
}
if (StringUtils.equals("phoneFalse", mobile)) {
return Result.failed("获取手机号失败");
}
if (StringUtils.equals("decryptFalse", mobile)) {
return Result.failed(ResultCode.FAILED.getCode(), "用户信息解密失败");
}*/
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取用户信息异常"
,
e
);
logger
.
error
(
"获取用户信息异常"
,
e
);
return
Result
.
failed
(
"获取用户信息异常"
);
return
Result
.
failed
(
"获取用户信息异常"
);
...
@@ -203,7 +191,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -203,7 +191,7 @@ public class QdUserServiceImpl implements QdUserService {
qdUserDao
.
updateById
(
user
);
qdUserDao
.
updateById
(
user
);
// 更新用户缓存
// 更新用户缓存
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_INFO_KEY
,
user
.
getId
());
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
logger
.
info
(
"【请求结束】用户修改个性签名成功"
);
logger
.
info
(
"【请求结束】用户修改个性签名成功"
);
return
Result
.
success
();
return
Result
.
success
();
...
@@ -224,7 +212,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -224,7 +212,7 @@ public class QdUserServiceImpl implements QdUserService {
qdUserDao
.
updateById
(
user
);
qdUserDao
.
updateById
(
user
);
// 更新用户缓存
// 更新用户缓存
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_INFO_KEY
,
user
.
getId
());
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
logger
.
info
(
"【请求结束】用户修改背景成功"
);
logger
.
info
(
"【请求结束】用户修改背景成功"
);
return
Result
.
success
();
return
Result
.
success
();
...
@@ -277,7 +265,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -277,7 +265,7 @@ public class QdUserServiceImpl implements QdUserService {
qdUserDao
.
updateById
(
user
);
qdUserDao
.
updateById
(
user
);
// 更新用户缓存
// 更新用户缓存
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_INFO_KEY
,
user
.
getId
());
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
logger
.
info
(
"【请求结束】用户修改昵称成功"
);
logger
.
info
(
"【请求结束】用户修改昵称成功"
);
return
Result
.
success
();
return
Result
.
success
();
...
@@ -298,7 +286,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -298,7 +286,7 @@ public class QdUserServiceImpl implements QdUserService {
qdUserDao
.
updateById
(
user
);
qdUserDao
.
updateById
(
user
);
// 更新用户缓存
// 更新用户缓存
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_INFO_KEY
,
user
.
getId
());
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
logger
.
info
(
"【请求结束】用户修改头像成功"
);
logger
.
info
(
"【请求结束】用户修改头像成功"
);
return
Result
.
success
();
return
Result
.
success
();
...
@@ -320,7 +308,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -320,7 +308,7 @@ public class QdUserServiceImpl implements QdUserService {
qdUserDao
.
updateById
(
user
);
qdUserDao
.
updateById
(
user
);
// 更新用户缓存
// 更新用户缓存
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_INFO_KEY
,
user
.
getId
());
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
logger
.
info
(
"【请求结束】用户修改微信二维码成功"
);
logger
.
info
(
"【请求结束】用户修改微信二维码成功"
);
return
Result
.
success
();
return
Result
.
success
();
...
@@ -357,7 +345,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -357,7 +345,7 @@ public class QdUserServiceImpl implements QdUserService {
// 更新用户缓存
// 更新用户缓存
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
QdUser
resultQdUser
=
qdUserDao
.
queryById
(
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_INFO_KEY
,
user
.
getId
());
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
redisUtils
.
set
(
userKey
,
resultQdUser
,
2
*
60
*
60
);
logger
.
info
(
"【请求结束】用户修改手机号成功"
);
logger
.
info
(
"【请求结束】用户修改手机号成功"
);
// 清除验证码缓存
// 清除验证码缓存
...
@@ -383,7 +371,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -383,7 +371,7 @@ public class QdUserServiceImpl implements QdUserService {
return
Result
.
failed
(
"查询不到当前登录用户信息"
);
return
Result
.
failed
(
"查询不到当前登录用户信息"
);
}
}
QdUser
user
=
null
;
QdUser
user
=
null
;
String
key
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
userId
);
String
key
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_INFO_KEY
,
userId
);
if
(
redisUtils
.
hasKey
(
key
))
{
if
(
redisUtils
.
hasKey
(
key
))
{
user
=
(
QdUser
)
redisUtils
.
get
(
key
);
user
=
(
QdUser
)
redisUtils
.
get
(
key
);
}
else
{
}
else
{
...
@@ -522,7 +510,7 @@ public class QdUserServiceImpl implements QdUserService {
...
@@ -522,7 +510,7 @@ public class QdUserServiceImpl implements QdUserService {
result
.
put
(
"wxOpenid"
,
user
.
getWxOpenid
());
result
.
put
(
"wxOpenid"
,
user
.
getWxOpenid
());
// 缓存用户信息
// 缓存用户信息
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
QD_
USER_INFO_KEY
,
user
.
getId
());
redisUtils
.
set
(
userKey
,
user
,
2
*
60
*
60
);
redisUtils
.
set
(
userKey
,
user
,
2
*
60
*
60
);
return
result
;
return
result
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment