From e44f37e902131320ae23fd09a3fe79410c09323c Mon Sep 17 00:00:00 2001 From: laoyang Date: Wed, 28 Oct 2026 21:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=8A=98=E7=BA=BF=EF=BC=9A?= =?UTF-8?q?=E8=A1=A5=20/ledger//timeline=20API=20=E7=AB=AF=E7=82=B9=20?= =?UTF-8?q?#24?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户原话(2026-10-28):「鸿蒙端对齐网页端」。财务概览卡「净资产变化」在 端上是空占位,数据源 Web 端早有(Ledger::timeline + ledger/total_chart), 只缺一个 API 给端上。 · GET /api/v1/ledger//timeline —— 返回时序点数组(date/net/asset/debt) 加当前汇总。与 Web 端 total_chart 用**同一份 Ledger::timeline($id)**, 两端曲线必然一致。 判据:_i24_timeline_api.py 8/0(2xx · items 数组 · 每点 net=asset-debt · 有数据源),_i24_falsify.py 注掉 timeline → ④ 变红。 --- app/ApiHandler.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/ApiHandler.php b/app/ApiHandler.php index 21ee04d..a4cfe45 100644 --- a/app/ApiHandler.php +++ b/app/ApiHandler.php @@ -2545,6 +2545,21 @@ final class ApiHandler Api::ok(['deleted' => $eid]); } } + /* 🔴 工单 #24(用户 2026-10-28「鸿蒙端对齐网页端」):财务折线图。 + 端上「净资产变化(盘点成线)」原来是个空占位;数据源 Web 端早就有 + (`Ledger::timeline` + `ledger/total_chart`),只是没 API 给端上。 + 这里补 `GET /api/v1/ledger//timeline`,把时序点吐给端上自己画。 + ⚠️ 与 Web 端 total_chart 同一份 `Ledger::timeline($id)` —— + 两端曲线必然一致,不会"App 说涨、网页说跌"。 */ + if ($sub === 'timeline') { + if ($method === 'GET') { + Api::ok([ + 'items' => Ledger::timeline($id), + 'summary' => Ledger::summary(Ledger::entries($id)), + ]); + } + Api::fail('不支持的方法。', 'method_not_allowed', 405); + } /* 🔴 v68:共享给谁(端上"财务 → 设置 → 共享给谁"原来是个灰条)。 `Ledger::setShare/unshare/shares` 早就在模型里,只是没有路由。 ⚠️ 只有**账本主人**能改共享关系:拿到 write 权限的被共享者