fix: 修复微信账单金额解析问题(半角¥符号支持)
- 修复 parse_amount 函数同时支持全角¥和半角¥ - 新增 MonthRangePicker 日期选择组件 - 新增 /api/monthly-stats 接口获取月度统计 - 分析页面月度趋势使用全量数据 - 新增健康检查路由
This commit is contained in:
@@ -165,3 +165,36 @@ func parsePageParam(s string, defaultVal int) int {
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
// MonthlyStatsResponse 月度统计响应
|
||||
type MonthlyStatsResponse struct {
|
||||
Result bool `json:"result"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Data []model.MonthlyStat `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
// MonthlyStats 获取月度统计数据(全部数据,不受筛选条件影响)
|
||||
func MonthlyStats(c *gin.Context) {
|
||||
repo := repository.GetRepository()
|
||||
if repo == nil {
|
||||
c.JSON(http.StatusInternalServerError, MonthlyStatsResponse{
|
||||
Result: false,
|
||||
Message: "数据库未连接",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
stats, err := repo.GetMonthlyStats()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, MonthlyStatsResponse{
|
||||
Result: false,
|
||||
Message: "查询失败: " + err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, MonthlyStatsResponse{
|
||||
Result: true,
|
||||
Data: stats,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user