Commit Graph
18 Commits
Author SHA1 Message Date
lizhilun e69930799c fix security and import validation 2026-07-01 16:13:47 +08:00
lizhilunandClaude Opus 4.6 6467048f38 fix: 修复年度净收入计算错误 - 避免数据重复累加
问题:grandTotal 累加了 UNION ALL 的所有行数据,
包括月明细和年汇总,导致总额约为实际值的2倍。

修复:只累加 month='00' 的年度汇总数据。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 17:25:48 +08:00
lizhilunandClaude Opus 4.6 ac2d21a5a0 fix: 修复添加记录后首页数据不刷新的问题
将缓存清除逻辑从 stats.js 路由移至 app.js 全局中间件,
确保 records.js 路由的写操作也能触发缓存清除。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 16:59:32 +08:00
lizhilunandClaude Opus 4.6 d551841035 refactor: 系统优化 - 错误处理、输入验证、无限滚动
主要改进:
- 新增配置管理 (server/config.js)
- 新增日志工具 (server/utils/logger.js)
- 添加全局错误处理中间件,统一错误响应格式
- 添加输入验证和 AppError 错误类
- 重构 db.js 迁移逻辑,代码更清晰
- 前端列表改为无限滚动加载,每页 20 条
- 封装 AppState 状态管理模块

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 10:39:58 +08:00
lizhilunandClaude Opus 4.6 19e5a48f07 refactor: 清理代码 - 移除死代码和调试语句
- 移除未使用的 currentListId 变量
- 移除空的 setupInfiniteScroll 函数
- 移除重复的 partner 变量声明
- 移除调试用的 console.log 语句

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 22:18:49 +08:00
lizhilunandClaude Opus 4.6 9126348d1b fix: 修复分页和缓存相关bug
- 前端: 移除无限滚动,改为一次性加载全部数据
- 前端: monthly-records接口添加limit=1000参数
- 前端: 修复edit-modal.js中loadListData调用参数
- 后端: 修复stats.js中getCached函数Promise处理
- 后端: 修复records.js各接口正确传递limit参数
- 后端: 修复partner-records SQL参数数量问题
- 统一版本号强制浏览器刷新缓存

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 22:12:11 +08:00
lizhilunandClaude Opus 4.6 df3a9daa65 perf: 系统性能优化 - 数据库索引、缓存、GZIP压缩和查询合并
- 添加3个复合索引提升查询性能 (user_date, user_category, destination)
- 添加GZIP压缩和静态资源缓存 (maxAge: 1h)
- 添加API响应no-cache头
- 添加stats端点2分钟内存缓存 (per-user key, LRU淘汰)
- 合并多次数据库查询为单次查询
- 添加滚动防抖改善移动端体验
- 修复res.once内存泄漏问题

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 10:25:37 +08:00
lizhilunandClaude Opus 4.6 3a4048a29e fix: 修复 partner-records 缺少 source 参数
CASE 表达式中的 source=? 需要单独的 partner 参数

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:37:23 +08:00
lizhilunandClaude Opus 4.6 f381f93507 fix: 修复 partner-records SQL 参数顺序错误
参数顺序从 user_id, partner, partner 改为 partner, user_id, partner
以匹配 SQL 中 source, user_id, partner, source 的占位符顺序

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:35:19 +08:00
lizhilunandClaude Opus 4.6 d473e3a431 fix: 修复重构引入的 bug
- partner-records: 修复 SQL 参数顺序错误
- partner-records: 移除对已删除变量的引用
- stats.js: 修复 toFixed 在数字原型上调用的问题
- stats.js: 简化 onclick 处理避免转义问题

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:27:39 +08:00
lizhilunandClaude Opus 4.6 0b450a65ed perf: 优化数据库查询和前端代码质量
- 添加 records 表常用字段索引提升查询性能
- 合并月度/老板/陪玩记录查询减少数据库往返
- 提取重复的横向柱状图渲染逻辑为通用函数
- 移除调试用的 console.log 语句

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:22:15 +08:00
lizhilunandClaude Opus 4.6 14927f74aa fix: 修复柱状图高度比例计算并添加月度筛选功能
- 修复最近7天收入柱状图高度使用百分比导致比例失真问题,改为像素计算
- 老板/陪玩交易详情页添加"全部/当月"切换按钮
- 老板/陪玩交易详情页添加月度导航切换功能
- 老板/陪玩交易详情页添加自动加载更多数据功能

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 10:13:02 +08:00
lizhilunandClaude Opus 4.6 3d8d03a66e fix: 修复老板/陪玩排行榜预览数据不显示
API 直接返回数组,前端错误地使用了 data.rows 导致数据为空。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 10:06:33 +08:00
lizhilunandClaude Opus 4.6 a0466fda3b fix: 修复 renderDispatchItem 除零问题
当 r.quantity 为 0 时,原代码 r.amount / r.quantity 会导致除零错误。
修复:优先使用 r.unit_price,仅在 unit_price 不存在时才计算,并添加防护。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 09:58:33 +08:00
lizhilunandClaude Opus 4.6 2ebac98f07 refactor: 重构代码减少重复并添加分页
后端 (records.js):
- 提取通用分页查询函数 queryPagedRecords
- 5个列表接口 (orders/other-income/red-envelope/milk-tea/dispatches) 复用同一函数

后端 (stats.js):
- 为 monthly-records, boss-records, partner-records, daily-detail 添加分页支持
- 新增 page, limit, totalCount 返回字段

前端 (order-list.js):
- 提取通用列表配置 listConfig
- 统一渲染函数 renderOrderItem/renderOtherIncomeItem 等
- 大幅减少代码重复

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 09:53:48 +08:00
lizhilunandClaude Opus 4.6 a03e92d437 perf: 并行加载首页统计数据
将原来顺序执行的4个API调用改为并行执行(Promise.all),
显著减少首页加载时间。同时提取了渲染函数 renderWeeklyChart、
renderBossRankingPreview、renderPartnerRankingPreview,提高代码复用性。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 09:45:36 +08:00
lizhilunandClaude Opus 4.6 4656f3f9ca fix: 移除接单列表页面的自动滚动行为
移除了进入接单列表页面时自动滚动到今天的逻辑,避免界面
在加载后自动往上滚动的问题。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 09:37:49 +08:00
lizhilunandClaude Opus 4.6 a0d7bfdc3d Initial commit: gamer project
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 11:23:10 +08:00