'decimal:2', 'comment_count' => 'integer', 'good_comment_count' => 'integer', 'medium_comment_count' => 'integer', 'bad_comment_count' => 'integer', 'tag_statistics' => 'array', ]; /** * 获取统计所属的技师 */ public function coach() { return $this->belongsTo(CoachUser::class, 'coach_id'); } /** * 更新标签统计 */ public function updateTagStatistics(array $tagCounts): bool { return $this->update([ 'tag_statistics' => $tagCounts, ]); } /** * 更新评分统计 */ public function updateScoreStatistics( float $avgScore, int $commentCount, int $goodCount, int $mediumCount, int $badCount ): bool { return $this->update([ 'avg_score' => $avgScore, 'comment_count' => $commentCount, 'good_comment_count' => $goodCount, 'medium_comment_count' => $mediumCount, 'bad_comment_count' => $badCount, ]); } }