Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
T
tcm-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TCM
tcm-system
Commits
6bd7e3d5
Commit
6bd7e3d5
authored
Apr 01, 2025
by
dmy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试环境验证码返回
parent
5b5d46ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
7 deletions
+52
-7
CodeService.java
.../java/com/pangding/web/authority/vo/code/CodeService.java
+7
-5
DebugConfig.java
.../java/com/pangding/web/authority/vo/code/DebugConfig.java
+41
-0
bootstrap-dev.yml
src/main/resources/bootstrap-dev.yml
+2
-1
bootstrap-mest.yml
src/main/resources/bootstrap-mest.yml
+2
-1
No files found.
src/main/java/com/pangding/web/authority/vo/code/CodeService.java
View file @
6bd7e3d5
...
...
@@ -8,6 +8,7 @@ import com.pangding.web.cache.CacheName;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
org.springframework.stereotype.Component
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -18,19 +19,20 @@ import java.util.concurrent.TimeUnit;
/**
* 验证码服务
*
*/
@Component
public
class
CodeService
{
private
final
DefaultKaptcha
defaultKaptcha
;
private
final
DebugConfig
debugConfig
;
@CreateCache
(
name
=
CacheName
.
USER_PASSWORD_CODE
,
cacheType
=
CacheType
.
REMOTE
,
expire
=
60
,
timeUnit
=
TimeUnit
.
MINUTES
)
private
Cache
<
String
,
String
>
cache
;
public
CodeService
(
DefaultKaptcha
defaultKaptcha
)
{
public
CodeService
(
DefaultKaptcha
defaultKaptcha
,
DebugConfig
debugConfig
)
{
this
.
defaultKaptcha
=
defaultKaptcha
;
this
.
debugConfig
=
debugConfig
;
}
...
...
@@ -53,9 +55,9 @@ public class CodeService {
// 对字节组Base64编码
String
img
=
Base64
.
getEncoder
().
encodeToString
(
out
.
toByteArray
());
CodeVo
code
=
new
CodeVo
(
StringHelper
.
getNewID
(),
img
);
//
if (debugConfig.isDebug()) {
//
code.setCode(text);
//
}
if
(
debugConfig
.
isDebug
())
{
code
.
setCode
(
text
);
}
// 验证验证码文字
cache
.
put
(
code
.
getId
(),
text
);
return
code
;
...
...
src/main/java/com/pangding/web/authority/vo/code/DebugConfig.java
0 → 100644
View file @
6bd7e3d5
package
com
.
pangding
.
web
.
authority
.
vo
.
code
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
@Component
public
class
DebugConfig
{
@Value
(
"${pd.debug:false}"
)
private
boolean
debug
;
@Value
(
"${pd.debugLog:false}"
)
private
boolean
debugLog
;
@Value
(
"${pd.cache:true}"
)
private
boolean
cache
;
public
DebugConfig
()
{
}
public
boolean
isDebug
()
{
return
this
.
debug
;
}
public
void
setDebug
(
boolean
debug
)
{
this
.
debug
=
debug
;
}
public
boolean
isDebugLog
()
{
return
this
.
debugLog
;
}
public
void
setDebugLog
(
boolean
debugLog
)
{
this
.
debugLog
=
debugLog
;
}
public
boolean
isCache
()
{
return
this
.
cache
;
}
public
void
setCache
(
boolean
cache
)
{
this
.
cache
=
cache
;
}
}
src/main/resources/bootstrap-dev.yml
View file @
6bd7e3d5
...
...
@@ -6,7 +6,8 @@ eureka:
yzg
:
logAll
:
true
PrintSql
:
true
pd
:
debug
:
true
msg
:
payMsgId
:
4
...
...
src/main/resources/bootstrap-mest.yml
View file @
6bd7e3d5
...
...
@@ -5,7 +5,8 @@ eureka:
yzg
:
logAll
:
true
PrintSql
:
true
pd
:
debug
:
true
msg
:
payMsgId
:
4
groupProductMsgId
:
10
...
...
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