Tao Chen 1 год назад
Родитель
Сommit
14beef72fc
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      http/controller/admin/user.go
  2. 2 2
      service/user.go

+ 1 - 1
http/controller/admin/user.go

@@ -391,7 +391,7 @@ func (ct *User) Register(c *gin.Context) {
391
 		response.Fail(c, 101, errList[0])
391
 		response.Fail(c, 101, errList[0])
392
 		return
392
 		return
393
 	}
393
 	}
394
-	u := service.AllService.UserService.Register(f.Username, f.Password)
394
+	u := service.AllService.UserService.Register(f.Username, f.Email, f.Password)
395
 	if u == nil || u.Id == 0 {
395
 	if u == nil || u.Id == 0 {
396
 		response.Fail(c, 101, response.TranslateMsg(c, "OperationFailed"))
396
 		response.Fail(c, 101, response.TranslateMsg(c, "OperationFailed"))
397
 		return
397
 		return

+ 2 - 2
service/user.go

@@ -11,7 +11,6 @@ import (
11
 	"strconv"
11
 	"strconv"
12
 	"time"
12
 	"time"
13
 	"strings"
13
 	"strings"
14
-	"fmt"
15
 )
14
 )
16
 
15
 
17
 type UserService struct {
16
 type UserService struct {
@@ -378,9 +377,10 @@ func (us *UserService) IsPasswordEmptyByUser(u *model.User) bool {
378
 }
377
 }
379
 
378
 
380
 // Register 注册
379
 // Register 注册
381
-func (us *UserService) Register(username string, password string) *model.User {
380
+func (us *UserService) Register(username string, email string, password string) *model.User {
382
 	u := &model.User{
381
 	u := &model.User{
383
 		Username: username,
382
 		Username: username,
383
+		Email:    email,
384
 		Password: us.EncryptPassword(password),
384
 		Password: us.EncryptPassword(password),
385
 		GroupId:  1,
385
 		GroupId:  1,
386
 	}
386
 	}