wip: 2026-08-11 工作树快照(docs/memory/h5.py/scripts 等 447 项未评审改动,安全提交到 feat 分支)

This commit is contained in:
Simon
2026-08-11 09:59:44 +08:00
parent 6be361fb63
commit f2fd4fa012
447 changed files with 273482 additions and 1386 deletions
+18
View File
@@ -0,0 +1,18 @@
import sys
sys.path.insert(0, "/app")
from app.database import Base as DB_Base
import app.models
from app.models.base import Base as Model_Base
from app.models import RecommendProgress, EmployeeProfileCache
print("DB_Base.metadata is Model_Base.metadata:", DB_Base.metadata is Model_Base.metadata)
print("DB_Base:", DB_Base)
print("Model_Base:", Model_Base)
print("Total tables in DB_Base.metadata:", len(DB_Base.metadata.tables))
print("RecommendProgress table:", DB_Base.metadata.tables.get("recommend_progress"))
print("EmployeeProfileCache table:", DB_Base.metadata.tables.get("employee_profile_cache"))
# 列出所有 recommend / employee_profile 表
for name in sorted(DB_Base.metadata.tables.keys()):
if "recommend" in name or "employee_profile" in name:
print("FOUND:", name)
+52
View File
@@ -0,0 +1,52 @@
# 早班巡检 - 服务器检查批处理 (2026-07-29)
# 注:此文件将被上传到 /tmp 并通过 batch 子命令执行
# === 2.1 Docker 容器状态 ===
echo "=== [1/8] docker ps -a ==="
docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
echo ""
echo "=== [2/8] 健康异常的容器 ==="
docker ps -a --filter 'status=exited' --format '{{.Names}} {{.Status}}'
docker ps -a --filter 'status=restarting' --format '{{.Names}} {{.Status}}'
# === 2.2 后端 API 健康 ===
echo ""
echo "=== [3/8] backend health ==="
docker ps --filter 'name=wecom_it_backend' --format '{{.Names}} {{.Status}}'
curl -sS -o /tmp/health_out.txt -w 'HTTP %{http_code} | %{time_total}s\n' http://127.0.0.1:8000/health
cat /tmp/health_out.txt 2>/dev/null | head -20
# === 2.3 数据库与缓存 ===
echo ""
echo "=== [4/8] PostgreSQL ==="
docker exec -i wecom_it_postgres pg_isready -U postgres
docker exec -i wecom_it_postgres psql -U postgres -d wecom_it_desk -c 'select version();' 2>&1 | head -5
echo ""
echo "=== [5/8] Redis ==="
docker exec -i wecom_it_redis redis-cli -a $(cat /run/secrets/redis_pw 2>/dev/null) ping 2>/dev/null || docker exec -i wecom_it_redis redis-cli ping
# === 2.4 资源使用 ===
echo ""
echo "=== [6/8] 磁盘 ==="
df -h | grep -v tmpfs | head -20
echo ""
echo "=== [7/8] 内存 ==="
free -h
echo ""
echo "=== [8/8] 日志大小 ==="
du -sh /opt/wecom-it-desk/logs/* 2>/dev/null | sort -h | tail -20
# === 2.5 Nginx 状态 ===
echo ""
echo "=== [Nginx] 容器与首页 ==="
docker ps --filter 'name=wecom_it_nginx' --format '{{.Names}} {{.Status}}'
curl -sS -o /dev/null -w '员工端 / HTTP %{http_code}\n' http://127.0.0.1/
curl -sS -o /dev/null -w '管理端 /itadmin/ HTTP %{http_code}\n' http://127.0.0.1/itadmin/
curl -sS -o /dev/null -w '坐席端 /agent/ HTTP %{http_code}\n' http://127.0.0.1/agent/
echo ""
echo "=== [end] ==="
+42
View File
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
"""QA: count target emoji in dist assets"""
import sys
FILES = [
r"D:\资料\03-项目开发\wecom_it_smart_desk\src\frontend-agent\dist\assets\index-C9eNZBP_.js",
r"D:\资料\03-项目开发\wecom_it_smart_desk\src\frontend-agent\dist\assets\Workspace-C-lLbDyz.js",
r"D:\资料\03-项目开发\wecom_it_smart_desk\src\frontend-agent\dist\assets\index-DAn-Mowv.css",
]
EMOJIS = ["💡", "🎚️", "🖌️", "🔄", "", "🎭", "✏️"]
def main():
totals = {e: 0 for e in EMOJIS}
per_file = {}
for f in FILES:
try:
with open(f, encoding="utf-8") as fh:
data = fh.read()
except Exception as ex:
print("ERR", f, ex)
continue
per_file[f] = {}
for e in EMOJIS:
c = data.count(e)
per_file[f][e] = c
totals[e] += c
print("FILE:", f.split("assets")[-1], "chars:", len(data))
print(" ", {e: per_file[f][e] for e in EMOJIS})
print("TOTAL:", totals)
# assert engineer claims
assert totals["💡"] == 4, f"💡 expected 4 got {totals['💡']}"
assert totals["🎚️"] == 1, f"🎚️ expected 1 got {totals['🎚️']}"
assert totals["🖌️"] == 2, f"🖌️ expected 2 got {totals['🖌️']}"
assert totals["🔄"] == 7, f"🔄 expected 7 got {totals['🔄']}"
assert totals[""] == 0, f"✨ expected 0 got {totals['']}"
assert totals["🎭"] == 0, f"🎭 expected 0 got {totals['🎭']}"
assert totals["✏️"] == 1, f"✏️ expected 1 got {totals['✏️']}"
print("ALL EMOJI ASSERTIONS PASSED")
if __name__ == "__main__":
main()
+42
View File
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
"""QA: count target emoji across entire dist directory"""
import os
DIST = r"D:\资料\03-项目开发\wecom_it_smart_desk\src\frontend-agent\dist"
EMOJIS = ["💡", "🎚️", "🖌️", "🔄", "", "🎭", "✏️"]
def main():
totals = {e: 0 for e in EMOJIS}
per_file = {}
nfiles = 0
for root, dirs, files in os.walk(DIST):
for fn in sorted(files):
fp = os.path.join(root, fn)
try:
with open(fp, encoding="utf-8") as fh:
data = fh.read()
except Exception as ex:
print("ERR", fp, ex)
continue
nfiles += 1
per_file[fn] = {}
for e in EMOJIS:
c = data.count(e)
per_file[fn][e] = c
totals[e] += c
print("FILES SCANNED:", nfiles)
for fn, d in per_file.items():
if any(v > 0 for v in d.values()):
print(fn, {e: d[e] for e in EMOJIS if d[e] > 0})
print("TOTAL:", totals)
assert totals["💡"] == 4, f"💡 expected 4 got {totals['💡']}"
assert totals["🎚️"] == 1, f"🎚️ expected 1 got {totals['🎚️']}"
assert totals["🖌️"] == 2, f"🖌️ expected 2 got {totals['🖌️']}"
assert totals["🔄"] == 7, f"🔄 expected 7 got {totals['🔄']}"
assert totals[""] == 0, f"✨ expected 0 got {totals['']}"
assert totals["🎭"] == 0, f"🎭 expected 0 got {totals['🎭']}"
assert totals["✏️"] == 1, f"✏️ expected 1 got {totals['✏️']}"
print("ALL EMOJI ASSERTIONS PASSED")
if __name__ == "__main__":
main()
+34
View File
@@ -0,0 +1,34 @@
import os, io
base = r"D:\资料\03-项目开发\wecom_it_smart_desk\docs"
files = [
os.path.join(base, "01-产品文档/04-坐席工作台/PRD-REQ-坐席-007-排查模板系统-v1.0.md"),
os.path.join(base, "01-产品文档/04-坐席工作台/原型-REQ-坐席-007-排查模板系统-v1.0.html"),
os.path.join(base, "02-技术文档/技术架构/技术方案-REQ-坐席-007-排查模板系统-v1.0.md"),
os.path.join(base, "03-测试文档/03-功能测试用例/TC-坐席-007-排查模板系统.md"),
]
# 有序替换:先长串后短串,避免 排查模板系统 被 排查模板 误伤
content_repls = [
("排查模板系统", "分诊排查系统"),
("排查模板管理", "分诊排查管理"),
("分诊模板", "分诊"),
("排查模板", "排查"),
]
for f in files:
with io.open(f, "r", encoding="utf-8") as fh:
txt = fh.read()
counts = []
for old, new in content_repls:
c = txt.count(old)
if c:
txt = txt.replace(old, new)
counts.append(f"{old}->{new}:{c}")
with io.open(f, "w", encoding="utf-8") as fh:
fh.write(txt)
newname = f.replace("排查模板", "分诊排查")
renamed = " (renamed)" if newname != f else ""
if newname != f:
os.rename(f, newname)
print(os.path.basename(newname), "|", "; ".join(counts), renamed)
+13
View File
@@ -0,0 +1,13 @@
const ts = require('typescript');
const fs = require('fs');
const path = process.argv[2];
try {
const src = fs.readFileSync(path, 'utf-8');
const sourceFile = ts.createSourceFile(path, src, ts.ScriptTarget.Latest, true);
// 检查顶层语句数量判断是否能 parse
const stmtCount = sourceFile.statements ? sourceFile.statements.length : 0;
console.log('[OK]', path.split(/[\\/]/).pop(), ':', stmtCount, 'top-level statements');
} catch (e) {
console.log('[FAIL]', e.message);
}