You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
730 B
36 lines
730 B
package user
|
|
|
|
import (
|
|
"errors"
|
|
"live/app/lib/recook"
|
|
"live/app/model/user"
|
|
)
|
|
|
|
type User struct {
|
|
}
|
|
|
|
type ResultUserInfo struct {
|
|
Follows uint `json:"follows"`
|
|
Fans uint `json:"fans"`
|
|
Praise uint `json:"praise"`
|
|
recook.ReplyUserItem
|
|
}
|
|
|
|
// @Title 获取会员基础信息
|
|
func (u *User) BaseInfo(userId uint) (result ResultUserInfo, err error) {
|
|
users, err := recook.User.GetUsers([]uint{userId})
|
|
if err != nil {
|
|
return
|
|
}
|
|
if len(*users) == 0 {
|
|
return result, errors.New("用户信息不存在")
|
|
}
|
|
result.ReplyUserItem = (*users)[0]
|
|
userData := user.UserData{}
|
|
dataInfo := userData.GetByUserId(userId)
|
|
result.Follows = dataInfo.Follows
|
|
result.Fans = dataInfo.Fans
|
|
result.Praise = dataInfo.Praise
|
|
return
|
|
}
|