Files
bl/help/异常经验数据修复.sql
昔念 b049e129c5
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
1
2026-02-03 22:44:13 +08:00

15 lines
705 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

SELECT
player_id,
-- 使用 CASE WHEN 实现条件判断超过 1000 万重置为 200 否则保留原数值
CASE
WHEN (data->>'exp_pool')::bigint > 10000000 -- 判断是否超过 1000
THEN 2000000::bigint -- 超过则重置为 200 统一为 bigint 类型避免类型不一致
ELSE (data->>'exp_pool')::bigint -- 未超过则保留原 bigint 数值
END AS online_time
FROM "player_info"
-- 保留 jsonb_exists 函数判断字段存在避免占位符冲突
WHERE
jsonb_exists(data, 'exp_pool')
AND (data->>'exp_pool')::bigint > 0 -- 此处仍保留原判断过滤大于 0 的数据
-- 按修正后的 online_time 降序排序
ORDER BY online_time DESC;