Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
2145069d
提交
2145069d
编写于
2月 26, 2020
作者:
fengyuan.wan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev-login0218' into dev-login0218
上级
fcc8b365
e4988b5e
流水线
#22063
已失败 于阶段
in 0 second
变更
7
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
63 行增加
和
7 行删除
+63
-7
AutoCodeController.java
...account/account/server/controller/AutoCodeController.java
+0
-3
TokenController.java
...ud/account/account/server/controller/TokenController.java
+7
-0
AccountExceptionEnum.java
...ud/account/account/server/enums/AccountExceptionEnum.java
+1
-1
TokenService.java
...ca/cloud/account/account/server/service/TokenService.java
+3
-0
LoginServiceImpl.java
...account/account/server/service/impl/LoginServiceImpl.java
+2
-1
TokenServiceImpl.java
...account/account/server/service/impl/TokenServiceImpl.java
+23
-2
TokenUtils.java
...om/pica/cloud/account/account/server/util/TokenUtils.java
+27
-0
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/AutoCodeController.java
浏览文件 @
2145069d
...
...
@@ -45,9 +45,6 @@ public class AutoCodeController extends AccountBaseController {
private
final
String
AUTH_CODE_PREFIX
=
"authCode-"
;
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AccountController
.
class
);
@Autowired
private
AccountInfoDetailMapper
accountInfoDetailMapper
;
@Autowired
private
AccountUnionService
accountUnionService
;
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/TokenController.java
浏览文件 @
2145069d
...
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Map
;
...
...
@@ -30,6 +31,12 @@ public class TokenController extends AccountBaseController {
return
PicaResponse
.
toResponse
(
token
);
}
@ApiOperation
(
value
=
"token续时"
)
@GetMapping
(
value
=
"/token/continue"
)
public
PicaResponse
<
String
>
tokenContinueTime
(
@RequestParam
(
value
=
"seconds"
,
required
=
false
)
Integer
seconds
)
throws
Exception
{
return
PicaResponse
.
toResponse
(
tokenService
.
tokenContinueTime
(
super
.
getToken
(),
super
.
getSourceType
(),
seconds
));
}
}
server/src/main/java/com/pica/cloud/account/account/server/enums/AccountExceptionEnum.java
浏览文件 @
2145069d
...
...
@@ -32,7 +32,7 @@ public enum AccountExceptionEnum {
PICA_WECHAT_UNBIND_CURRENT
(
"216523"
,
"正在绑定中,请稍等"
),
PICA_PASSWORD_RULE_ERROR
(
"216525"
,
"该手机号{mobile}尚未设置密码,请先设置密码。"
),
PICA_PWD_MISMATCH_4
(
"216526"
,
"密码错误,请重试"
),
PICA_PWD_MISMATCH_5
(
"216527"
,
"
密码错误次数过多,请前往
找回密码"
),
PICA_PWD_MISMATCH_5
(
"216527"
,
"
该账号{mobile}的密码错误次数已达上限请24小时后再试,或请使用其他登录方式或
找回密码"
),
PICA_APPLE_TOKEN_ERROR
(
"216528"
,
"微信登录授权identifyToken不正确"
),
PICA_APPLE_BIND_OTHER
(
"216529"
,
"该Apple账号已绑定其他账户"
),
PICA_MOBILE_BIND_OTHER
(
"216530"
,
"该手机号已绑定其他Apple账号"
),
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/TokenService.java
浏览文件 @
2145069d
...
...
@@ -10,4 +10,7 @@ import java.util.Map;
public
interface
TokenService
{
String
getToken
(
Map
<
String
,
Object
>
map
);
String
tokenContinueTime
(
String
token
,
Integer
sourceType
,
Integer
seconds
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/LoginServiceImpl.java
浏览文件 @
2145069d
...
...
@@ -159,7 +159,7 @@ public class LoginServiceImpl implements LoginService {
AccountExceptionEnum
.
PICA_PWD_MISMATCH_4
.
getMessage
());
}
else
{
throw
new
PicaException
(
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5
.
getCode
(),
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5
.
getMessage
());
AccountExceptionEnum
.
PICA_PWD_MISMATCH_5
.
getMessage
()
.
replace
(
"{mobile}"
,
mobile
)
);
}
}
else
{
redisClient
.
set
(
key
,
1
,
Constants
.
PWD_ERROR_NUM_SECONDS
);
...
...
@@ -564,6 +564,7 @@ public class LoginServiceImpl implements LoginService {
resp
.
setBizMsg
(
BizTypeRespEnum
.
MOBILE_REG_TRUE
.
getMsg
());
}
}
else
if
(
bizType
.
equals
(
3
)){
// 手机号规则校验
if
(
StringUtils
.
isNotEmpty
(
mobile
)
&&
!
ValidateUtils
.
isMobile
(
mobile
))
{
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/TokenServiceImpl.java
浏览文件 @
2145069d
...
...
@@ -2,14 +2,14 @@ package com.pica.cloud.account.account.server.service.impl;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.service.TokenService
;
import
com.pica.cloud.
foundation.entity.PicaResponse
;
import
com.pica.cloud.
account.account.server.util.TokenUtils
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
import
com.pica.cloud.foundation.utils.utils.CommonUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.Date
;
import
java.util.Map
;
...
...
@@ -56,4 +56,25 @@ public class TokenServiceImpl implements TokenService {
}
return
null
;
}
@Autowired
private
TokenUtils
tokenUtils
;
/**
* @Description token续时
* @Author Chongwen.jiang
* @Date 2020/2/26 14:06
* @ModifyDate 2020/2/26 14:06
* @Params [token, sourceType] sourceType: 1.android 2.ios 3.web 4.h5 5.admin
* @Return java.lang.String
*/
@Override
public
String
tokenContinueTime
(
String
token
,
Integer
sourceType
,
Integer
seconds
)
{
if
(
StringUtils
.
isEmpty
(
token
)){
return
null
;
}
if
(
tokenUtils
.
tokenContinueTime
(
token
,
sourceType
,
seconds
)){
return
token
;
}
return
null
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/TokenUtils.java
浏览文件 @
2145069d
...
...
@@ -42,6 +42,33 @@ public class TokenUtils {
return
StringUtils
.
isBlank
(
str
);
}
/**
* @Description token续时
* @Author Chongwen.jiang
* @Date 2020/2/26 13:07
* @ModifyDate 2020/2/26 13:07
* @Params [token, sourceType]
* @Return boolean
*/
public
boolean
tokenContinueTime
(
String
token
,
Integer
sourceType
,
Integer
seconds
)
{
logger
.
info
(
"tokenContinueTime-token-{}, sourceType-{}, seconds-{}"
,
token
,
sourceType
,
seconds
);
// 根据不同的产品线设置token有效期(web/admin token有效期30天,ios/android/h5 token有效期24小时)
int
expiredSeconds
=
24
*
60
*
60
;
if
(
sourceType
!=
3
&&
sourceType
!=
5
)
{
expiredSeconds
=
expiredSeconds
*
30
;
}
String
sourceTypeRedis
=
AccountUtils
.
getSourceType
(
sourceType
);
String
key
=
"token-"
+
token
;
// value = "token-doctor-{doctorId}";
String
value
=
cacheClient
.
get
(
key
);
cacheClient
.
set
(
key
,
value
,
expiredSeconds
);
cacheClient
.
set
(
value
+
"-"
+
sourceTypeRedis
,
key
,
expiredSeconds
);
return
true
;
}
/**
* 获取新的token
*
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录