diff --git a/server/handler/update_bill.go b/server/handler/update_bill.go index e78499b..689e647 100644 --- a/server/handler/update_bill.go +++ b/server/handler/update_bill.go @@ -47,7 +47,7 @@ func parseBillTime(s string) (time.Time, error) { return time.Time{}, fmt.Errorf("unsupported time format") } -// UpdateBill PATCH /api/bills/:id 更新清洗后的账单记录 +// UpdateBill POST /api/bills/:id 更新清洗后的账单记录 func UpdateBill(c *gin.Context) { id := strings.TrimSpace(c.Param("id")) if id == "" { diff --git a/server/router/router.go b/server/router/router.go index 8b206e6..7cf4a1f 100644 --- a/server/router/router.go +++ b/server/router/router.go @@ -60,7 +60,7 @@ func setupAPIRoutes(r *gin.Engine) { authed.GET("/bills", handler.ListBills) // 编辑账单 - authed.PATCH("/bills/:id", handler.UpdateBill) + authed.POST("/bills/:id", handler.UpdateBill) // 手动创建账单 authed.POST("/bills/manual", handler.CreateManualBills) diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index fea183f..dd7112a 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -258,7 +258,7 @@ export interface UpdateBillResponse { export async function updateBill(id: string, patch: UpdateBillRequest): Promise { const response = await apiFetch(`${API_BASE}/api/bills/${encodeURIComponent(id)}`, { - method: 'PATCH', + method: 'POST', headers: { 'Content-Type': 'application/json', },