Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
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
黄奎
mall.oytour.com
Commits
b4193488
Commit
b4193488
authored
Jun 11, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
eb37462e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
3 deletions
+52
-3
ConvertHelper.cs
Mall.Common/Plugin/ConvertHelper.cs
+50
-2
Mall.Module.MarketingCenter.csproj
...Module.MarketingCenter/Mall.Module.MarketingCenter.csproj
+1
-0
MiniprogramTemplateModule.cs
Mall.Module.MarketingCenter/MiniprogramTemplateModule.cs
+1
-1
No files found.
Mall.Common/Plugin/ConvertHelper.cs
View file @
b4193488
...
...
@@ -13,6 +13,54 @@ namespace Mall.Common
public
class
ConvertHelper
{
/// <summary>
/// json字符串将属性值中的英文双引号变成中文双引号
/// </summary>
/// <param name="strJson">json字符串</param>
/// <returns></returns>
public
static
string
JsonReplaceSign
(
string
strJson
)
{
//获取每个字符
char
[]
temp
=
strJson
.
ToCharArray
();
//获取字符数组长度
int
n
=
temp
.
Length
;
//循环整个字符数组
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
//查找json属性值(:+" )
if
(
temp
[
i
]
==
':'
&&
temp
[
i
+
1
]
==
'"'
)
{
//循环属性值内的字符(:+2 推算到value值)
for
(
int
j
=
i
+
2
;
j
<
n
;
j
++)
{
//判断是否是英文双引号
if
(
temp
[
j
]
==
'"'
)
{
//排除json属性的双引号
if
(
temp
[
j
+
1
]
!=
','
&&
temp
[
j
+
1
]
!=
'}'
)
{
//替换成中文双引号
temp
[
j
]
=
'”'
;
}
else
if
(
temp
[
j
+
1
]
==
','
||
temp
[
j
+
1
]
==
'}'
)
{
break
;
}
}
else
if
(
temp
[
j
]
==
'-'
)
{
temp
[
j
]
=
' '
;
}
else
if
(
true
)
{
// 要过虑其他字符,继续添加判断就可以
}
}
}
}
return
new
String
(
temp
);
}
/// <summary>
/// 转换字符流成字符串
/// </summary>
...
...
@@ -45,7 +93,7 @@ namespace Mall.Common
return
data
;
}
/// <summary>
/// 类型转换
/// </summary>
...
...
@@ -103,7 +151,7 @@ namespace Mall.Common
/// <param name="obj"></param>
/// <param name="defaultValue">默认值</param>
/// <returns></returns>
public
static
int
ToInt
(
object
obj
,
int
defaultValue
=
0
)
public
static
int
ToInt
(
object
obj
,
int
defaultValue
=
0
)
{
int
result
=
defaultValue
;
if
(
obj
!=
null
)
...
...
Mall.Module.MarketingCenter/Mall.Module.MarketingCenter.csproj
View file @
b4193488
...
...
@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" />
</ItemGroup>
...
...
Mall.Module.MarketingCenter/MiniprogramTemplateModule.cs
View file @
b4193488
...
...
@@ -55,7 +55,7 @@ namespace Mall.Module.MarketingCenter
{
if
(
item
.
TemplateData
!=
null
&&
!
string
.
IsNullOrEmpty
(
item
.
TemplateData
))
{
item
.
ComponentDataList
=
JsonHelper
.
DeserializeObject
<
List
<
ComponentItem
>>(
item
.
TemplateData
);
item
.
ComponentDataList
=
JsonHelper
.
DeserializeObject
<
List
<
ComponentItem
>>(
Mall
.
Common
.
ConvertHelper
.
JsonReplaceSign
(
item
.
TemplateData
)
);
if
(
item
.
ComponentDataList
!=
null
&&
item
.
ComponentDataList
.
Count
>
0
)
{
foreach
(
var
subItem
in
item
.
ComponentDataList
)
...
...
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