Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
R
rentos
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
accounting
rentos
Commits
3605eeba
Commit
3605eeba
authored
Oct 13, 2026
by
wenwen.tang
😕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs(memory): 第六轮 收款同步 + 只读访客 的工作日志
parent
a39ca9ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
2026-10-13.md
.workbuddy/memory/2026-10-13.md
+45
-0
No files found.
.workbuddy/memory/2026-10-13.md
View file @
3605eeba
...
...
@@ -137,3 +137,48 @@ env -u http_proxy -u https_proxy -u HTTP_PROXY -u HTTPS_PROXY git push origin ma
绕过沙箱后直连正常(302 / 3.1s)。以后本机 push 报 502 就是这个原因。
---
## 第六轮:收款日期 → 台账账期同步 + 只读访客账户(2026-10-13 11:30)
### 需求与口径(经 AskUserQuestion 拍板)
1. 批次详情登记「收款日期」→ 台账 `
AB 最近收款月份
` 同步更新。
**用户选定口径:取「收款日期所在月」**(如 2026-10-13 → `
2026-10
`),
*不是*账期止所在月。注意这会让 `
AB+1 == AC
` 这条历史自洽关系不再恒成立,
属用户明示选择,勿"纠正"。
2. 新增只读访客账号:**guest / guest@2026**(role=viewer)。
### 实现要点
- `
rentos/auth.py
` 重写:单账号 → `
auth.accounts
[
{username,salt,password_hash,role,note}
]
`
+ `
ROLE_ADMIN/ROLE_VIEWER
`;`
authenticate()
` 取代 `
verify()
` 语义(仍保留 `
verify
`);
`
normalize_role()
` 未知角色一律降级 viewer;`
guest_seeded
` 标记保证访客被删后不复活;
主账号(`
auth.username
`)不可删;会话写入 `
role
`,**老会话缺 role 按 admin**(当时只有管理员能登录)。
- `
rentos/server.py
`:`
_guard_
write()
` 在 `
_mutate
` 里做**写闸门** —— 除 `
/api/logout
` 外
所有 POST/PUT/DELETE 对 viewer 一律 403 `
{readonly:true}
`;新增账号管理接口
`
GET/POST /api/accounts
`、`
DELETE /api/accounts/{u}
`、`
POST /api/accounts/{u}/password
`(均管理员);
`
/api/session
`、`
/api/login
` 返回 `
role
` / `
can_write
`。
- `
rentos/service.py
`:新增 `
sync_receipt_month()
` / `
rollback_receipt_sync()
` /
`
_month_
of()
`;`
set_receipt()
` 改为返回 `
(batch, sync)
`;批次记 `
receipt_sync
`
`
[
{doc,row_id,from,to}
]
` 供清空/删除回退;同步时**同时改批次明细快照的 `
last_paid
`**。
删除批次时无条件回滚收款同步(与账期回滚并列)。
- 前端:`
ROLE
` + `
api()
` 拦截非 GET(除 logout);`
body.role-viewer
` + CSS
`
[
data-ro
]
{display:none}
` 隐藏全部写入口;收款日期/开票控件 `
disabled
`;
设置页新增「账号管理」卡(仅管理员,`
loadAccounts()
`);台账锁定条提示只读访客。
### 踩坑(重要)
- **`
service._d()
` 解析失败会回落「今天」**(出单容错用),拿它算"收款月份"会把
空收款日期当成当月 → 必须改用 `
rent_parser._d()
`(失败返回 None)。
这个 bug 让 3 个用例失败,是最隐蔽的一处。
- `
<details>
` 折叠时 `
innerText
` 取不到内容 → 验证脚本读 `
textContent
`。
### 验证
- 单测 **191 项全绿**(新增 `
tools/test_accounts.py
` 34 项:播种/角色/CRUD/会话/真 HTTP 写闸门)。
- 端到端 `
tools/ui_verify7.py
`(自带沙箱数据目录 + Playwright)**59/59 通过**:
访客 8 类写接口实测 403、详情/台账/名册可读、按钮全隐藏;
管理员登记收款 → 台账 AB 2026-11→2026-12、改日期跟着走、清空退回、删批次回滚。
- 真实 `
data/
` 零改动(台账 `
updated_at
` 仍为 11:04:15)。
### 待办
- 本机 8899 服务仍在跑旧代码,需重启才会播种 guest;线上 192.168.68.121 需
部署后才生效(`
python tools/deploy_git.py sync
`
)。
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment