Commit 312d9a7a authored by hujiebin's avatar hujiebin

是否新用户

parent a60fd927
...@@ -84,7 +84,8 @@ type CvUserBase struct { ...@@ -84,7 +84,8 @@ type CvUserBase struct {
//邀请码 //邀请码
Code *string `json:"code"` Code *string `json:"code"`
IsPrettyCode bool `json:"isPrettyCode"` // 是否靓号 IsPrettyCode bool `json:"isPrettyCode"` // 是否靓号
IsLogout bool `json:"isLogout"` //是否注销 IsNew bool `json:"isNew"` // 是否新用户
IsLogout bool `json:"isLogout"` // 是否注销
//生日,如果是其它人用户信息,年龄则按照是否展示显示,如果是本人,年龄则按照是否存在展示 //生日,如果是其它人用户信息,年龄则按照是否展示显示,如果是本人,年龄则按照是否存在展示
Birthday *uint64 `json:"birthday"` Birthday *uint64 `json:"birthday"`
//是否展示年龄, 是本人才有数据,看其他用户均为nil //是否展示年龄, 是本人才有数据,看其他用户均为nil
...@@ -201,6 +202,7 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error) ...@@ -201,6 +202,7 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error)
CountryIcon: StrNil(user.CountryIcon), CountryIcon: StrNil(user.CountryIcon),
Code: StrToString(&user.Code), Code: StrToString(&user.Code),
IsPrettyCode: user.IsPrettyCode(), IsPrettyCode: user.IsPrettyCode(),
IsNew: user.IsNew(),
IsVip: vips[user.ID] != nil, IsVip: vips[user.ID] != nil,
IsOfficialStaff: superManagerMap[user.ID], IsOfficialStaff: superManagerMap[user.ID],
Medals: IfLogoutMedals(IfLogout(user.LogoutTime), []uint32{}, medals[user.ID]), Medals: IfLogoutMedals(IfLogout(user.LogoutTime), []uint32{}, medals[user.ID]),
...@@ -301,6 +303,7 @@ func GetUserBasesForCp(userIds []mysql.ID) ([]*CvUserBase, error) { ...@@ -301,6 +303,7 @@ func GetUserBasesForCp(userIds []mysql.ID) ([]*CvUserBase, error) {
CountryIcon: StrNil(user.CountryIcon), CountryIcon: StrNil(user.CountryIcon),
Code: StrToString(&user.Code), Code: StrToString(&user.Code),
IsPrettyCode: user.IsPrettyCode(), IsPrettyCode: user.IsPrettyCode(),
IsNew: user.IsNew(),
IsVip: vips[user.ID] != nil, IsVip: vips[user.ID] != nil,
Noble: noble_cv.CvNoble{ Noble: noble_cv.CvNoble{
Level: nobles[user.ID].Level, Level: nobles[user.ID].Level,
......
...@@ -52,6 +52,11 @@ func (u User) IsPrettyCode() bool { ...@@ -52,6 +52,11 @@ func (u User) IsPrettyCode() bool {
return u.Code != u.OriginCode return u.Code != u.OriginCode
} }
// 七天内注册
func (u User) IsNew() bool {
return time.Now().Sub(u.CreatedTime).Hours() < 24*7
}
//获取用户 //获取用户
func GetUser(model *domain.Model, id mysql.ID) (*User, error) { func GetUser(model *domain.Model, id mysql.ID) (*User, error) {
var user User var user User
......
...@@ -285,6 +285,7 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID, ...@@ -285,6 +285,7 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID,
CountryIcon: StrNil(user.CountryIcon), CountryIcon: StrNil(user.CountryIcon),
Code: StrToString(&user.Code), Code: StrToString(&user.Code),
IsPrettyCode: user.IsPrettyCode(), IsPrettyCode: user.IsPrettyCode(),
IsNew: user.IsNew(),
IsVip: isVip, IsVip: isVip,
IsOfficialStaff: isOfficialStaff, IsOfficialStaff: isOfficialStaff,
VipExpireTime: vipExpireTime, VipExpireTime: vipExpireTime,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment