去除多余的日志输出
This commit is contained in:
@@ -124,7 +124,6 @@ class WechatAccountHealthScoreService
|
||||
}
|
||||
|
||||
try {
|
||||
Log::info("开始计算账号健康分,accountId: {$accountId}, forceRecalculateBase: " . ($forceRecalculateBase ? 'true' : 'false'));
|
||||
|
||||
// 获取账号数据
|
||||
if (empty($accountData)) {
|
||||
@@ -157,9 +156,6 @@ class WechatAccountHealthScoreService
|
||||
|
||||
// 计算基础分(只计算一次,除非强制重新计算)
|
||||
if (!$scoreRecord['baseScoreCalculated'] || $forceRecalculateBase) {
|
||||
Log::info("计算基础分,accountId: {$accountId}, baseScoreCalculated: " .
|
||||
($scoreRecord['baseScoreCalculated'] ? 'true' : 'false') .
|
||||
", forceRecalculateBase: " . ($forceRecalculateBase ? 'true' : 'false'));
|
||||
|
||||
$baseScoreData = $this->calculateBaseScore($accountData, $scoreRecord);
|
||||
$this->updateBaseScore($accountId, $baseScoreData);
|
||||
@@ -171,7 +167,6 @@ class WechatAccountHealthScoreService
|
||||
}
|
||||
|
||||
// 计算动态分(每次都要重新计算)
|
||||
Log::info("计算动态分,accountId: {$accountId}");
|
||||
$dynamicScoreData = $this->calculateDynamicScore($accountData, $scoreRecord);
|
||||
|
||||
// 计算总分
|
||||
@@ -185,9 +180,6 @@ class WechatAccountHealthScoreService
|
||||
// 计算每日最大加人次数
|
||||
$maxAddFriendPerDay = $this->getMaxAddFriendPerDay($healthScore);
|
||||
|
||||
Log::info("健康分计算结果,accountId: {$accountId}, baseScore: {$baseScore}, dynamicScore: {$dynamicScore}, " .
|
||||
"healthScore: {$healthScore}, maxAddFriendPerDay: {$maxAddFriendPerDay}");
|
||||
|
||||
// 更新评分记录
|
||||
$updateData = [
|
||||
'dynamicScore' => $dynamicScore,
|
||||
@@ -1190,7 +1182,7 @@ class WechatAccountHealthScoreService
|
||||
|
||||
try {
|
||||
$startTime = microtime(true);
|
||||
Log::info("开始批量计算健康分,batchSize: {$batchSize}, forceRecalculateBase: " . ($forceRecalculateBase ? 'true' : 'false') .
|
||||
// 去除开始日志,减少日志空间消耗
|
||||
", useMultiThread: " . ($useMultiThread ? 'true' : 'false'));
|
||||
|
||||
$stats = [
|
||||
@@ -1202,14 +1194,12 @@ class WechatAccountHealthScoreService
|
||||
|
||||
// 如果没有指定账号ID,则处理所有账号
|
||||
if (empty($accountIds)) {
|
||||
Log::info("未指定账号ID,处理所有未删除账号");
|
||||
$accountIds = Db::table(self::TABLE_WECHAT_ACCOUNT)
|
||||
->where('isDeleted', 0)
|
||||
->column('id');
|
||||
}
|
||||
|
||||
$stats['total'] = count($accountIds);
|
||||
Log::info("需要处理的账号总数: {$stats['total']}");
|
||||
|
||||
// 优化:减小批次大小,提高并行处理效率
|
||||
$batchSize = min($batchSize, 50);
|
||||
@@ -1268,7 +1258,10 @@ class WechatAccountHealthScoreService
|
||||
|
||||
$endTime = microtime(true);
|
||||
$totalDuration = round($endTime - $startTime, 2);
|
||||
Log::info("批量计算健康分完成,总耗时: {$totalDuration}秒,成功: {$stats['success']},失败: {$stats['failed']}");
|
||||
// 只在有失败时记录日志
|
||||
if ($stats['failed'] > 0) {
|
||||
Log::warning("批量计算健康分完成,总耗时: {$totalDuration}秒,成功: {$stats['success']},失败: {$stats['failed']}");
|
||||
}
|
||||
|
||||
return $stats;
|
||||
} catch (\PDOException $e) {
|
||||
@@ -1294,7 +1287,7 @@ class WechatAccountHealthScoreService
|
||||
private function processBatch($batch, $batchIndex, $batchCount, $forceRecalculateBase)
|
||||
{
|
||||
$batchStartTime = microtime(true);
|
||||
Log::info("开始处理第 " . ($batchIndex + 1) . " 批,共 " . count($batch) . " 个账号");
|
||||
// 去除批次开始日志,减少日志空间消耗
|
||||
|
||||
$stats = [
|
||||
'success' => 0,
|
||||
|
||||
Reference in New Issue
Block a user