diff --git a/cv/user_cv/user.go b/cv/user_cv/user.go index a795e1856e01ed7e8c19c88173173160d58276d0..82e053d1963ad14ed7b1d33f16bc7cfdb50e3a26 100644 --- a/cv/user_cv/user.go +++ b/cv/user_cv/user.go @@ -84,7 +84,8 @@ type CvUserBase struct { //邀请码 Code *string `json:"code"` IsPrettyCode bool `json:"isPrettyCode"` // 是否靓号 - IsLogout bool `json:"isLogout"` //是否注销 + IsNew bool `json:"isNew"` // 是否新用户 + IsLogout bool `json:"isLogout"` // 是否注销 //生日,如果是其它人用户信息,年龄则按照是否展示显示,如果是本人,年龄则按照是否存在展示 Birthday *uint64 `json:"birthday"` //是否展示年龄, 是本人才有数据,看其他用户均为nil @@ -201,6 +202,7 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error) CountryIcon: StrNil(user.CountryIcon), Code: StrToString(&user.Code), IsPrettyCode: user.IsPrettyCode(), + IsNew: user.IsNew(), IsVip: vips[user.ID] != nil, IsOfficialStaff: superManagerMap[user.ID], Medals: IfLogoutMedals(IfLogout(user.LogoutTime), []uint32{}, medals[user.ID]), @@ -301,6 +303,7 @@ func GetUserBasesForCp(userIds []mysql.ID) ([]*CvUserBase, error) { CountryIcon: StrNil(user.CountryIcon), Code: StrToString(&user.Code), IsPrettyCode: user.IsPrettyCode(), + IsNew: user.IsNew(), IsVip: vips[user.ID] != nil, Noble: noble_cv.CvNoble{ Level: nobles[user.ID].Level, diff --git a/domain/model/user_m/user.go b/domain/model/user_m/user.go index a9863ca6b8fb8f8a37d1fb5c88534eb9ac64b101..afdf3179554aff45671b7cae63df6b8b2914dd86 100755 --- a/domain/model/user_m/user.go +++ b/domain/model/user_m/user.go @@ -52,6 +52,11 @@ func (u User) IsPrettyCode() bool { 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) { var user User diff --git a/domain/service/user_s/user.go b/domain/service/user_s/user.go index de797c426c033239e7d75d418e94481f67b4c48e..fd67094d0a8f575b0af1f98a7677347600ea7ffe 100644 --- a/domain/service/user_s/user.go +++ b/domain/service/user_s/user.go @@ -285,6 +285,7 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID, CountryIcon: StrNil(user.CountryIcon), Code: StrToString(&user.Code), IsPrettyCode: user.IsPrettyCode(), + IsNew: user.IsNew(), IsVip: isVip, IsOfficialStaff: isOfficialStaff, VipExpireTime: vipExpireTime,