diff --git a/app/Enums/CurrencySource.php b/app/Enums/CurrencySource.php index 393cebf..1c62907 100644 --- a/app/Enums/CurrencySource.php +++ b/app/Enums/CurrencySource.php @@ -143,7 +143,16 @@ enum CurrencySource: string /** 查看别人隐藏信息扣费 */ case USER_INFO_REVEAL = 'user_info_reveal'; - /** 购买消息装扮消耗(气泡/昵称颜色,扣除金币) */ + /** 购买消息装扮消耗(气泡,扣除金币) */ + case MSG_BUBBLE_BUY = 'msg_bubble_buy'; + + /** 购买昵称颜色装扮消耗(扣除金币) */ + case MSG_NAME_COLOR_BUY = 'msg_name_color_buy'; + + /** 购买文字颜色装扮消耗(扣除金币) */ + case MSG_TEXT_COLOR_BUY = 'msg_text_color_buy'; + + /** 购买消息装扮消耗(气泡/昵称颜色,扣除金币)—— 旧版兼容,新购买不再使用 */ case MSG_DECORATION_BUY = 'msg_decoration_buy'; /** 购买头像框消耗(扣除金币) */ @@ -196,7 +205,10 @@ enum CurrencySource: string self::GOMOKU_REFUND => '五子棋入场费返还', self::VIDEO_REWARD => '看视频奖励', self::USER_INFO_REVEAL => '信息查看付费', - self::MSG_DECORATION_BUY => '消息装扮购买', + self::MSG_BUBBLE_BUY => '消息气泡购买', + self::MSG_NAME_COLOR_BUY => '昵称颜色购买', + self::MSG_TEXT_COLOR_BUY => '文字颜色购买', + self::MSG_DECORATION_BUY => '消息装扮购买(旧)', self::AVATAR_FRAME_BUY => '头像框购买', }; } diff --git a/app/Services/DecorationService.php b/app/Services/DecorationService.php index 1358c1f..dc29ae1 100644 --- a/app/Services/DecorationService.php +++ b/app/Services/DecorationService.php @@ -74,10 +74,14 @@ class DecorationService $days = max(1, (int) ($item->duration_days ?? 1)); $expiresAt = Carbon::now()->addDays($days); - // 头像框与其他装扮使用不同的流水来源标识 - $source = $item->type === 'avatar_frame' - ? CurrencySource::AVATAR_FRAME_BUY - : CurrencySource::MSG_DECORATION_BUY; + // 按装扮类型使用不同的流水来源标识,便于后台按类型筛选消费记录 + $source = match ($item->type) { + 'msg_bubble' => CurrencySource::MSG_BUBBLE_BUY, + 'msg_name_color' => CurrencySource::MSG_NAME_COLOR_BUY, + 'msg_text_color' => CurrencySource::MSG_TEXT_COLOR_BUY, + 'avatar_frame' => CurrencySource::AVATAR_FRAME_BUY, + default => CurrencySource::MSG_DECORATION_BUY, + }; // 事务包裹:扣金币、写购买记录、更新激活状态三步原子操作 DB::transaction(function () use ($user, $item, $slot, $days, $expiresAt, $source) {