feat: 支持京东白条账单上传和清洗

This commit is contained in:
CHE LIANG ZHAO
2026-01-26 13:44:22 +08:00
parent 7b2d6a9fbb
commit 3cf39b4664
17 changed files with 383 additions and 27 deletions

View File

@@ -18,7 +18,7 @@ type ListBillsRequest struct {
StartDate string `form:"start_date"` // 开始日期 YYYY-MM-DD
EndDate string `form:"end_date"` // 结束日期 YYYY-MM-DD
Category string `form:"category"` // 分类筛选
Type string `form:"type"` // 账单类型 alipay/wechat
Type string `form:"type"` // 账单类型 alipay/wechat/jd
IncomeExpense string `form:"income_expense"` // 收支类型 收入/支出
}

View File

@@ -145,6 +145,8 @@ func Upload(c *gin.Context) {
billType = "alipay"
} else if strings.Contains(fileName, "微信") || strings.Contains(fileName, "wechat") {
billType = "wechat"
} else if strings.Contains(fileName, "京东") || strings.Contains(fileName, "jd") {
billType = "jd"
}
}
if billType == "" {
@@ -152,15 +154,15 @@ func Upload(c *gin.Context) {
service.CleanupExtractedFiles(extractedFiles)
c.JSON(http.StatusBadRequest, model.UploadResponse{
Result: false,
Message: "无法识别账单类型,请指定 type 参数 (alipaywechat)",
Message: "无法识别账单类型,请指定 type 参数 (alipay/wechat/jd)",
})
return
}
if billType != "alipay" && billType != "wechat" {
if billType != "alipay" && billType != "wechat" && billType != "jd" {
service.CleanupExtractedFiles(extractedFiles)
c.JSON(http.StatusBadRequest, model.UploadResponse{
Result: false,
Message: "账单类型无效,仅支持 alipaywechat",
Message: "账单类型无效,仅支持 alipay/wechat/jd",
})
return
}