From b5c0f5f6fbf2bff6f514e2f600f6651087131b41 Mon Sep 17 00:00:00 2001 From: yangxuzheng <1391625461@qq.com> Date: Sat, 14 May 2022 18:07:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9A=84=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/user.go | 14 +++++++++++++- viewmodel/user.go | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/store/user.go b/store/user.go index 9fea3b7..cf0bb62 100644 --- a/store/user.go +++ b/store/user.go @@ -123,7 +123,19 @@ func GetUserInfoByPhone(phone string) (*viewmodel.UserInfo, error) { result := &viewmodel.UserInfo{} scan := DB.Self.Model(&model.User{}). - Select("user.user_id, user.phone,user.password, user.role, user.email , user.class_id, class.class_name"). + Select("user.user_id, "+ + "user.phone, "+ + "user.password, "+ + "user.role, "+ + "user.email, "+ + "user.real_name, "+ + "user.nick_name, "+ + "user.hobby, "+ + "user.address, "+ + "user.sex, "+ + "user.age, "+ + "user.class_id, "+ + "class.class_name"). Joins("left join class on user.class_id = class.class_id"). Where("user.phone = ?", phone).Scan(&result) diff --git a/viewmodel/user.go b/viewmodel/user.go index 8d5b507..2faf8bb 100644 --- a/viewmodel/user.go +++ b/viewmodel/user.go @@ -26,6 +26,12 @@ type UserInfo struct { Role int `json:"role"` ClassId string `json:"class_id"` ClassName string `json:"class_name"` + RealName string `json:"real_name"` + NickName string `json:"nick_name"` + Hobby string `json:"hobby"` + Address string `json:"address"` + Sex int `json:"sex"` + Age int `json:"age"` } // LoginResponse 登录响应结构体 -- Gitee