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
d63790c3
Commit
d63790c3
authored
Sep 05, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 邀请码
parent
9d0111a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+14
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
...ain/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
+2
-5
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
d63790c3
...
@@ -12,6 +12,7 @@ import com.wwdz.ch.core.util.RegexUtil;
...
@@ -12,6 +12,7 @@ import com.wwdz.ch.core.util.RegexUtil;
import
com.wwdz.ch.core.util.UUID
;
import
com.wwdz.ch.core.util.UUID
;
import
com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder
;
import
com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.domain.Switch
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.wx.constant.CacheCodeConstants
;
import
com.wwdz.ch.wx.constant.CacheCodeConstants
;
import
com.wwdz.ch.wx.constant.LoginTypeEnum
;
import
com.wwdz.ch.wx.constant.LoginTypeEnum
;
...
@@ -23,6 +24,7 @@ import com.wwdz.ch.wx.manager.TikTokLoginManager;
...
@@ -23,6 +24,7 @@ import com.wwdz.ch.wx.manager.TikTokLoginManager;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.service.InviteRecordService
;
import
com.wwdz.ch.wx.service.InviteRecordService
;
import
com.wwdz.ch.wx.service.SwitchService
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.wwdz.ch.wx.util.IpUtil
;
import
com.wwdz.ch.wx.util.IpUtil
;
import
com.wwdz.ch.wx.util.RedisUtil
;
import
com.wwdz.ch.wx.util.RedisUtil
;
...
@@ -73,6 +75,8 @@ public class UserServiceImpl implements UserService {
...
@@ -73,6 +75,8 @@ public class UserServiceImpl implements UserService {
@Autowired
@Autowired
private
InviteRecordService
inviteRecordService
;
private
InviteRecordService
inviteRecordService
;
@Autowired
private
SwitchService
switchService
;
@Override
@Override
...
@@ -128,7 +132,12 @@ public class UserServiceImpl implements UserService {
...
@@ -128,7 +132,12 @@ public class UserServiceImpl implements UserService {
}
}
// 获取登录结果
// 获取登录结果
Map
<
String
,
Object
>
result
=
getLoginResult
(
dto
.
getMobile
(),
request
);
Map
<
String
,
Object
>
result
=
getLoginResult
(
dto
.
getMobile
(),
request
);
Switch
switchh
=
switchService
.
findOnly
();
boolean
isOpen
=
Objects
.
nonNull
(
switchh
)
&&
switchh
.
getState
()
==
1
;
result
.
put
(
"isInvited"
,
inviteRecordService
.
isExisted
(
dto
.
getMobile
()).
getData
());
result
.
put
(
"isInvited"
,
inviteRecordService
.
isExisted
(
dto
.
getMobile
()).
getData
());
if
(!
isOpen
)
{
result
.
put
(
"isInvited"
,
true
);
}
logger
.
info
(
"【请求结束】手机号登录,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
logger
.
info
(
"【请求结束】手机号登录,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
// 清除验证码缓存
// 清除验证码缓存
redisUtil
.
del
(
key
);
redisUtil
.
del
(
key
);
...
@@ -183,7 +192,12 @@ public class UserServiceImpl implements UserService {
...
@@ -183,7 +192,12 @@ public class UserServiceImpl implements UserService {
}
}
// 获取登录结果
// 获取登录结果
Map
<
String
,
Object
>
result
=
getLoginResult
(
mobile
,
request
);
Map
<
String
,
Object
>
result
=
getLoginResult
(
mobile
,
request
);
Switch
switchh
=
switchService
.
findOnly
();
boolean
isOpen
=
Objects
.
nonNull
(
switchh
)
&&
switchh
.
getState
()
==
1
;
result
.
put
(
"isInvited"
,
inviteRecordService
.
isExisted
(
mobile
).
getData
());
result
.
put
(
"isInvited"
,
inviteRecordService
.
isExisted
(
mobile
).
getData
());
if
(!
isOpen
)
{
result
.
put
(
"isInvited"
,
true
);
}
logger
.
info
(
"【请求结束】快捷登录成功,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
logger
.
info
(
"【请求结束】快捷登录成功,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
return
Result
.
success
(
result
);
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
View file @
d63790c3
...
@@ -43,10 +43,7 @@ public class LoginInterceptor implements HandlerInterceptor {
...
@@ -43,10 +43,7 @@ public class LoginInterceptor implements HandlerInterceptor {
logger
.
info
(
"进入拦截器"
);
logger
.
info
(
"进入拦截器"
);
String
token
=
request
.
getHeader
(
"Authorization"
);
String
token
=
request
.
getHeader
(
"Authorization"
);
Switch
switchh
=
switchService
.
findOnly
();
Switch
switchh
=
switchService
.
findOnly
();
boolean
isOpen
=
false
;
boolean
isOpen
=
Objects
.
nonNull
(
switchh
)
&&
switchh
.
getState
()
==
1
;
if
(
Objects
.
nonNull
(
switchh
)
&&
switchh
.
getState
()
==
1
)
{
isOpen
=
true
;
}
String
url
=
request
.
getRequestURI
();
String
url
=
request
.
getRequestURI
();
if
(!
isOpen
)
{
if
(!
isOpen
)
{
if
(
Arrays
.
asList
(
excludeUrl
).
contains
(
url
))
{
if
(
Arrays
.
asList
(
excludeUrl
).
contains
(
url
))
{
...
@@ -66,7 +63,7 @@ public class LoginInterceptor implements HandlerInterceptor {
...
@@ -66,7 +63,7 @@ public class LoginInterceptor implements HandlerInterceptor {
response
.
setStatus
(
HttpServletResponse
.
SC_UNAUTHORIZED
);
response
.
setStatus
(
HttpServletResponse
.
SC_UNAUTHORIZED
);
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
}
else
{
}
else
{
Integer
loginType
=
1
;
int
loginType
=
1
;
if
(
StringUtils
.
isBlank
(
token
))
{
if
(
StringUtils
.
isBlank
(
token
))
{
loginType
=
2
;
loginType
=
2
;
}
else
{
}
else
{
...
...
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