Skip to content

Commit

Permalink
fix #9
Browse files Browse the repository at this point in the history
  • Loading branch information
lisijie committed Aug 23, 2016
1 parent 1a1a028 commit 4cc7926
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
26 changes: 13 additions & 13 deletions app/entity/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)"` // 审批状态
Expand Down
12 changes: 6 additions & 6 deletions app/entity/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)"` // 创建时间
Expand Down
2 changes: 1 addition & 1 deletion app/service/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions app/service/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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
}
Expand Down
7 changes: 4 additions & 3 deletions install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 '发布状态',
Expand All @@ -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` (
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"
)

const VERSION = "2.0.0"
const VERSION = "2.0.1"

func main() {
service.Init()
Expand Down

0 comments on commit 4cc7926

Please sign in to comment.