add register

This commit is contained in:
ljw
2024-10-31 15:14:30 +08:00
parent 0ed40318cb
commit e2fda47cbb
12 changed files with 86 additions and 3 deletions

View File

@@ -323,3 +323,13 @@ func (us *UserService) FindLatestUserIdFromLoginLogByUuid(uuid string) uint {
global.DB.Where("uuid = ?", uuid).Order("id desc").First(llog)
return llog.UserId
}
func (us *UserService) Register(username string, password string) *model.User {
u := &model.User{
Username: username,
Password: us.EncryptPassword(password),
GroupId: 1,
}
global.DB.Create(u)
return u
}