Skip to content

功能模块 ​

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

认证流程 ​

页面文件行数说明
Splashsplash_page.dart179启动页
Onboardingonboarding_page.dart2064 屏功能介绍(IM/社交/CRM/应用)
Loginlogin_page.dart423手机号 + 验证码登录

路由守卫:_globalRedirect 检查 SecureStorageService.hasToken(),无 Token 跳转登录页。

消息模块(IM) ​

页面文件行数说明
会话列表conversation_list_page.dart237Tab 1 主页面
聊天详情chat_page.dart390单聊/群聊
新建会话new_chat_page.dart205选择联系人
消息搜索search_page.dart185搜索消息

数据模型 ​

ConversationModel(conversation_model.dart):

字段类型说明
idString会话 ID
typeint类型(单聊/群聊)
nameString会话名称
avatarString头像
lastMessageString最后一条消息
lastMessageTimeint最后消息时间戳
unreadCountint未读数
isPinnedbool是否置顶
isMutedbool是否免打扰

MessageModel(message_model.dart):

字段类型说明
idString消息 ID
conversationIdString所属会话
senderIdString发送者
typeint类型(text/image/voice/video/file/location/card/system)
contentString消息内容
seqint序列号
statusint状态(sending/sent/delivered/read/failed)
createdAtint创建时间戳
replyToIdString引用消息 ID
imagesList图片列表

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.dart617Tab 2 主页面
发布动态post_create_page.dart497图文发布
编辑动态post_edit_page.dart411编辑已有
动态详情post_detail_page.dart279评论/点赞
可见范围audience_select_page.dart262公开/好友/私密
粉丝列表followers_page.dart67我的粉丝
关注列表following_page.dart66我的关注
好友请求friend_requests_page.dart91好友申请

数据模型 ​

PostModel(post_model.dart):

字段类型说明
idString动态 ID
userIdString作者 ID
userNicknameString作者昵称
userAvatarString作者头像
contentString正文内容
imagesList<String>图片列表
likeCountint点赞数
commentCountint评论数
isLikedbool是否已赞
isPinnedbool是否置顶
visibilityint可见性(public/friendsOnly/private)
createdAtint创建时间戳

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.dart229Tab 3 主页面

数据模型 ​

H5AppModel(h5_app_model.dart):

字段类型说明
idString应用 ID
nameString应用名称
iconString图标
urlStringWebView URL
categoryString分类
sortOrderint排序
isEnabledbool是否启用

URL 安全验证 ​

所有 WebView URL 通过 UrlSafety.isValidWebViewUrl() 验证:

  • 必须 HTTPS
  • 禁止 localhost / 私有 IP
  • 禁止 javascript: / file: / data: 协议

API 端点 ​

端点说明
/apps/list应用列表
/apps/categories分类列表

客户模块(CRM) ​

页面文件行数说明
客户列表customer_list_page.dart295Tab 4 主页面
客户详情customer_detail_page.dart323客户信息 + 跟进

数据模型 ​

CustomerModel(customer_model.dart):

字段类型说明
idString客户 ID
nameString姓名
avatarString头像
phoneString电话
stageint阶段(线索/意向/成交/复购)
tagsList<String>标签
lastFollowUpint最后跟进时间
notesString备注

客户阶段:线索 → 意向 → 成交 → 复购

API 端点 ​

端点说明
/crm/customers客户列表
/crm/customers/detail客户详情
/crm/tags标签管理
/crm/follow-ups跟进记录
/crm/stage阶段变更
/crm/dashboardCRM 仪表盘

个人中心 & 设置 ​

页面文件行数说明
我的my_profile_page.dart1037Tab 5 主页面(最大文件)
编辑资料edit_profile_page.dart162修改昵称/头像/简介
设置settings_page.dart177系统设置
关于about_page.dart340版本信息 + 检查更新

用户模型 ​

UserModel(user_model.dart):

字段类型说明
idString用户 ID
nicknameString昵称
avatarString头像
bioString简介
phoneString手机号
followingCountint关注数
followerCountint粉丝数
likeCountint获赞数
customerCountint客户数

本地数据库 ​

使用 sqflite_sqlcipher 加密存储,数据库文件 menghub.db:

表名主要字段索引
conversationsid, type, name, avatar, last_message, unread_count—
messagesid, conversation_id, sender_id, type, content, seq, statusidx_messages_conv(conversation_id, seq)
usersid, nickname, avatar, bio, phone—
postsid, user_id, content, images, like_count, visibilityidx_posts_user(user_id, created_at)
customersid, name, phone, stage, tagsidx_customers_stage(stage)
h5_appsid, name, icon, url, category, sort_order—

安全层 ​

组件文件功能
ScreenProtectServicescreen_protect_service.dart防截屏(Platform Channel)
DeviceSecurityServicedevice_security_service.dartRoot/越狱检测
ClipboardServiceclipboard_service.dart敏感数据 5 秒后自动清除剪贴板
DeepLinkValidatordeep_link_validator.dart深度链接验证(防 SQL/脚本注入)
UrlSafetyurl_safety.dartURL 安全验证(禁止私有 IP/危险协议)
SSL Pinninghttp_client.dartSHA-256 证书固定
Text Sanitizer—剥离控制字符/零宽字符/BOM

完整路由表(22 条) ​

路由说明
/splash启动页
/onboarding功能介绍
/login登录
/home/messagesTab 1 消息
/home/feedTab 2 秒圈
/home/appsTab 3 应用
/home/customersTab 4 客户
/home/profileTab 5 我的
/chat聊天详情
/new-chat新建会话
/post/create发布动态
/post/edit编辑动态
/post/detail/:id动态详情
/post/audience-select可见范围选择
/customer/detail/:id客户详情
/settings设置
/edit-profile编辑资料
/searchIM 搜索
/about关于
/followers粉丝列表
/following关注列表
/friend-requests好友请求

下一步 ​

Released under the Apache 2.0 License.