完善expert领域

This commit is contained in:
wangjinlei
2026-06-05 11:01:16 +08:00
parent 28023be44a
commit 93d25de094
6 changed files with 558 additions and 13 deletions

View File

@@ -102,6 +102,7 @@ class UserFieldAiService
throw new Exception('LLM returned empty field');
}
$this->updateFieldAi($userId, $fieldAi, self::STATUS_DONE, '');
$this->syncLinkedExperts($userId);
return ['ok' => true, 'field_ai' => $fieldAi];
} catch (\Throwable $e) {
$this->updateFieldAi($userId, '', self::STATUS_FAILED, mb_substr($e->getMessage(), 0, 500));
@@ -460,4 +461,17 @@ class UserFieldAiService
$line = date('Y-m-d H:i:s') . ' ' . $msg . PHP_EOL;
@file_put_contents($this->logFile, $line, FILE_APPEND);
}
/**
* user.field_ai 更新后,同步到同邮箱 expert方案 C 关联)。
*/
private function syncLinkedExperts($userId)
{
try {
$svc = new ExpertFieldAiService();
$svc->syncExpertsByUserId(intval($userId), true);
} catch (\Throwable $e) {
$this->log('[FieldAi] sync expert fail user_id=' . $userId . ' ' . $e->getMessage());
}
}
}