后台流水区分四种装扮消费类型:气泡/昵称色/文字色/头像框

- CurrencySource 新增 MSG_BUBBLE_BUY、MSG_NAME_COLOR_BUY、MSG_TEXT_COLOR_BUY
- DecorationService::purchase() 按商品 type 选择对应 source
- 后台流水页「来源途径」筛选现在可分别查询四种装扮消费
This commit is contained in:
pllx
2026-04-27 07:08:22 +00:00
parent 3ecafd01ea
commit efb03f90b8
2 changed files with 22 additions and 6 deletions
+14 -2
View File
@@ -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 => '头像框购买',
};
}
+8 -4
View File
@@ -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) {