3 Star 34 Fork 7

WxLess / wx-cloud-im

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

为了 Azu程序员同行身体健康,不气到同行,该项目自 2021-10-13起停止维护

本次更新:稍微修改了下命名

功能实现

  • 即时消息监听推送
  • 文本内容安全核验
  • 图片内容安全核验
  • 历史消息查询
  • 小黑屋功能:禁止用户发言
  • 消息位置锚定 scroll-view

效果预览

image-20210801112714868

项目部署

  1. 按照下方数据表设计新建数据集合,并设置所有数据表为访问权限为所有用户可读,仅创建者可读写
  2. 修改config.js配置文件中CloudID为你自己的云环境ID。
  3. 上传并部署全部云函数
  4. 进入云开发后台,配置上传云函数环境变量 TZAsia/Shanghai
  5. cloud-blcak-timer需要上传触发器
  6. 重新编译项目

数据表设计

chat-users 聊天室用户信息表

字段 说明 类型
_id 数据库记录唯一ID string
openid 用户唯一身份识别ID string
userInfo 用户头像 昵称 地址等信息 object

chat-users-ban 聊天室小黑屋信息表

字段 说明 类型
_id 数据库记录唯一ID string
ban_date 禁言时长 单位天 number
_createTime 记录创建时间 string
_updateTime 记录更新时间 string

chat-msgs 消息记录表

字段 说明 类型
_id 数据库记录唯一ID string
roomId 会话房间号 number
openid 消息发送者openid string
msgType 消息类型 目前有 text image string
content 消息内容 text :对应消息内容 image:对应图片地址 string
userInfo 用户头像 昵称 地址等信息 object
_createTime 消息创建时间 string

chat-msgs-ban 非法消息记录表(内容/图片安全校验不通过)

字段 说明 类型
_id 数据库记录唯一ID string
roomId 会话房间号 number
openid 消息发送者openid string
msgType 消息类型 目前有 text image string
content 消息内容 text :对应消息内容 image:对应图片地址 string
userInfo 用户头像 昵称 地址等信息 object
_createTime 消息创建时间 string

拓展开发

项目提供的聊天室Demo为单聊天室模式,默认roomId = 1。为如果想要做成多用户聊天不同的形式,如QQ,只需要做如下几个步骤

  1. 自定义数据集合,为不同用户之间聊天分配不同的 roomId

  2. 引用组件时传入不同roomId即可

    <chat-box roomId="{{roomId}}"></chat-box>
  3. 调用消息发送云函数时,传入 roomId

TIPS

建议复用index/index.js页面,只需跳转该页面时,携带roomId参数,并赋值给data中的roomId即可

 onLoad: function (options){
	this.setData({
		roomId:options.roomId
	})
}

服务支持

提供有偿技术支持 kindear@foxmail.com

MIT License Copyright (c) 2020 GZ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于微信云开发 cloudbase 构建聊天小程序 提供即时通讯 内容安全校验 黑名单管理 消息队列等功能 展开 收起
JavaScript
MIT
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/wxless/wx-cloud-im.git
git@gitee.com:wxless/wx-cloud-im.git
wxless
wx-cloud-im
wx-cloud-im
master

搜索帮助