Skip to content

Commit 4cc7926

Browse files
committed
fix #9
1 parent 1a1a028 commit 4cc7926

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

app/entity/task.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ import (
99

1010
type Task struct {
1111
Id int
12-
ProjectId int `orm:"index"` // 项目id
13-
StartVer string `orm:"size(20)"` // 起始版本号
14-
EndVer string `orm:"size(20)"` // 结束版本号
15-
Message string `orm:"type(text)"` // 版本说明
16-
UserId int `orm:"index"` // 创建人ID
17-
UserName string `orm:"size(20)"` // 创建人名称
18-
BuildStatus int `orm:"default(0)"` // 构建状态
19-
ChangeLogs string `orm:"type(text)"` // 修改日志列表
20-
ChangeFiles string `orm:"type(text)"` // 修改文件列表
21-
Filepath string `orm:"size(200)"` // 更新包路径
22-
PubEnvId int `orm:"default(0)"` // 发布环境ID
23-
PubStatus int `orm:"default(0)"` // 发布状态:1 正在发布,2 发布到跳板机,3 发布到目标服务器,-2 发布到跳板机失败,-3 发布到目标服务器失败
24-
PubTime time.Time // 发布时间
12+
ProjectId int `orm:"index"` // 项目id
13+
StartVer string `orm:"size(20)"` // 起始版本号
14+
EndVer string `orm:"size(20)"` // 结束版本号
15+
Message string `orm:"type(text)"` // 版本说明
16+
UserId int `orm:"index"` // 创建人ID
17+
UserName string `orm:"size(20)"` // 创建人名称
18+
BuildStatus int `orm:"default(0)"` // 构建状态
19+
ChangeLogs string `orm:"type(text)"` // 修改日志列表
20+
ChangeFiles string `orm:"type(text)"` // 修改文件列表
21+
Filepath string `orm:"size(200)"` // 更新包路径
22+
PubEnvId int `orm:"default(0)"` // 发布环境ID
23+
PubStatus int `orm:"default(0)"` // 发布状态:1 正在发布,2 发布到跳板机,3 发布到目标服务器,-2 发布到跳板机失败,-3 发布到目标服务器失败
24+
PubTime time.Time `orm:"null;type(datetime)"` // 发布时间
2525
ErrorMsg string `orm:"type(text)"` // 错误消息
2626
PubLog string `orm:"type(text)"` // 发布日志
2727
ReviewStatus int `orm:"default(0)"` // 审批状态

app/entity/user.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import (
66

77
type User struct {
88
Id int
9-
UserName string `orm:"unique;size(20)"` // 用户名
10-
Password string `orm:"size(32)"` // 密码
11-
Salt string `orm:"size(10)"` // 密码盐
12-
Sex int `orm:"default(0)"` // 性别
13-
Email string `orm:"size(50)"` // 邮箱
14-
LastLogin time.Time // 最后登录时间
9+
UserName string `orm:"unique;size(20)"` // 用户名
10+
Password string `orm:"size(32)"` // 密码
11+
Salt string `orm:"size(10)"` // 密码盐
12+
Sex int `orm:"default(0)"` // 性别
13+
Email string `orm:"size(50)"` // 邮箱
14+
LastLogin time.Time `orm:"null;type(datetime)"` // 最后登录时间
1515
LastIp string `orm:"size(15)"` // 最后登录IP
1616
Status int `orm:"default(0)"` // 状态,0正常 -1禁用
1717
CreateTime time.Time `orm:"auto_now_add;type(datetime)"` // 创建时间

app/service/task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (this *taskService) AddTask(task *entity.Task) error {
9393
task.ReviewStatus = 1 // 已审批
9494
}
9595
task.PubStatus = 0
96-
task.PubTime = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC)
96+
// task.PubTime = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC)
9797
_, err = o.Insert(task)
9898
return err
9999
}

app/service/user.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"github.com/astaxie/beego/utils"
66
"github.com/lisijie/gopub/app/entity"
77
"github.com/lisijie/gopub/app/libs"
8-
"time"
98
)
109

1110
type userService struct{}
@@ -95,7 +94,7 @@ func (this *userService) AddUser(userName, email, password string, sex int) (*en
9594
user.Email = email
9695
user.Salt = string(utils.RandomCreateBytes(10))
9796
user.Password = libs.Md5([]byte(password + user.Salt))
98-
user.LastLogin = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC)
97+
// user.LastLogin = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC)
9998
_, err := o.Insert(user)
10099
return user, err
101100
}

install.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ CREATE TABLE `t_task` (
125125
`change_files` longtext NOT NULL COMMENT '修改文件列表',
126126
`filepath` varchar(200) NOT NULL DEFAULT '' COMMENT '发布包路径',
127127
`pub_env_id` int(11) NOT NULL DEFAULT '0' COMMENT '发布环境ID',
128-
`pub_time` datetime NOT NULL COMMENT '发布时间',
128+
`pub_time` datetime DEFAULT NULL COMMENT '发布时间',
129129
`error_msg` longtext NOT NULL COMMENT '错误消息',
130130
`pub_log` longtext NOT NULL COMMENT '发布日志',
131131
`pub_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '发布状态',
@@ -134,7 +134,8 @@ CREATE TABLE `t_task` (
134134
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
135135
PRIMARY KEY (`id`),
136136
KEY `t_task_project_id` (`project_id`),
137-
KEY `t_task_user_id` (`user_id`)
137+
KEY `t_task_user_id` (`user_id`),
138+
KEY `pub_time` (`pub_time`)
138139
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
139140

140141
CREATE TABLE `t_task_review` (
@@ -156,7 +157,7 @@ CREATE TABLE `t_user` (
156157
`salt` varchar(10) NOT NULL DEFAULT '',
157158
`sex` int(11) NOT NULL DEFAULT '0',
158159
`email` varchar(50) NOT NULL DEFAULT '',
159-
`last_login` datetime NOT NULL,
160+
`last_login` datetime DEFAULT NULL,
160161
`last_ip` varchar(15) NOT NULL DEFAULT '',
161162
`status` int(11) NOT NULL DEFAULT '0',
162163
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111
)
1212

13-
const VERSION = "2.0.0"
13+
const VERSION = "2.0.1"
1414

1515
func main() {
1616
service.Init()

0 commit comments

Comments
 (0)