Appearance
功能模块
MengHub v1.0 包含五大核心模块,对应底部 5 个 Tab 导航。基于 Flutter 源码整理。
模块总览
| Tab | 模块 | 路由 | 标签 | 图标 |
|---|---|---|---|---|
| 1 | 消息 | /home/messages | 消息 | chat_bubble_outline |
| 2 | 秒圈 | /home/feed | 秒圈 | explore_outlined |
| 3 | 应用 | /home/apps | 应用 | apps_outlined |
| 4 | 客户 | /home/customers | 客户 | people_outline |
| 5 | 我的 | /home/profile | 我的 | person_outline |
认证流程
| 页面 | 文件 | 行数 | 说明 |
|---|---|---|---|
| Splash | splash_page.dart | 179 | 启动页 |
| Onboarding | onboarding_page.dart | 206 | 4 屏功能介绍(IM/社交/CRM/应用) |
| Login | login_page.dart | 423 | 手机号 + 验证码登录 |
路由守卫:_globalRedirect 检查 SecureStorageService.hasToken(),无 Token 跳转登录页。
消息模块(IM)
| 页面 | 文件 | 行数 | 说明 |
|---|---|---|---|
| 会话列表 | conversation_list_page.dart | 237 | Tab 1 主页面 |
| 聊天详情 | chat_page.dart | 390 | 单聊/群聊 |
| 新建会话 | new_chat_page.dart | 205 | 选择联系人 |
| 消息搜索 | search_page.dart | 185 | 搜索消息 |
数据模型
ConversationModel(conversation_model.dart):
| 字段 | 类型 | 说明 |
|---|---|---|
| id | String | 会话 ID |
| type | int | 类型(单聊/群聊) |
| name | String | 会话名称 |
| avatar | String | 头像 |
| lastMessage | String | 最后一条消息 |
| lastMessageTime | int | 最后消息时间戳 |
| unreadCount | int | 未读数 |
| isPinned | bool | 是否置顶 |
| isMuted | bool | 是否免打扰 |
MessageModel(message_model.dart):
| 字段 | 类型 | 说明 |
|---|---|---|
| id | String | 消息 ID |
| conversationId | String | 所属会话 |
| senderId | String | 发送者 |
| type | int | 类型(text/image/voice/video/file/location/card/system) |
| content | String | 消息内容 |
| seq | int | 序列号 |
| status | int | 状态(sending/sent/delivered/read/failed) |
| createdAt | int | 创建时间戳 |
| replyToId | String | 引用消息 ID |
| images | List | 图片列表 |
WebSocket 客户端
完整实现,位于 lib/core/network/ws_client.dart:
- 心跳间隔:30 秒
- Pong 超时:10 秒
- 自动重连:指数退避,最多 6 次
- SSL 证书固定(SHA-256 Pinning)
- 最大消息大小:64KB
API 端点
| 端点 | 说明 |
|---|---|
/im/conversations | 会话列表 |
/im/messages | 消息列表 |
/im/send | 发送消息 |
/im/read | 标记已读 |
/im/group/create | 创建群组 |
/im/group/members | 群成员管理 |
/im/group/settings | 群设置 |
秒圈模块(社交)
| 页面 | 文件 | 行数 | 说明 |
|---|---|---|---|
| 动态流 | feed_page.dart | 617 | Tab 2 主页面 |
| 发布动态 | post_create_page.dart | 497 | 图文发布 |
| 编辑动态 | post_edit_page.dart | 411 | 编辑已有 |
| 动态详情 | post_detail_page.dart | 279 | 评论/点赞 |
| 可见范围 | audience_select_page.dart | 262 | 公开/好友/私密 |
| 粉丝列表 | followers_page.dart | 67 | 我的粉丝 |
| 关注列表 | following_page.dart | 66 | 我的关注 |
| 好友请求 | friend_requests_page.dart | 91 | 好友申请 |
数据模型
PostModel(post_model.dart):
| 字段 | 类型 | 说明 |
|---|---|---|
| id | String | 动态 ID |
| userId | String | 作者 ID |
| userNickname | String | 作者昵称 |
| userAvatar | String | 作者头像 |
| content | String | 正文内容 |
| images | List<String> | 图片列表 |
| likeCount | int | 点赞数 |
| commentCount | int | 评论数 |
| isLiked | bool | 是否已赞 |
| isPinned | bool | 是否置顶 |
| visibility | int | 可见性(public/friendsOnly/private) |
| createdAt | int | 创建时间戳 |
API 端点
| 端点 | 说明 |
|---|---|
/social/feed | 动态流 |
/social/posts | 发布/获取动态 |
/social/posts/like | 点赞/取消 |
/social/posts/comments | 评论列表 |
/social/posts/comment | 发表评论 |
/relations/follow | 关注 |
/relations/unfollow | 取消关注 |
/relations/followers | 粉丝列表 |
/relations/following | 关注列表 |
/relations/requests | 好友请求 |
/relations/friends | 好友列表 |
/relations/blacklist | 黑名单 |
应用模块(H5 应用中心)
| 页面 | 文件 | 行数 | 说明 |
|---|---|---|---|
| 应用商店 | app_store_page.dart | 229 | Tab 3 主页面 |
数据模型
H5AppModel(h5_app_model.dart):
| 字段 | 类型 | 说明 |
|---|---|---|
| id | String | 应用 ID |
| name | String | 应用名称 |
| icon | String | 图标 |
| url | String | WebView URL |
| category | String | 分类 |
| sortOrder | int | 排序 |
| isEnabled | bool | 是否启用 |
URL 安全验证
所有 WebView URL 通过 UrlSafety.isValidWebViewUrl() 验证:
- 必须 HTTPS
- 禁止 localhost / 私有 IP
- 禁止
javascript:/file:/data:协议
API 端点
| 端点 | 说明 |
|---|---|
/apps/list | 应用列表 |
/apps/categories | 分类列表 |
客户模块(CRM)
| 页面 | 文件 | 行数 | 说明 |
|---|---|---|---|
| 客户列表 | customer_list_page.dart | 295 | Tab 4 主页面 |
| 客户详情 | customer_detail_page.dart | 323 | 客户信息 + 跟进 |
数据模型
CustomerModel(customer_model.dart):
| 字段 | 类型 | 说明 |
|---|---|---|
| id | String | 客户 ID |
| name | String | 姓名 |
| avatar | String | 头像 |
| phone | String | 电话 |
| stage | int | 阶段(线索/意向/成交/复购) |
| tags | List<String> | 标签 |
| lastFollowUp | int | 最后跟进时间 |
| notes | String | 备注 |
客户阶段:线索 → 意向 → 成交 → 复购
API 端点
| 端点 | 说明 |
|---|---|
/crm/customers | 客户列表 |
/crm/customers/detail | 客户详情 |
/crm/tags | 标签管理 |
/crm/follow-ups | 跟进记录 |
/crm/stage | 阶段变更 |
/crm/dashboard | CRM 仪表盘 |
个人中心 & 设置
| 页面 | 文件 | 行数 | 说明 |
|---|---|---|---|
| 我的 | my_profile_page.dart | 1037 | Tab 5 主页面(最大文件) |
| 编辑资料 | edit_profile_page.dart | 162 | 修改昵称/头像/简介 |
| 设置 | settings_page.dart | 177 | 系统设置 |
| 关于 | about_page.dart | 340 | 版本信息 + 检查更新 |
用户模型
UserModel(user_model.dart):
| 字段 | 类型 | 说明 |
|---|---|---|
| id | String | 用户 ID |
| nickname | String | 昵称 |
| avatar | String | 头像 |
| bio | String | 简介 |
| phone | String | 手机号 |
| followingCount | int | 关注数 |
| followerCount | int | 粉丝数 |
| likeCount | int | 获赞数 |
| customerCount | int | 客户数 |
本地数据库
使用 sqflite_sqlcipher 加密存储,数据库文件 menghub.db:
| 表名 | 主要字段 | 索引 |
|---|---|---|
| conversations | id, type, name, avatar, last_message, unread_count | — |
| messages | id, conversation_id, sender_id, type, content, seq, status | idx_messages_conv(conversation_id, seq) |
| users | id, nickname, avatar, bio, phone | — |
| posts | id, user_id, content, images, like_count, visibility | idx_posts_user(user_id, created_at) |
| customers | id, name, phone, stage, tags | idx_customers_stage(stage) |
| h5_apps | id, name, icon, url, category, sort_order | — |
安全层
| 组件 | 文件 | 功能 |
|---|---|---|
| ScreenProtectService | screen_protect_service.dart | 防截屏(Platform Channel) |
| DeviceSecurityService | device_security_service.dart | Root/越狱检测 |
| ClipboardService | clipboard_service.dart | 敏感数据 5 秒后自动清除剪贴板 |
| DeepLinkValidator | deep_link_validator.dart | 深度链接验证(防 SQL/脚本注入) |
| UrlSafety | url_safety.dart | URL 安全验证(禁止私有 IP/危险协议) |
| SSL Pinning | http_client.dart | SHA-256 证书固定 |
| Text Sanitizer | — | 剥离控制字符/零宽字符/BOM |
完整路由表(22 条)
| 路由 | 说明 |
|---|---|
/splash | 启动页 |
/onboarding | 功能介绍 |
/login | 登录 |
/home/messages | Tab 1 消息 |
/home/feed | Tab 2 秒圈 |
/home/apps | Tab 3 应用 |
/home/customers | Tab 4 客户 |
/home/profile | Tab 5 我的 |
/chat | 聊天详情 |
/new-chat | 新建会话 |
/post/create | 发布动态 |
/post/edit | 编辑动态 |
/post/detail/:id | 动态详情 |
/post/audience-select | 可见范围选择 |
/customer/detail/:id | 客户详情 |
/settings | 设置 |
/edit-profile | 编辑资料 |
/search | IM 搜索 |
/about | 关于 |
/followers | 粉丝列表 |
/following | 关注列表 |
/friend-requests | 好友请求 |
下一步
- 使用指南 — 环境配置与构建部署
- MengHub 概述 — 返回产品概述

