no message

This commit is contained in:
kuaifan
2025-04-24 08:37:35 +08:00
parent f5a343f358
commit eccb3e2825
6 changed files with 60 additions and 33 deletions

View File

@@ -429,10 +429,9 @@ class ZincSearchDialogMsg
/**
* 同步用户(建议在异步进程中使用)
* @param WebSocketDialogUser $dialogUser
* @param bool $full 跳过判断是否已经存在(全量更新)
* @return bool
*/
public static function userSync(WebSocketDialogUser $dialogUser, bool $full = false): bool
public static function userSync(WebSocketDialogUser $dialogUser): bool
{
if (!self::ensureIndex()) {
return false;
@@ -453,13 +452,8 @@ class ZincSearchDialogMsg
try {
// 查询用户是否存在
if ($full) {
$hits = null;
} else {
$result = ZincSearchBase::elasticSearch(self::$indexNameUser, $searchParams);
$hits = $result['data']['hits']['hits'] ?? [];
}
$result = ZincSearchBase::elasticSearch(self::$indexNameUser, $searchParams);
$hits = $result['data']['hits']['hits'] ?? [];
// 同步用户(存在更新、不存在添加)
$result = ZincSearchBase::addDoc(self::$indexNameUser, $data);