Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
郭有超
/
SSdk
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 414b02d1
authored
Dec 10, 2019
by
郭有超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
1 parent
8eb19caa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
cocos-creator-ssdk-ts/SSdk.ts
cocos-creator-ssdk-ts/SSdk.ts
View file @
414b02d
...
...
@@ -27,6 +27,8 @@ class SSdk{
/**@description 缓存已经验证过的文本 */
_had_ver
:
any
=
{};
_had_find
:
boolean
=
false
;
constructor
(){
}
...
...
@@ -125,9 +127,9 @@ class SSdk{
this
.
_log
(
"敏感词库初始化失败 需要开启敏感词库"
);
}
}
/**@description 检测敏感词 */
public
check
(
content
,
replace
)
{
public
check
(
content
:
string
,
replace
:
string
)
{
if
(
!
this
.
_open_check
)
{
return
content
;
}
...
...
@@ -150,6 +152,12 @@ class SSdk{
return
_checked_str
;
}
public
had_ss_word
(
content
:
string
,
replace_char
:
string
){
this
.
_had_find
=
false
;
var
_checked_str
=
this
.
replace_str
(
content
,
replace_char
);
return
this
.
_had_find
;
}
public
replace_str
(
str
,
replace_char
)
{
var
len
=
str
.
length
;
// 长度从len -> 1;
...
...
@@ -162,6 +170,7 @@ class SSdk{
var
prev
=
str
.
substr
(
0
,
j
);
var
curr
=
replace_char
.
repeat
(
i
);
var
next
=
str
.
substr
(
i
+
j
,
len
-
i
-
j
);
this
.
_had_find
=
true
;
return
this
.
replace_str
(
prev
,
replace_char
)
+
curr
+
this
.
replace_str
(
next
,
replace_char
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment