rdb新增用户添加时间代码调整 (#398)
* rdb资源增加volume * rdb用户增加创建时间 * rdb用户添加时间 * rdb新增添加用户时间代码调整 * test Co-authored-by: alickliming <alickliming@didi.global.com>
This commit is contained in:
parent
1a71de851a
commit
ffc98f31c9
|
@ -19,7 +19,7 @@ CREATE TABLE `user`
|
|||
`is_root` tinyint(1) not null,
|
||||
`leader_id` int unsigned not null default 0,
|
||||
`leader_name` varchar(32) not null default '',
|
||||
`create_at` int unsigned not null default 0,
|
||||
`create_at` timestamp not null default CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY (`username`),
|
||||
UNIQUE KEY (`uuid`)
|
||||
|
|
|
@ -28,20 +28,20 @@ const (
|
|||
)
|
||||
|
||||
type User struct {
|
||||
Id int64 `json:"id"`
|
||||
UUID string `json:"uuid" xorm:"'uuid'"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"-"`
|
||||
Dispname string `json:"dispname"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
Im string `json:"im"`
|
||||
Portrait string `json:"portrait"`
|
||||
Intro string `json:"intro"`
|
||||
IsRoot int `json:"is_root"`
|
||||
LeaderId int64 `json:"leader_id"`
|
||||
LeaderName string `json:"leader_name"`
|
||||
CreateAt int64 `json:"create_at"`
|
||||
Id int64 `json:"id"`
|
||||
UUID string `json:"uuid" xorm:"'uuid'"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"-"`
|
||||
Dispname string `json:"dispname"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
Im string `json:"im"`
|
||||
Portrait string `json:"portrait"`
|
||||
Intro string `json:"intro"`
|
||||
IsRoot int `json:"is_root"`
|
||||
LeaderId int64 `json:"leader_id"`
|
||||
LeaderName string `json:"leader_name"`
|
||||
CreateAt time.Time `json:"create_at" xorm:"<-"`
|
||||
}
|
||||
|
||||
func (u *User) CopyLdapAttr(sr *ldap.SearchResult) {
|
||||
|
|
|
@ -64,7 +64,6 @@ func userAddPost(c *gin.Context) {
|
|||
IsRoot: f.IsRoot,
|
||||
LeaderId: f.LeaderId,
|
||||
UUID: models.GenUUIDForUser(f.Username),
|
||||
CreateAt: time.Now().Unix(),
|
||||
}
|
||||
|
||||
if f.LeaderId != 0 {
|
||||
|
@ -273,8 +272,7 @@ func userInvitePost(c *gin.Context) {
|
|||
inv, err := models.InviteGet("token=?", f.Token)
|
||||
dangerous(err)
|
||||
|
||||
now := time.Now().Unix()
|
||||
if inv.Expire < now {
|
||||
if inv.Expire < time.Now().Unix() {
|
||||
dangerous("invite url already expired")
|
||||
}
|
||||
|
||||
|
@ -285,7 +283,6 @@ func userInvitePost(c *gin.Context) {
|
|||
Email: f.Email,
|
||||
Im: f.Im,
|
||||
UUID: models.GenUUIDForUser(f.Username),
|
||||
CreateAt: now,
|
||||
}
|
||||
|
||||
u.Password, err = models.CryptoPass(f.Password)
|
||||
|
|
Loading…
Reference in New Issue