mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 19:23:26 +00:00
perf: 对话支持拼音搜索
This commit is contained in:
parent
5f50fc7b3b
commit
67e2ec4093
@ -136,6 +136,7 @@ class WebSocketDialog extends AbstractModel
|
|||||||
$this->has_file = $msgBuilder->clone()->whereMtype('file')->exists();
|
$this->has_file = $msgBuilder->clone()->whereMtype('file')->exists();
|
||||||
$this->has_link = $msgBuilder->clone()->whereLink(1)->exists();
|
$this->has_link = $msgBuilder->clone()->whereLink(1)->exists();
|
||||||
}
|
}
|
||||||
|
$this->name_py = Base::cn2pinyin($this->name);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2860,8 +2860,10 @@ class Base
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (!preg_match("/^[a-zA-Z0-9_.]+$/", $str)) {
|
if (!preg_match("/^[a-zA-Z0-9_.]+$/", $str)) {
|
||||||
|
$str = Cache::rememberForever("cn2pinyin:" . md5($str), function() use ($str) {
|
||||||
$pinyin = new Pinyin();
|
$pinyin = new Pinyin();
|
||||||
$str = $pinyin->permalink($str, '');
|
return $pinyin->permalink($str, '');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -227,20 +227,20 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (dialogKey) {
|
if (dialogKey) {
|
||||||
const {name, last_msg} = dialog;
|
const {name, name_py, last_msg} = dialog;
|
||||||
let msgKey = "";
|
let searchString = `${name} ${name_py}`
|
||||||
if (last_msg) {
|
if (last_msg) {
|
||||||
switch (last_msg.type) {
|
switch (last_msg.type) {
|
||||||
case 'text':
|
case 'text':
|
||||||
msgKey = last_msg.msg.text.replace(/<[^>]+>/g,"")
|
searchString += ` ${last_msg.msg.text.replace(/<[^>]+>/g,"")}`
|
||||||
break
|
break
|
||||||
case 'meeting':
|
case 'meeting':
|
||||||
case 'file':
|
case 'file':
|
||||||
msgKey = last_msg.msg.name
|
searchString += ` ${last_msg.msg.name}`
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$A.strExists(name, dialogKey) && !$A.strExists(msgKey, dialogKey)) {
|
if (!$A.strExists(searchString, dialogKey)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (dialogActive) {
|
} else if (dialogActive) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user