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
提交
3d56b048
提交
3d56b048
编写于
5月 23, 2019
作者:
dong.an
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
账号微服务
上级
46e30e41
流水线
#9202
已失败 于阶段
in 0 second
变更
1
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
24 行删除
+18
-24
AccountController.java
.../account/account/server/controller/AccountController.java
+18
-24
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/AccountController.java
浏览文件 @
3d56b048
...
...
@@ -138,18 +138,8 @@ public class AccountController extends AccountBaseController {
accountService
.
createAccount
(
account
);
//创建账号
//生成token并返回
try
{
if
(
account
.
getRegisterSource
().
intValue
()
==
7
)
{
//H5注册生成token
return
PicaResponse
.
toResponse
(
this
.
generateH5Token
(
account
.
getId
()));
}
else
{
//pc,android,ios注册生成token
//TODO 生成token; app注册更新设备信息
//super.saveToken(null, null);
return
PicaResponse
.
toResponse
(
StringUtils
.
EMPTY
);
}
}
catch
(
Exception
ex
)
{
logger
.
error
(
"生成token异常:{}"
,
ex
.
getMessage
());
return
PicaResponse
.
toResponse
(
StringUtils
.
EMPTY
);
}
String
newToken
=
this
.
generateToken
(
account
.
getId
(),
deviceType
);
return
PicaResponse
.
toResponse
(
newToken
);
}
@ApiOperation
(
"登录或注册"
)
...
...
@@ -200,19 +190,23 @@ public class AccountController extends AccountBaseController {
//生成H5 token
private
String
generateH5Token
(
Long
doctorId
)
{
//先清除旧token
String
tokenValue
=
"token-doctor-"
+
doctorId
.
toString
();
String
oldToken
=
redisClient
.
get
(
tokenValue
+
"-h5"
);
if
(
StringUtils
.
isNotBlank
(
oldToken
))
{
redisClient
.
del
(
oldToken
);
String
newToken
=
StringUtils
.
EMPTY
;
try
{
//先清除旧token
String
tokenValue
=
"token-doctor-"
+
doctorId
.
toString
();
String
oldToken
=
redisClient
.
get
(
tokenValue
+
"-h5"
);
if
(
StringUtils
.
isNotBlank
(
oldToken
))
{
redisClient
.
del
(
oldToken
);
}
//生成新token
int
expiredSeconds
=
30
*
24
*
60
*
60
;
//H5 token有效期30天
newToken
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toUpperCase
();
String
tokenKey
=
"token-"
+
newToken
;
redisClient
.
set
(
tokenKey
,
tokenValue
,
expiredSeconds
);
redisClient
.
set
(
tokenValue
+
"-h5"
,
tokenKey
,
expiredSeconds
);
}
catch
(
Exception
ex
)
{
logger
.
error
(
"生成H5 token异常:{}"
+
ex
.
getMessage
(),
ex
);
}
//生成新token
int
expiredSeconds
=
30
*
24
*
60
*
60
;
//H5 token有效期30天
String
newToken
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toUpperCase
();
String
tokenKey
=
"token-"
+
newToken
;
redisClient
.
set
(
tokenKey
,
tokenValue
,
expiredSeconds
);
redisClient
.
set
(
tokenValue
+
"-h5"
,
tokenKey
,
expiredSeconds
);
return
newToken
;
}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录