Commit 9b731ea8 authored by wenwen.tang's avatar wenwen.tang 😕

fix(deploy): 线上登录失败时不再抛栈,明确提示密码可能已改

线上 admin 密码已被改过(auth.verify('admin','1989@rent05') 返回 False),
部署自检的「接口抽查」「企微状态抽查」两段会 401 抛一大段 traceback,
看上去像部署失败。改为捕获后打印「登录 : FAIL —— 线上 admin 密码可能已被改过」
并跳过后续 HTTP 抽查(容器内自测 / 宿主机 HTTP 200 / 6b 能力自检照常执行)。
不改动任何密码,仅调整自检脚本的报错呈现。

顺带记录:合同原件功能的线上验证走容器内模块调用(32 列、AL 列、合同目录可写、
写入回读删除全通),HTTP/UI 链路已在 runner 沙箱与 ui_verify12 覆盖。
parent 0b01156f
...@@ -60,14 +60,28 @@ ...@@ -60,14 +60,28 @@
- **修掉一个真 bug**:`renderGrid` 的 `files` 分支原先读台账原值 `raw`, - **修掉一个真 bug**:`renderGrid` 的 `files` 分支原先读台账原值 `raw`,
上传(暂存未保存)后格子仍显示「+ 合同」→ 改为优先读 `TB_PEND` 暂存值 上传(暂存未保存)后格子仍显示「+ 合同」→ 改为优先读 `TB_PEND` 暂存值
## 代码提交 ## 代码提交 / 部署
- 待提交:`rentos/contracts.py`(新) `rentos/config.py` `rentos/tables.py` `rentos/server.py` 提交分 5 层,推 origin/main(`12bc591 → 0b01156`,后又补一个工具提交):
`web/app.js` `web/admin.html` `web/style.css` `.gitignore` 1. `0981517` feat(contracts) 后端(contracts.py + config + tables + server)
`tools/test_contracts.py`(新) `tools/smoke_verify_contracts.py`(新) `tools/ui_verify12.py`(新) 2. `d6fd790` feat(web) 合同列按钮 + 管理浮层(app.js / admin.html / style.css)
`tools/import_contracts.py`(新) `tools/test_rules.py` `tools/ui_verify_runner.py` 3. `7a75747` feat(tools) import_contracts.py + .gitignore
`tools/ui_verify7/8/9/10/11.py` `tools/check_scheduler.py` 4. `bcbfeeb` test(contracts) 单测 20 + 冒烟 24 + UI 30 + 沙箱 CONTRACT_DIR
5. `0b01156` docs(memory) 加章节并精简 MEMORY.md(17.6KB → 13.6KB)
部署 `deploy_git.py sync` rc=0;容器内 6b 自检:**台账 85 行 × 32 列**、字体 OK、企微 CLI OK。
**线上模块级验证**:`load_table` 末两列 = `AJ(date)` + `AL(合同原件, files)`;
`CONTRACT_DIR=/app/data/contracts` 存在可写;试写一份 → 回读字节一致 → `describe` 正常 → 删除(自检后清零)。
⚠️ **发现:线上 admin 密码已不是 `1989@rent05`**
- 线上 `config.json` 的 `auth.salt = 38b2bac42cc67120`(本机是 `rentos-2026`),
`auth.verify('admin','1989@rent05')` → **False**;10-14 部署时还是 OK 的 → 之后被改过
- 影响:`deploy_docker.verify` 的「接口抽查 + 企微状态抽查」两段会 401 抛 traceback,
看着像部署失败 → **已改成登录失败时打印明确提示并跳过**(不再抛栈;未改任何密码)
- HTTP 层功能验证改用「容器内直接调模块」完成;完整 HTTP/UI 链路已在沙箱(runner / ui_verify12)跑过
## 待办 ## 待办
- **29 份合同要不要真导入**(本地 / 线上)——工具已就绪,干跑零误判,等巴特菲发话 - **29 份合同要不要真导入**(本地 / 线上)——工具已就绪,干跑零误判,等巴特菲发话
(线上导入还需把文件传到服务器 + 在容器内跑 `import_contracts.py --apply`)
- 线上 admin 密码当前值(问巴特菲;拿到后可恢复 HTTP 层自动抽查)
- 9 月电费批次错计(10 行 ¥167,947.41 / 少计 601B ¥299.67 / 出租方错记精锐)仍未处置 - 9 月电费批次错计(10 行 ¥167,947.41 / 少计 601B ¥299.67 / 出租方错记精锐)仍未处置
- `ui_verify11` 里「保存修改」按钮的断言需同步改写(10-14 删了该按钮) - `ui_verify11` 里「保存修改」按钮的断言需同步改写(10-14 删了该按钮)
...@@ -257,22 +257,30 @@ def verify(cli): ...@@ -257,22 +257,30 @@ def verify(cli):
"B='http://127.0.0.1:" + p + "'\n" "B='http://127.0.0.1:" + p + "'\n"
"def get(pa,H=None):\n" "def get(pa,H=None):\n"
" return json.load(u.urlopen(u.Request(B+pa,headers=H or {})))\n" " return json.load(u.urlopen(u.Request(B+pa,headers=H or {})))\n"
"r=u.urlopen(u.Request(B+'/api/login'," "tok=''\n"
"try:\n"
" r=u.urlopen(u.Request(B+'/api/login',"
"json.dumps({'username':'admin','password':'1989@rent05'}).encode()," "json.dumps({'username':'admin','password':'1989@rent05'}).encode(),"
"{'Content-Type':'application/json'}))\n" "{'Content-Type':'application/json'}))\n"
"tok=json.load(r).get('token','')\n" " tok=json.load(r).get('token','')\n"
"print(' 登录 :', 'OK' if tok else 'FAIL')\n" "except Exception as e:\n"
"H={'Authorization':'Bearer '+tok}\n" " print(' 登录失败:', e)\n"
"for t in get('/api/tables',H).get('tables') or []:\n" "if not tok:\n"
" print(' 台账', t.get('key'), '行=', t.get('row_count')," " print(' 登录 : FAIL —— 线上 admin 密码可能已被改过,请用当前密码自行抽查;'\n"
" '后端本身是好的(容器内自测与宿主机 HTTP 200 见上)')\n"
"else:\n"
" print(' 登录 : OK')\n"
" H={'Authorization':'Bearer '+tok}\n"
" for t in get('/api/tables',H).get('tables') or []:\n"
" print(' 台账', t.get('key'), '行=', t.get('row_count'),"
" '列=', t.get('col_count'), '就绪=', t.get('ready'))\n" " '列=', t.get('col_count'), '就绪=', t.get('ready'))\n"
"o=get('/api/overview',H)\n" " o=get('/api/overview',H)\n"
"print(' 概览 : 批次=', o.get('batch_count'), '单据=', o.get('document_count')," " print(' 概览 : 批次=', o.get('batch_count'), '单据=', o.get('document_count'),"
" '已发=', o.get('sent_count'), '待发=', o.get('pending_count'))\n" " '已发=', o.get('sent_count'), '待发=', o.get('pending_count'))\n"
"un=get('/api/units',H)\n" " un=get('/api/units',H)\n"
"print(' 单元 : 房间=', len(un.get('rooms') or []), '(排车位) 全部='," " print(' 单元 : 房间=', len(un.get('rooms') or []), '(排车位) 全部=',"
" len(un.get('units') or []))\n" " len(un.get('units') or []))\n"
"print(' 名册 : 公司=', len(un.get('companies') or []), '出租方='," " print(' 名册 : 公司=', len(un.get('companies') or []), '出租方=',"
" len(un.get('owners') or []))\n" " len(un.get('owners') or []))\n"
) )
run(cli, "docker exec %s python -c %s" % (CONTAINER, _q(py))) run(cli, "docker exec %s python -c %s" % (CONTAINER, _q(py)))
...@@ -283,17 +291,22 @@ def verify(cli): ...@@ -283,17 +291,22 @@ def verify(cli):
py_w = ( py_w = (
"import json,urllib.request as u\n" "import json,urllib.request as u\n"
"B='http://127.0.0.1:" + p + "'\n" "B='http://127.0.0.1:" + p + "'\n"
"d=u.urlopen(u.Request(B+'/api/login',json.dumps(" "tok=''\n"
"try:\n"
" d=u.urlopen(u.Request(B+'/api/login',json.dumps("
"{'username':'admin','password':'1989@rent05'}).encode()," "{'username':'admin','password':'1989@rent05'}).encode(),"
"{'Content-Type':'application/json'}))\n" "{'Content-Type':'application/json'}))\n"
"tok=json.load(d).get('token','')\n" " tok=json.load(d).get('token','')\n"
"H={'Authorization':'Bearer '+tok}\n" "except Exception as e:\n"
"for ep in ('/api/wecom/status','/api/scheduler'):\n" " print(' (登录失败,跳过企微状态接口抽查:%s)' % e)\n"
" try:\n" "if tok:\n"
" w=json.load(u.urlopen(u.Request(B+ep,headers=H)))\n" " H={'Authorization':'Bearer '+tok}\n"
" print(' %-20s -> %s' % (ep, json.dumps(w,ensure_ascii=False)[:300]))\n" " for ep in ('/api/wecom/status','/api/scheduler'):\n"
" except Exception as e:\n" " try:\n"
" print(' %-20s -> 失败 %s' % (ep, e))\n" " w=json.load(u.urlopen(u.Request(B+ep,headers=H)))\n"
" print(' %-20s -> %s' % (ep, json.dumps(w,ensure_ascii=False)[:300]))\n"
" except Exception as e:\n"
" print(' %-20s -> 失败 %s' % (ep, e))\n"
) )
run(cli, "docker exec %s python -c %s" % (CONTAINER, _q(py_w))) run(cli, "docker exec %s python -c %s" % (CONTAINER, _q(py_w)))
log("") log("")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment