forked from free-lancers/electricity_bill_calc_service
feat(user):基本完成间隔与运维用户创建功能。
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user