Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
向汉
/
uc-engine
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
2413749b
...
2413749bcf21b94204e53714a55fe1d6da69027f
authored
2022-08-31 17:02:24 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.修复微信应用登录时,昵称重复base64加密的问题
1 parent
a5d2e0d5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
12 deletions
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/UserAppService.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/UserAppService.java
View file @
2413749
...
...
@@ -94,4 +94,6 @@ public interface UserAppService {
ResultInfo
saveAppAndBindQq4Vis
(
VisUserQq
resources
);
UserAppDTO
findByMemberId
(
Long
memberId
);
UserAppDTO
createByManual
(
UserApp
userApp
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppServiceImpl.java
View file @
2413749
...
...
@@ -556,6 +556,15 @@ public class UserAppServiceImpl implements UserAppService {
return
this
.
userAppMapper
.
toDto
(
userApp
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
UserAppDTO
createByManual
(
UserApp
userApp
)
{
UserAppIdManual
userAppIdManual
=
new
UserAppIdManual
();
BeanUtils
.
copyProperties
(
userApp
,
userAppIdManual
);
this
.
userAppRepository
.
saveByIdManual
(
userAppIdManual
);
return
this
.
userAppMapper
.
toDto
(
userApp
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
View file @
2413749
...
...
@@ -34,6 +34,7 @@ import com.topdraw.weixin.service.WeChatConstants;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.math.RandomUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.Assert
;
...
...
@@ -45,6 +46,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.naming.ConfigurationException
;
import
java.net.URLDecoder
;
import
java.sql.Timestamp
;
import
java.time.LocalDate
;
import
java.util.*
;
@Api
(
"账号处理"
)
...
...
@@ -70,6 +72,7 @@ public class UserOperationController {
private
static
final
String
UNSUBSCRIBE
=
"unsubscribe"
;
private
static
final
Integer
SUBSCRIBE_STATUS
=
1
;
private
String
secretKey
=
"f8681b9ce7c8fb6b"
;
/******************************************************* APP ************************************/
...
...
@@ -151,14 +154,14 @@ public class UserOperationController {
Integer
type
=
resources
.
getType
();
if
(
Objects
.
isNull
(
type
))
{
log
.
error
(
"app注册,参数错误,appRegister# message ==>> 账号类型不得为空 "
);
return
ResultInfo
.
failure
(
"app注册
,参数错误
,账号类型不得为空"
);
return
ResultInfo
.
failure
(
"app注册
失败
,账号类型不得为空"
);
}
String
account
=
resources
.
getAccount
();
if
(
StringUtils
.
isNotBlank
(
account
))
{
if
(
Objects
.
isNull
(
resources
.
getAccountType
()))
{
log
.
error
(
"app注册,参数错误,appRegister# message ==>> 第三方账号类型不得为空"
);
return
ResultInfo
.
failure
(
"app注册
,参数错误
,第三方账号类型不得为空"
);
return
ResultInfo
.
failure
(
"app注册
失败
,第三方账号类型不得为空"
);
}
}
...
...
@@ -167,23 +170,24 @@ public class UserOperationController {
resources
.
setNickname
(
Base64Utils
.
encodeToString
(
username
.
getBytes
()));
}
if
(
Objects
.
isNull
(
resources
.
getId
()))
{
if
(
StringUtils
.
isNotBlank
(
resources
.
getPassword
()))
{
String
clientPassword
=
AESUtil
.
decrypt
(
resources
.
getPassword
(),
"f8681b9ce7c8fb6b"
);
String
clientPassword
=
AESUtil
.
decrypt
(
resources
.
getPassword
(),
secretKey
);
if
(
clientPassword
==
null
||
clientPassword
.
length
()
<=
16
)
{
log
.
error
(
"修改app账号密码失败,参数错误,密码格式不正确,[updateAppPasswordByOldPassword# clientPassword ==>> {}]
"
,
clientPassword
);
log
.
error
(
"app注册异常,appRegister# message ==>> 密码格式不正确 | clientPassword ==>> {}
"
,
clientPassword
);
return
ResultInfo
.
failure
(
"密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间"
);
}
String
resultClientPassword
=
clientPassword
.
substring
(
16
);
if
(!
RegexUtil
.
appPasswordRegex
(
resultClientPassword
))
{
log
.
error
(
"app注册异常,appRegister# {} message ==>> 密码格式不正确
"
,
resultClientPassword
);
log
.
error
(
"app注册异常,appRegister# message ==>> 密码格式不正确 | password ==>> {}
"
,
resultClientPassword
);
return
ResultInfo
.
failure
(
"密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间"
);
}
resources
.
setPassword
(
AESUtil
.
decodePassword
(
resources
.
getPassword
()));
}
}
UserAppDTO
userAppDTO
=
this
.
userOperationService
.
appRegister
(
resources
);
return
ResultInfo
.
success
(
userAppDTO
);
return
ResultInfo
.
success
(
this
.
userOperationService
.
appRegister
(
resources
));
}
@PostMapping
(
value
=
"/appBindThirdAccount"
)
...
...
@@ -428,9 +432,13 @@ public class UserOperationController {
String
nickname
=
redisInfo
.
get
(
"nickname"
).
toString
();
if
(
StringUtils
.
isNotBlank
(
nickname
))
{
String
nicknameDecode
=
URLDecoder
.
decode
(
nickname
,
"UTF-8"
);
String
nicknameEncode
=
Base64Util
.
encode
(
nicknameDecode
);
subscribeBean
.
setNickname
(
nicknameEncode
);
boolean
isBase64
=
Base64Util
.
isBase64
(
nickname
);
if
(
isBase64
)
{
subscribeBean
.
setNickname
(
nickname
);
}
else
{
log
.
warn
(
"关注时前端昵称为进行base64加密,subscribe# message =>> 采用默认昵称 | nickname ==>> {}"
,
nickname
);
subscribeBean
.
setNickname
(
Base64Util
.
encode
(
"创造团用户"
));
}
}
String
headimgurl
=
redisInfo
.
get
(
"headimgurl"
).
toString
();
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
2413749
...
...
@@ -136,9 +136,16 @@ public class UserOperationServiceImpl implements UserOperationService {
// 先创建会员,缓存至redis
MemberDTO
memberDTO
=
this
.
createMember
(
MemberBuilder
.
build
(
MemberTypeConstant
.
app
,
resources
.
getHeadimgurl
(),
resources
.
getNickname
(),
0
));
if
(
Objects
.
nonNull
(
memberDTO
.
getId
()))
{
UserApp
userApp
=
UserAppBuilder
.
build
(
memberDTO
.
getId
(),
resources
);
// 保存app账号
UserAppDTO
_userAppDTO
=
this
.
userAppService
.
create
(
UserAppBuilder
.
build
(
memberDTO
.
getId
(),
resources
));
if
(
Objects
.
nonNull
(
_userAppDTO
.
getId
())
&&
StringUtils
.
isNotBlank
(
resources
.
getAccount
()))
{
UserAppDTO
_userAppDTO
=
null
;
if
(
Objects
.
isNull
(
userApp
.
getId
()))
{
_userAppDTO
=
this
.
userAppService
.
create
(
userApp
);
}
else
{
_userAppDTO
=
this
.
userAppService
.
createByManual
(
userApp
);
}
if
(
Objects
.
nonNull
(
_userAppDTO
.
getId
())
&&
Objects
.
nonNull
(
_userAppDTO
.
getId
())
&&
StringUtils
.
isNotBlank
(
resources
.
getAccount
()))
{
UserAppBindDTO
userAppBindDTO
=
this
.
userAppBindService
.
findFirstByAccount
(
resources
.
getAccount
());
if
(
Objects
.
isNull
(
userAppBindDTO
.
getId
()))
{
// 保存绑定关系
...
...
Please
register
or
sign in
to post a comment