Files
MobileModels/web

Web UI

Start

From repository root:

docker compose up --build -d

Optional environment setup:

cp .env.example .env

Stop:

docker compose down

Reset both MySQL and managed raw/index data:

docker compose down -v

Open:

整个功能栈统一运行在 Docker Compose 中,不再依赖本地 Python 或本地 MySQL 直接启动。

容器启动时会自动完成:

  • 构建 dist/device_index.json
  • 导出 MySQL seed 文件
  • 加载 MySQL schema 与 seed 数据
  • 启动 Web 页面与 API 服务

容器内还会同时启动 MySQL

  • 127.0.0.1:3306
  • database: mobilemodels
  • reader user: mobilemodels_reader

页面顶部有导航条(Gitea 风格):

  • 设备查询
  • 数据管理

设备查询页顶部额外提供三个页内 tab:

  • 索引查询
  • SQL 查询
  • 相关文档

设备查询

客户端上报模式

字段按你给的上报方式输入:

  • Android
    • platform=android
    • model_raw=Build.MODEL(例如 SM-G9980
  • iOS
    • platform=ios
    • model_raw=utsname.machine(例如 iPhone14,2
  • HarmonyOS
    • platform=harmony
    • model_raw(例如 NOH-AL00

说明:

  • Android / iOS / HarmonyOS 都直接使用客户端原始上报的 model_raw
  • 页面会输出完整候选列表,并附带 report_payload 方便核对上报值。

SQL 查询模式

  • 直接调用 Compose 内的 API 查询 MySQL 主表 mobilemodels.mm_device_catalog
  • 服务端会先把输入归一化成 alias_norm
  • 页面会显示实际执行的 SQL、结果列表和返回 JSON

相关文档

  • 页面内统一展示主推 SQL、兼容 SQL、归一化规则和文档入口
  • 可直接跳转查看 misc/mysql-query-design.mdweb/README.mdREADME.md

Output

设备查询页会返回:

  • best candidate
  • complete ranked candidates
  • normalized brand + parent manufacturer
  • source rank/weight (from source order config)
  • matched inputs
  • matched normalized keys
  • source markdown file and section
  • full JSON output for direct integration or debugging

Data management

数据管理页支持:

  • Independent maintenance:
    • Brand list is maintained independently in the UI and initialized from index data on first load.
    • Changes are stored in browser localStorage.
  • Alias normalization (brand only):
    • 华为 / huawei / HUAWEI are normalized to brand HUAWEI.
  • Brand-manufacturer relations:
    • One brand has exactly one parent manufacturer.
    • One manufacturer can contain multiple brands.
    • Examples:
      • Xiaomi manufacturer includes brands Xiaomi, Redmi, POCO.
      • vivo manufacturer includes brands vivo, iQOO.
      • OPPO manufacturer includes brands OPPO, OnePlus, realme.
  • Click 品牌数 / 厂商数 to open full list popup.
  • 编辑品牌列表: popup edit.
  • 编辑品牌-厂商关系: popup edit.
  • 编辑品牌同义词: popup edit.
  • 数据来源管理(新增):
    • Supports drag-and-drop source ordering.
    • Ranking weight is higher for sources at the top.
    • Initial order puts *_cn.md before non-cn sources.
  • 原始数据同步(新增):
    • Available in the third left tab.
    • Calls the Compose service API to sync upstream KHwang9883/MobileModels raw markdown, rebuild dist/device_index.json, export MySQL seed, and reload MySQL.
    • Requires docker compose up --build -d.
  • 索引数据(新增):
    • Available in the fourth left tab.
    • Includes index reload and index load status.

Notes

  • Managed raw data, rebuilt index, and MySQL seed files are persisted in Docker volumes, not written back to the local workspace during runtime.
  • For production, override MYSQL_ROOT_PASSWORD and MYSQL_READER_PASSWORD with your own values.