12451 999885c38f feat(protocol): TCP v1.1 协议对齐 + 平台侧兜底 + 生产部署修复
协议(唯一权威文档:docs/柜控板固件对接文档.md)
- 应答必带 act(与请求一致)、msg_id 与请求一致;判"应答 vs 指令"只看有没有 suc
- dev_id 只在 auth_str/login 携带;其余报文用内部字段 _dev_id 路由(下发前由 device-server 摘除)
- id 只表示动作目标(柜级省略 / 一段=单板 / 两段=仓体级),不再含 IMEI
- msg_id 每连接从 1 起自增;60 秒交互超时;status_post 每通道 18 字符 hex 全量上报
- 未登录连接 30 秒内未 login 即断开;未登录只放行 auth_str/login

平台侧实现
- 上行解析按新结构重写(cabinet/boards/battery),删除废弃的 status/parsed_status
- 订单:唯一入口 = on;bat_in 只登记电池台账;4 条结束路径统一走 finalize_order(含充电记录落库)
- 新增设备日志保留策略(90 天,分批删除);未登记 IMEI 静默丢弃;停电标记按 status1 bit0 恢复清除
- 待确认第 13 项兜底:平台侧按 电压 × 电流 × 时间 积分计算订单电量(workers/energy.rs)
- 待确认第 18 项兜底:status_post bit7 连续 2 次无电池 → 判定电池被拔走并提前结单

修复(均为部署后才暴露的问题)
- 队列消费禁用 BRPOP:无限阻塞会因代理掐连接永久卡死(零错误日志);有限超时也只是
  "超时才醒",下行指令延迟 15~45 秒 → 改为 RPOP 非阻塞轮询,延迟降到 0.1~0.2 秒
- sync_iccid 把可空列 iccid 按 Option<String> 解码 → 整条 login 失败(ICCID 未上报的新柜子永远登录不上)
- 迁移读 information_schema.COLUMN_COMMENT 需 CAST(... AS CHAR)(MySQL 8 驱动报 VARBINARY,否则迁移 panic)
- 部署注意事项:.env 不支持行内注释;pscp 上传需 chmod +x;运行中二进制需 .new + mv 原子替换

部署
- 生产迁到 API 9000 / TCP 9001(systemd 单元补 EnvironmentFile、nginx 同步指向)
- 新增 deploy/deploy-prod.ps1(本地一键:构建→校验→备份→原子替换→重启→验收→无副作用探测)
- 废弃 deploy-prod.sh / deploy-test.sh(原脚本会在 target/release 找产物、装重复 systemd 单元、
  并用本地 .env 覆盖线上 .env)

质量
- 单测:api-server 39 个 / device-server 13 个(含协议示例逐值断言、跨模块 Redis key 契约)
- 两服务 cargo check 零错误零告警;web tsc --noEmit 通过
- test/tcp_e2e_smoke.py 端到端联调 13/13 通过
2026-09-19 23:41:09 +08:00

205 lines
5.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>艾动智能 — 智能充电柜矩阵系统</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
height: 100%;
overflow: hidden;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
color: #1A1C20;
}
a { color: inherit; text-decoration: none; }
/* ===== 整体布局:上中下三块 ===== */
.layout {
display: flex;
flex-direction: column;
height: 100vh;
}
/* ===== TOP: 顶部导航 ===== */
.top {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 48px;
z-index: 10;
}
.top-brand { display: flex; align-items: center; gap: 8px; }
.logo {
height: 48px;
width: auto;
display: block;
}
.top-name { font-size: 24px; font-weight: 800; color: #1A1C20; letter-spacing: 0.02em; }
.top-links { display: flex; gap: 8px; }
.top-link {
font-size: 13px; font-weight: 500;
color: #4A5060;
padding: 7px 16px;
border-radius: 8px;
transition: all 0.2s;
}
.top-link:hover { background: rgba(37,99,235,0.07); color: #2563EB; }
.top-link--cta { background: #1A1C20; color: #fff; }
.top-link--cta:hover { background: #2D3038; color: #fff; }
/* ===== MID: 中部背景图,填满 ===== */
.mid {
flex: 1;
min-height: 0;
background: url("hero-bg.png") no-repeat right center;
background-size: 100% 100%;
display: flex;
align-items: center;
padding: 0 80px;
}
/* ===== COPY: 文字区域 ===== */
.copy {
max-width: 580px;
display: flex;
flex-direction: column;
gap: 22px;
}
.tag {
display: inline-flex; align-items: center; gap: 7px;
padding: 5px 14px;
border: 1px solid rgba(37,99,235,0.25);
border-radius: 100px;
font-size: 13px; font-weight: 600;
color: #2563EB;
width: fit-content;
}
.tag .dot {
width: 6px; height: 6px;
background: #2563EB;
border-radius: 50%;
}
h1 {
font-size: clamp(40px, 4.5vw, 60px);
font-weight: 900;
line-height: 1.15;
letter-spacing: -0.02em;
color: #1A1C20;
}
h1 .accent { color: #2563EB; }
.subhead {
font-size: clamp(15px, 1.3vw, 18px);
font-weight: 300;
color: #4A5060;
line-height: 1.75;
max-width: 480px;
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
padding: 5px 12px;
border: 1px solid rgba(0,0,0,0.08);
border-radius: 100px;
font-size: 13px; font-weight: 500;
color: #4A5060;
}
.ctas { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.btn {
display: inline-flex; align-items: center; gap: 8px;
padding: 13px 28px;
font-size: 15px; font-weight: 600;
border-radius: 10px;
transition: all 0.2s;
}
.btn-primary {
background: #1A1C20; color: #fff;
box-shadow: 0 4px 24px rgba(26,28,32,0.10);
}
.btn-primary:hover { background: #2D3038; transform: translateY(-2px); }
.btn-ghost {
color: #4A5060;
border: 1.5px solid rgba(0,0,0,0.12);
}
.btn-ghost:hover { border-color: #8B92A5; color: #1A1C20; }
.stats {
display: flex; gap: 32px;
padding-top: 14px;
border-top: 1px solid rgba(0,0,0,0.08);
margin-top: 4px;
}
.stat-num { font-size: 28px; font-weight: 700; color: #1A1C20; line-height: 1.2; }
.stat-label { font-size: 12px; font-weight: 500; color: #8B92A5; margin-top: 2px; }
/* ===== BOT: 底部 ICP ===== */
.bot {
flex-shrink: 0;
text-align: center;
padding: 14px;
font-size: 12px;
color: #6B7280;
z-index: 10;
}
.bot a { color: #2563EB; }
.bot a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="layout">
<!-- 上:顶部导航 -->
<div class="top">
<div class="top-brand">
<img class="logo" src="logo-1.png" alt="艾动智能">
<span class="top-name">艾动智能</span>
</div>
<div class="top-links">
<a href="/doc/" class="top-link">开发文档</a>
<a href="/pms/" class="top-link top-link--cta">管理后台</a>
</div>
</div>
<!-- 中:背景图填满 -->
<div class="mid">
<div class="copy">
<div class="tag"><span class="dot"></span>智能充电矩阵系统</div>
<h1>为换电场景打造的<br><span class="accent">下一代智能充电</span></h1>
<p class="subhead">36仓独立直流快充,4G远程实时管控,多重安全防护体系。从硬件到云端,全栈自研的智能充电解决方案。</p>
<div class="pills">
<span class="pill">36仓独立</span>
<span class="pill">多重防护</span>
<span class="pill">4G在线</span>
<span class="pill">BMS适配</span>
</div>
<div class="stats">
<div><div class="stat-num">36</div><div class="stat-label">独立仓体</div></div>
<div><div class="stat-num">&lt;0.5s</div><div class="stat-label">指令响应</div></div>
<div><div class="stat-num">8000h</div><div class="stat-label">MTBF</div></div>
<div><div class="stat-num">99%</div><div class="stat-label">可用率</div></div>
</div>
</div>
</div>
<!-- 下:底部 ICP -->
<div class="bot">
© 2026 艾动智能 · <a href="https://beian.miit.gov.cn/" target="_blank">苏ICP备2025198376号-1</a>
</div>
</div>
</body>
</html>