feat(user):基本完成间隔与运维用户创建功能。

This commit is contained in:
徐涛
2022-08-13 11:08:29 +08:00
parent 0fc57b7506
commit 409f9af1c4
2 changed files with 49 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ import (
"time"
"github.com/google/uuid"
"xorm.io/builder"
)
type _UserService struct{}
@@ -169,6 +170,10 @@ func (_UserService) IsUserExists(uid string) (bool, error) {
return global.DBConn.ID(uid).Exist(&model.User{})
}
func (_UserService) IsUsernameExists(username string) (bool, error) {
return global.DBConn.Where(builder.Eq{"username": username}).Exist(&model.User{})
}
func (u _UserService) CreateUser(user *model.User, detail *model.UserDetail) (string, error) {
if len(user.Id) == 0 {
user.Id = uuid.New().String()