Add a README

This commit is contained in:
2018-12-23 15:12:56 +08:00
parent 1f71eb11f2
commit d9445b707e
53 changed files with 6861 additions and 7082 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ CREATE TABLE `message` (
`To` varchar(12) NOT NULL,
`Msg` text,
PRIMARY KEY (`Id`)
) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8;
LOCK TABLES `message` WRITE;
UNLOCK TABLES;
@@ -20,9 +20,9 @@ CREATE TABLE `user` (
`UGroup` enum('User','Vip','Admin','Group') DEFAULT 'User',
`Photo` mediumtext,
PRIMARY KEY (`User`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) DEFAULT CHARSET=utf8;
LOCK TABLES `user` WRITE;
INSERT INTO `user` VALUES ('mattuy','mattuy','Mattuy','','Admin',NULL);
INSERT INTO `user` VALUES ('test','test','Test','This is my Motto.','Admin',NULL);
UNLOCK TABLES;
-29
View File
@@ -14,35 +14,6 @@ const (
timeout_message = 100 * 365 * 24 * 60 * 60
)
//用户组
const (
ugroup_user string = "User" //普通用户
ugroup_vip string = "Vip" //会员
ugroup_admin string = "Admin" //管理员
ugroup_group string = "Group" //群聊
)
//消息头的通用字段名称
const (
keyname_operation string = "Operation" //操作名
keyname_token string = "Token"
)
//控制消息。详见设计文档
const (
operation_panic string = "Panic"
operation_trans_message string = "TransMessage"
operation_send_message string = "SendMessage"
operation_ping string = "Ping"
operation_login string = "Login2"
operation_login_old1 string = "Login"
operation_logout string = "Logout"
operation_offline string = "Offline"
operation_get_user_list string = "GetUserList"
operation_update_userinfo string = "UpdateUserInfo"
operation_get_users string = "GetUsers"
)
//字符串常量
const (
//日志文件。交互模式时无效(输出到os.Stdout)
+21
View File
@@ -5,6 +5,27 @@ import (
"time"
)
//控制消息。详见设计文档
const (
operation_panic string = "Panic"
operation_trans_message string = "TransMessage"
operation_send_message string = "SendMessage"
operation_ping string = "Ping"
operation_login string = "Login2"
operation_login_old1 string = "Login"
operation_logout string = "Logout"
operation_offline string = "Offline"
operation_get_user_list string = "GetUserList"
operation_update_userinfo string = "UpdateUserInfo"
operation_get_users string = "GetUsers"
)
//消息头的通用字段名称
const (
keyname_operation string = "Operation" //操作名
keyname_token string = "Token"
)
//消息结构
type Message struct {
When time.Time //接收时间
+8
View File
@@ -5,6 +5,14 @@ import (
"unicode/utf8"
)
//用户组
const (
ugroup_user string = "User" //普通用户
ugroup_vip string = "Vip" //会员
ugroup_admin string = "Admin" //管理员
ugroup_group string = "Group" //群聊
)
//用户信息
type UserInfo struct {
User string //用户名