From 2f0aa60ce2e10be53d9c865a6177bf731e182203 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期四, 17 八月 2023 11:15:41 +0800
Subject: [PATCH] fix
---
service/user.go | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/service/user.go b/service/user.go
index 2adb136..3f40330 100644
--- a/service/user.go
+++ b/service/user.go
@@ -35,7 +35,7 @@
}
func (userService *UserService) ChangePassword(u *model.User, newPassword string) (userInter *model.User, errCode int) {
- user, err := model.NewUserSearch(nil).SetId(u.ID).First()
+ user, err := model.NewUserSearch(nil).SetId(u.UUID).First()
if err != nil {
return nil, ecode.UserNotExist
}
@@ -45,7 +45,7 @@
}
user.Password = encrypt.BcryptHash(newPassword)
- err = model.NewUserSearch(nil).SetId(u.ID).UpdateByMap(map[string]interface{}{
+ err = model.NewUserSearch(nil).SetId(u.UUID).UpdateByMap(map[string]interface{}{
"password": user.Password})
return user, ecode.OK
@@ -71,7 +71,7 @@
}
func (userService *UserService) SetUserInfo(req model.User) error {
- return model.NewUserSearch(nil).SetId(req.ID).UpdateByMap(map[string]interface{}{
+ return model.NewUserSearch(nil).SetId(req.UUID).UpdateByMap(map[string]interface{}{
"nick_name": req.NickName,
"header_img": req.HeaderImg,
"phone": req.Phone,
@@ -89,3 +89,7 @@
"password": encrypt.BcryptHash("123456"),
})
}
+
+func (userService *UserService) GetUserList() (userList []*model.User, err error) {
+ return model.NewUserSearch(nil).FindAll()
+}
--
Gitblit v1.8.0