Commit 414b02d1 by 郭有超

fix bug

1 parent 8eb19caa
Showing with 11 additions and 2 deletions
......@@ -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);
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!