diff --git a/app/entity/task.go b/app/entity/task.go index 2760dbb..ff0e036 100644 --- a/app/entity/task.go +++ b/app/entity/task.go @@ -9,19 +9,19 @@ import ( type Task struct { Id int - ProjectId int `orm:"index"` // 项目id - StartVer string `orm:"size(20)"` // 起始版本号 - EndVer string `orm:"size(20)"` // 结束版本号 - Message string `orm:"type(text)"` // 版本说明 - UserId int `orm:"index"` // 创建人ID - UserName string `orm:"size(20)"` // 创建人名称 - BuildStatus int `orm:"default(0)"` // 构建状态 - ChangeLogs string `orm:"type(text)"` // 修改日志列表 - ChangeFiles string `orm:"type(text)"` // 修改文件列表 - Filepath string `orm:"size(200)"` // 更新包路径 - PubEnvId int `orm:"default(0)"` // 发布环境ID - PubStatus int `orm:"default(0)"` // 发布状态:1 正在发布,2 发布到跳板机,3 发布到目标服务器,-2 发布到跳板机失败,-3 发布到目标服务器失败 - PubTime time.Time // 发布时间 + ProjectId int `orm:"index"` // 项目id + StartVer string `orm:"size(20)"` // 起始版本号 + EndVer string `orm:"size(20)"` // 结束版本号 + Message string `orm:"type(text)"` // 版本说明 + UserId int `orm:"index"` // 创建人ID + UserName string `orm:"size(20)"` // 创建人名称 + BuildStatus int `orm:"default(0)"` // 构建状态 + ChangeLogs string `orm:"type(text)"` // 修改日志列表 + ChangeFiles string `orm:"type(text)"` // 修改文件列表 + Filepath string `orm:"size(200)"` // 更新包路径 + PubEnvId int `orm:"default(0)"` // 发布环境ID + PubStatus int `orm:"default(0)"` // 发布状态:1 正在发布,2 发布到跳板机,3 发布到目标服务器,-2 发布到跳板机失败,-3 发布到目标服务器失败 + PubTime time.Time `orm:"null;type(datetime)"` // 发布时间 ErrorMsg string `orm:"type(text)"` // 错误消息 PubLog string `orm:"type(text)"` // 发布日志 ReviewStatus int `orm:"default(0)"` // 审批状态 diff --git a/app/entity/user.go b/app/entity/user.go index 4438dd3..462bb04 100644 --- a/app/entity/user.go +++ b/app/entity/user.go @@ -6,12 +6,12 @@ import ( type User struct { Id int - UserName string `orm:"unique;size(20)"` // 用户名 - Password string `orm:"size(32)"` // 密码 - Salt string `orm:"size(10)"` // 密码盐 - Sex int `orm:"default(0)"` // 性别 - Email string `orm:"size(50)"` // 邮箱 - LastLogin time.Time // 最后登录时间 + UserName string `orm:"unique;size(20)"` // 用户名 + Password string `orm:"size(32)"` // 密码 + Salt string `orm:"size(10)"` // 密码盐 + Sex int `orm:"default(0)"` // 性别 + Email string `orm:"size(50)"` // 邮箱 + LastLogin time.Time `orm:"null;type(datetime)"` // 最后登录时间 LastIp string `orm:"size(15)"` // 最后登录IP Status int `orm:"default(0)"` // 状态,0正常 -1禁用 CreateTime time.Time `orm:"auto_now_add;type(datetime)"` // 创建时间 diff --git a/app/service/task.go b/app/service/task.go index 70d7450..7666ee2 100644 --- a/app/service/task.go +++ b/app/service/task.go @@ -93,7 +93,7 @@ func (this *taskService) AddTask(task *entity.Task) error { task.ReviewStatus = 1 // 已审批 } task.PubStatus = 0 - task.PubTime = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC) + // task.PubTime = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC) _, err = o.Insert(task) return err } diff --git a/app/service/user.go b/app/service/user.go index 73c585f..20cdc48 100644 --- a/app/service/user.go +++ b/app/service/user.go @@ -5,7 +5,6 @@ import ( "github.com/astaxie/beego/utils" "github.com/lisijie/gopub/app/entity" "github.com/lisijie/gopub/app/libs" - "time" ) type userService struct{} @@ -95,7 +94,7 @@ func (this *userService) AddUser(userName, email, password string, sex int) (*en user.Email = email user.Salt = string(utils.RandomCreateBytes(10)) user.Password = libs.Md5([]byte(password + user.Salt)) - user.LastLogin = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC) + // user.LastLogin = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC) _, err := o.Insert(user) return user, err } diff --git a/install.sql b/install.sql index a49fa5c..f11937c 100644 --- a/install.sql +++ b/install.sql @@ -125,7 +125,7 @@ CREATE TABLE `t_task` ( `change_files` longtext NOT NULL COMMENT '修改文件列表', `filepath` varchar(200) NOT NULL DEFAULT '' COMMENT '发布包路径', `pub_env_id` int(11) NOT NULL DEFAULT '0' COMMENT '发布环境ID', - `pub_time` datetime NOT NULL COMMENT '发布时间', + `pub_time` datetime DEFAULT NULL COMMENT '发布时间', `error_msg` longtext NOT NULL COMMENT '错误消息', `pub_log` longtext NOT NULL COMMENT '发布日志', `pub_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '发布状态', @@ -134,7 +134,8 @@ CREATE TABLE `t_task` ( `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `t_task_project_id` (`project_id`), - KEY `t_task_user_id` (`user_id`) + KEY `t_task_user_id` (`user_id`), + KEY `pub_time` (`pub_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `t_task_review` ( @@ -156,7 +157,7 @@ CREATE TABLE `t_user` ( `salt` varchar(10) NOT NULL DEFAULT '', `sex` int(11) NOT NULL DEFAULT '0', `email` varchar(50) NOT NULL DEFAULT '', - `last_login` datetime NOT NULL, + `last_login` datetime DEFAULT NULL, `last_ip` varchar(15) NOT NULL DEFAULT '', `status` int(11) NOT NULL DEFAULT '0', `create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', diff --git a/main.go b/main.go index b5bf669..60bbdd8 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( "time" ) -const VERSION = "2.0.0" +const VERSION = "2.0.1" func main() { service.Init()