# newthink3_chat **Repository Path**: hongweizhiyuan/newthink3_chat ## Basic Information - **Project Name**: newthink3_chat - **Description**: newthink3制作的聊天模块儿! - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-05-16 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #newthink3 聊天模块儿 ### 1.menu数据库插入数据 ``` INSERT INTO `new_menu` (`parentid`, `app`, `model`, `action`, `data`, `type`, `status`, `name`, `icon`, `remark`, `listorder`) VALUES ( 0, 'Chat', 'AdminIndex', 'index', '', 1, 1, '聊天列表', 'wechat', '', 0); ``` ### 1. 聊天表 lt_chat_message ``` DROP TABLE IF EXISTS `new_chat_message`; CREATE TABLE `new_chat_message` ( `message_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '聊天自增ID', `client_msg_id` varchar(128) NOT NULL DEFAULT '' COMMENT '消息ID 每一条消息有唯一的ID', `msg_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '消息类型,0表示单聊', `msg_from` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '聊天发起者', `msg_to` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '聊天接收者', `msg_at` varchar(255) NOT NULL DEFAULT '' COMMENT '聊天AT者', `receiver` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '接收器', `content` varchar(500) NOT NULL DEFAULT '' COMMENT '聊天的内容', `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聊天的时间', `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '没用到', `received` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '接收成功1,接收失败为0', `expiry` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '有效期-没用到', PRIMARY KEY (`message_id`), KEY `msg_to` (`msg_to`,`receiver`,`create_time`,`status`,`expiry`), KEY `received` (`received`) ) ENGINE=MyISAM AUTO_INCREMENT=162 DEFAULT CHARSET=utf8; ``` 聊天表的测试数据: ``` INSERT INTO `new_chat_message` VALUES ('1', '1493720957878', '1', '109', '110', '', '1', '11', '1493720958', '0', '1', '0'); INSERT INTO `new_chat_message` VALUES ('2', '1493721178359', '1', '109', '110', '', '1', '6446646', '1493721178', '0', '1', '0'); INSERT INTO `new_chat_message` VALUES ('3', '1493721358725', '1', '109', '110', '', '1', '你好', '1493721359', '0', '1', '0'); INSERT INTO `new_chat_message` VALUES ('4', '1493721399816', '1', '110', '112', '', '1', '你好', '1493721399', '0', '1', '0'); INSERT INTO `new_chat_message` VALUES ('5', '1493721406465', '1', '110', '112', '', '1', '我很好', '1493721406', '0', '1', '0'); ``` 如图: ![mark](http://olbhidnfa.bkt.clouddn.com/blog/20170516-162218020.png)