Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-email
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-email
Commits
aba5c5f5
Commit
aba5c5f5
authored
Sep 28, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log日志
parent
15365f2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
yd-email-feign/src/main/java/com/yd/email/feign/utils/StringUtil.java
+8
-2
No files found.
yd-email-feign/src/main/java/com/yd/email/feign/utils/StringUtil.java
View file @
aba5c5f5
...
...
@@ -3,7 +3,9 @@ package com.yd.email.feign.utils;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
class
StringUtil
{
/**
...
...
@@ -18,15 +20,19 @@ public class StringUtil {
// 解析 JSON 字符串
JSONArray
variablesArray
=
JSON
.
parseArray
(
variables
);
String
result
=
content
;
log
.
info
(
"JSONArray variablesArray:{}"
,
JSON
.
toJSONString
(
variablesArray
));
log
.
info
(
"result:{}"
,
result
);
// 遍历变量数组,逐个替换占位符
for
(
int
i
=
0
;
i
<
variablesArray
.
size
();
i
++)
{
JSONObject
variable
=
variablesArray
.
getJSONObject
(
i
);
String
enKey
=
variable
.
getString
(
"en_key"
);
String
value
=
variable
.
getString
(
"content"
);
log
.
info
(
"JSONObject variable:{}"
,
JSON
.
toJSONString
(
variable
));
log
.
info
(
"variable.getString(\"en_key\"):{}"
,
enKey
);
log
.
info
(
"variable.getString(\"content\"):{}"
,
value
);
// 替换 {{en_key}} 为对应的值
result
=
result
.
replace
(
"{{"
+
enKey
+
"}}"
,
value
);
log
.
info
(
"result.replace:{}"
,
result
);
}
return
result
;
...
...
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