更新功能

This commit is contained in:
2026-01-19 12:29:33 +08:00
parent f661373824
commit 7d9599b582
14 changed files with 522 additions and 225 deletions

View File

@@ -99,10 +99,11 @@ class BillService
'amount' => (float)$bill->amount,
'category' => $bill->category,
'category_id' => $this->getCategoryId($bill->category, $bill->type),
'payment_method' => $bill->payment_method,
'remark' => $bill->remark,
'date' => $bill->bill_date,
'bill_date' => $bill->bill_date,
'created_at' => $bill->created_at->format('Y-m-d H:i:s'),
'created_at' => $bill->created_at,
'user' => $bill->user,
'family' => $bill->family
];
@@ -162,6 +163,7 @@ class BillService
'type' => 'required|in:income,expense',
'amount' => 'required|numeric|min:0.01',
'category_id' => 'required|integer',
'payment_method' => 'nullable|string|in:微信,支付宝,银行卡,现金,其他',
'remark' => 'nullable|string|max:255',
'date' => 'required|date',
'family_id' => 'nullable|integer|exists:account_families,id'
@@ -241,6 +243,7 @@ class BillService
'type' => 'required|in:income,expense',
'amount' => 'required|numeric|min:0.01',
'category_id' => 'required|integer',
'payment_method' => 'nullable|string|in:微信,支付宝,银行卡,现金,其他',
'remark' => 'nullable|string|max:255',
'date' => 'required|date',
'family_id' => 'nullable|integer|exists:account_families,id'
@@ -303,19 +306,8 @@ class BillService
}
// 转换数据格式以匹配前端
return [
'id' => $bill->id,
'type' => $bill->type,
'amount' => (float)$bill->amount,
'category' => $bill->category,
'category_id' => $this->getCategoryId($bill->category, $bill->type),
'remark' => $bill->remark,
'date' => $bill->bill_date,
'bill_date' => $bill->bill_date,
'created_at' => $bill->created_at->format('Y-m-d H:i:s'),
'user' => $bill->user,
'family' => $bill->family
];
$bill->category_id = $this->getCategoryId($bill->category, $bill->type);
return $bill;
}
/**