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,
|
`is_root` tinyint(1) not null,
|
||||||
`leader_id` int unsigned not null default 0,
|
`leader_id` int unsigned not null default 0,
|
||||||
`leader_name` varchar(32) not null default '',
|
`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`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY (`username`),
|
UNIQUE KEY (`username`),
|
||||||
UNIQUE KEY (`uuid`)
|
UNIQUE KEY (`uuid`)
|
||||||
|
|
|
@ -28,20 +28,20 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
UUID string `json:"uuid" xorm:"'uuid'"`
|
UUID string `json:"uuid" xorm:"'uuid'"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Password string `json:"-"`
|
Password string `json:"-"`
|
||||||
Dispname string `json:"dispname"`
|
Dispname string `json:"dispname"`
|
||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Im string `json:"im"`
|
Im string `json:"im"`
|
||||||
Portrait string `json:"portrait"`
|
Portrait string `json:"portrait"`
|
||||||
Intro string `json:"intro"`
|
Intro string `json:"intro"`
|
||||||
IsRoot int `json:"is_root"`
|
IsRoot int `json:"is_root"`
|
||||||
LeaderId int64 `json:"leader_id"`
|
LeaderId int64 `json:"leader_id"`
|
||||||
LeaderName string `json:"leader_name"`
|
LeaderName string `json:"leader_name"`
|
||||||
CreateAt int64 `json:"create_at"`
|
CreateAt time.Time `json:"create_at" xorm:"<-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *User) CopyLdapAttr(sr *ldap.SearchResult) {
|
func (u *User) CopyLdapAttr(sr *ldap.SearchResult) {
|
||||||
|
|
|
@ -64,7 +64,6 @@ func userAddPost(c *gin.Context) {
|
||||||
IsRoot: f.IsRoot,
|
IsRoot: f.IsRoot,
|
||||||
LeaderId: f.LeaderId,
|
LeaderId: f.LeaderId,
|
||||||
UUID: models.GenUUIDForUser(f.Username),
|
UUID: models.GenUUIDForUser(f.Username),
|
||||||
CreateAt: time.Now().Unix(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.LeaderId != 0 {
|
if f.LeaderId != 0 {
|
||||||
|
@ -273,8 +272,7 @@ func userInvitePost(c *gin.Context) {
|
||||||
inv, err := models.InviteGet("token=?", f.Token)
|
inv, err := models.InviteGet("token=?", f.Token)
|
||||||
dangerous(err)
|
dangerous(err)
|
||||||
|
|
||||||
now := time.Now().Unix()
|
if inv.Expire < time.Now().Unix() {
|
||||||
if inv.Expire < now {
|
|
||||||
dangerous("invite url already expired")
|
dangerous("invite url already expired")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +283,6 @@ func userInvitePost(c *gin.Context) {
|
||||||
Email: f.Email,
|
Email: f.Email,
|
||||||
Im: f.Im,
|
Im: f.Im,
|
||||||
UUID: models.GenUUIDForUser(f.Username),
|
UUID: models.GenUUIDForUser(f.Username),
|
||||||
CreateAt: now,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u.Password, err = models.CryptoPass(f.Password)
|
u.Password, err = models.CryptoPass(f.Password)
|
||||||
|
|
Loading…
Reference in New Issue