Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
roncoo
roncoo-education
比较版本
946f770524bfad06784b704c311263995f3faf24...90b5c3c61ed95608cb70edfc27d2419fcb0ff748
R
roncoo-education
项目概览
roncoo
/
roncoo-education
9 个月 前同步成功
通知
146
Star
5
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roncoo-education
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
源分支
90b5c3c61ed95608cb70edfc27d2419fcb0ff748
选择Git版本
...
目标分支
946f770524bfad06784b704c311263995f3faf24
选择Git版本
比较
Commits (7)
https://gitcode.net/roncoocom/roncoo-education/-/commit/9c494b4e9718e79e5b7383a67ff821979bae163a
feat: 优化验证码发送逻辑
2023-11-27T15:21:55+08:00
fengyw
fengyw@roncoo.com
https://gitcode.net/roncoocom/roncoo-education/-/commit/136294a40644b1f3bc983495195b59c16fd525da
feat: 优化验证码发送逻辑
2023-11-27T15:27:06+08:00
fengyw
fengyw@roncoo.com
https://gitcode.net/roncoocom/roncoo-education/-/commit/2cc635f7c2f8158a9f04fe4cea7cc9d15d6cb47b
feat: 优化验证码发送逻辑
2023-11-27T15:29:23+08:00
fengyw
fengyw@roncoo.com
https://gitcode.net/roncoocom/roncoo-education/-/commit/39ebea1aac450e00534c5b79f5cb05660f08da2d
feat: 优化验证码发送逻辑
2023-11-27T15:37:14+08:00
fengyw
fengyw@roncoo.com
https://gitcode.net/roncoocom/roncoo-education/-/commit/08d0bcaf81617ade66bcda95e58c5f9734270d4c
feat: 优化验证码发送逻辑
2023-11-27T15:39:19+08:00
fengyw
fengyw@roncoo.com
https://gitcode.net/roncoocom/roncoo-education/-/commit/28d4a8b3673d6a36662a452c7cdf676316c3b9ec
feat: 优化验证码发送逻辑
2023-11-27T15:40:17+08:00
fengyw
fengyw@roncoo.com
https://gitcode.net/roncoocom/roncoo-education/-/commit/90b5c3c61ed95608cb70edfc27d2419fcb0ff748
feat: 异常处理
2023-11-27T15:51:29+08:00
fengyw
fengyw@roncoo.com
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
14 deletion
+30
-14
roncoo-education-common/roncoo-education-common-service/src/main/java/com/roncoo/education/common/cache/CacheRedis.java
...in/java/com/roncoo/education/common/cache/CacheRedis.java
+2
-2
roncoo-education-common/roncoo-education-common-service/src/main/java/com/roncoo/education/common/service/HandlerException.java
...com/roncoo/education/common/service/HandlerException.java
+24
-7
roncoo-education-service/roncoo-education-service-user/src/main/java/com/roncoo/education/user/service/api/biz/ApiUsersBiz.java
...om/roncoo/education/user/service/api/biz/ApiUsersBiz.java
+4
-5
未找到文件。
roncoo-education-common/roncoo-education-common-service/src/main/java/com/roncoo/education/common/cache/CacheRedis.java
浏览文件 @
90b5c3c6
...
...
@@ -29,7 +29,7 @@ public class CacheRedis {
public
<
T
>
T
set
(
String
key
,
T
t
)
{
if
(
t
!=
null
)
{
String
value
=
t
.
toString
();
if
(!(
t
instanceof
String
))
{
if
(!(
t
instanceof
String
||
t
instanceof
Long
||
t
instanceof
Integer
))
{
value
=
JSUtil
.
toJsonString
(
t
);
}
stringRedisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeToLive
,
TimeUnit
.
MILLISECONDS
);
...
...
@@ -43,7 +43,7 @@ public class CacheRedis {
public
<
T
>
T
set
(
String
key
,
T
t
,
int
time
,
TimeUnit
timeUnit
)
{
if
(
t
!=
null
)
{
String
value
=
t
.
toString
();
if
(!(
t
instanceof
String
))
{
if
(!(
t
instanceof
String
||
t
instanceof
Long
||
t
instanceof
Integer
))
{
value
=
JSUtil
.
toJsonString
(
t
);
}
stringRedisTemplate
.
opsForValue
().
set
(
key
,
value
,
time
,
timeUnit
);
...
...
roncoo-education-common/roncoo-education-common-service/src/main/java/com/roncoo/education/common/service/HandlerException.java
浏览文件 @
90b5c3c6
...
...
@@ -5,11 +5,15 @@ import com.roncoo.education.common.core.base.Result;
import
com.roncoo.education.common.core.tools.JSUtil
;
import
feign.FeignException
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.FieldError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
java.util.Map
;
import
java.util.StringJoiner
;
/**
* @author wujing
...
...
@@ -18,27 +22,40 @@ import java.util.Map;
public
class
HandlerException
extends
BaseController
{
@ExceptionHandler
({
FeignException
.
class
})
@ResponseStatus
(
HttpStatus
.
OK
)
@ResponseStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
)
public
Result
<
String
>
processBizException
(
FeignException
e
)
{
String
msg
=
e
.
getCause
().
toString
().
split
(
"\n|\r\n|\r"
)[
1
];
log
.
error
(
msg
);
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
m
=
JSUtil
.
parseObject
(
msg
,
Map
.
class
);
String
msg
=
e
.
getMessage
();
if
(!
StringUtils
.
hasText
(
msg
))
{
return
Result
.
error
(
"服务繁忙,请重试"
);
}
log
.
error
(
"FeignException, {}"
,
msg
);
Map
<
String
,
Object
>
m
=
JSUtil
.
parseArray
(
msg
.
substring
(
msg
.
lastIndexOf
(
"[{"
)),
Map
.
class
).
get
(
0
);
if
(
null
!=
m
.
get
(
"message"
))
{
return
Result
.
error
(
m
.
get
(
"message"
).
toString
());
}
return
Result
.
error
(
"服务繁忙,请重试"
);
}
@ExceptionHandler
({
MethodArgumentNotValidException
.
class
})
@ResponseStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
)
public
Result
<
String
>
processException
(
MethodArgumentNotValidException
ex
)
{
StringJoiner
joiner
=
new
StringJoiner
(
"、"
);
for
(
FieldError
fieldError
:
ex
.
getBindingResult
().
getFieldErrors
())
{
joiner
.
add
(
fieldError
.
getDefaultMessage
());
}
log
.
error
(
"MethodArgumentNotValidException, {}"
,
joiner
);
return
Result
.
error
(
joiner
.
toString
());
}
@ExceptionHandler
({
BaseException
.
class
})
@ResponseStatus
(
HttpStatus
.
OK
)
@ResponseStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
)
public
Result
<
String
>
processException
(
BaseException
e
)
{
log
.
error
(
"BaseException"
,
e
);
return
Result
.
error
(
e
.
getMessage
());
}
@ExceptionHandler
({
Exception
.
class
})
@ResponseStatus
(
HttpStatus
.
OK
)
@ResponseStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
)
public
Result
<
String
>
processException
(
Exception
e
)
{
log
.
error
(
"Exception"
,
e
);
return
Result
.
error
(
"服务繁忙,请重试"
);
...
...
roncoo-education-service/roncoo-education-service-user/src/main/java/com/roncoo/education/user/service/api/biz/ApiUsersBiz.java
浏览文件 @
90b5c3c6
...
...
@@ -178,15 +178,14 @@ public class ApiUsersBiz extends BaseBiz {
private
Boolean
sendCodeCheck
(
String
mobile
)
{
String
count
=
cacheRedis
.
get
(
Constants
.
RedisPre
.
CODE_STAT
+
mobile
);
if
(
StringUtils
.
hasText
(
count
))
{
int
countNum
=
Integer
.
valueOf
(
count
);
int
countNum
=
cacheRedis
.
set
(
Constants
.
RedisPre
.
CODE_STAT
+
mobile
,
Integer
.
valueOf
(
count
).
intValue
()
+
1
,
5
,
TimeUnit
.
MINUTES
);
if
(
countNum
<
2
)
{
cacheRedis
.
set
(
Constants
.
RedisPre
.
CODE_STAT
+
mobile
,
countNum
++);
return
Boolean
.
TRUE
;
}
}
else
{
cacheRedis
.
set
(
Constants
.
RedisPre
.
CODE_STAT
+
mobile
,
1
);
return
Boolean
.
FALSE
;
}
return
Boolean
.
FALSE
;
cacheRedis
.
set
(
Constants
.
RedisPre
.
CODE_STAT
+
mobile
,
1
,
5
,
TimeUnit
.
MINUTES
);
return
Boolean
.
TRUE
;
}
public
Result
<
String
>
password
(
PasswordReq
req
)
{
...
...