查询好友添加avatar
This commit is contained in:
parent
a83aa1002d
commit
6880e033a8
|
|
@ -231,9 +231,10 @@ func FindFriend(from_user_id, to_user_id int) []Friend {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FriendRet struct {
|
type FriendRet struct {
|
||||||
ID int `json:"id"` //用户id
|
ID int `json:"id"` //用户id
|
||||||
Name string `json:"name"` //用户名
|
Name string `json:"name"` //用户名
|
||||||
Email string `json:"email"` //邮箱
|
Email string `json:"email"` //邮箱
|
||||||
|
Avatar string `json:"avatar"` //头像
|
||||||
}
|
}
|
||||||
|
|
||||||
func FindFriendsIDs(user_id int) []Friend {
|
func FindFriendsIDs(user_id int) []Friend {
|
||||||
|
|
@ -244,7 +245,7 @@ func FindFriendsIDs(user_id int) []Friend {
|
||||||
|
|
||||||
func FindFriends(user_id int) []FriendRet {
|
func FindFriends(user_id int) []FriendRet {
|
||||||
var friends []FriendRet
|
var friends []FriendRet
|
||||||
DB.Raw("select distinct users.id, users.name, users.email from users join friends on users.id = friends.friend_id where friends.user_id = ? and friends.deleted_at is null", user_id).Scan(&friends)
|
DB.Raw("select distinct users.id, users.name, users.email,user.avatar from users join friends on users.id = friends.friend_id where friends.user_id = ? and friends.deleted_at is null", user_id).Scan(&friends)
|
||||||
return friends
|
return friends
|
||||||
}
|
}
|
||||||
func GetGroups(user_id int) []Group {
|
func GetGroups(user_id int) []Group {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue