本文整理匯總了Golang中github.com/ginuerzh/sports/models.Account.ArticleCount方法的典型用法代碼示例。如果您正苦於以下問題:Golang Account.ArticleCount方法的具體用法?Golang Account.ArticleCount怎麽用?Golang Account.ArticleCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ginuerzh/sports/models.Account
的用法示例。
在下文中一共展示了Account.ArticleCount方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: convertUser
func convertUser(user *models.Account, redis *models.RedisLogger) *userJsonStruct {
info := &userJsonStruct{
Userid: user.Id,
Nickname: user.Nickname,
Email: user.Email,
Phone: user.Phone,
Type: user.Role,
About: user.About,
Profile: user.Profile,
RegTime: user.RegTime.Unix(),
Height: user.Height,
Weight: user.Weight,
Birth: user.Birth,
Actor: user.Actor,
Location: user.Loc,
Addr: user.LocAddr,
Sign: user.Sign,
Emotion: user.Emotion,
Profession: user.Profession,
Hometown: user.Hometown,
OftenAppear: user.Oftenappear,
Hobby: user.Hobby,
//Rank: userRank(user.Level),
Online: redis.IsOnline(user.Id),
Gender: user.Gender,
//Follows: len(redis.Follows(user.Id)),
//Followers: len(redis.Followers(user.Id)),
Posts: user.ArticleCount(),
//Props: redis.UserProps(user.Id),
Props: models.Props{
Physical: user.Props.Physical,
Literal: user.Props.Literal,
Mental: user.Props.Mental,
Wealth: redis.GetCoins(user.Id),
Score: user.Props.Score,
Level: user.Level(),
},
Photos: user.Photos,
CoverImage: user.CoverImage,
Wallet: user.Wallet.Addr,
LastLog: user.LastLogin.Unix(),
Setinfo: user.Setinfo,
Ban: user.TimeLimit,
Auth: user.Auth,
}
balance, _ := getBalance(user.Wallet.Addrs)
var wealth int64
if balance != nil {
for _, b := range balance.Addrs {
wealth += (b.Confirmed + b.Unconfirmed)
}
}
info.Props.Wealth = wealth
info.Follows, info.Followers, _, _ = redis.FriendCount(user.Id)
/*
if user.Privilege == 5 {
info.Actor = "coach"
} else if user.Privilege == 10 {
info.Actor = "admin"
}
if user.Addr != nil {
info.Addr = user.Addr.String()
}
*/
if user.Equips != nil {
info.Equips = *user.Equips
}
if info.Auth != nil {
if info.Auth.IdCard == nil {
info.Auth.IdCard = info.Auth.IdCardTmp
}
if info.Auth.Cert == nil {
info.Auth.Cert = info.Auth.CertTmp
}
if info.Auth.Record == nil {
info.Auth.Record = info.Auth.RecordTmp
}
}
return info
}