package group_m import ( "encoding/json" "hilo-user/_const/enum/group_e" "hilo-user/domain" "hilo-user/domain/model/noble_m" "hilo-user/domain/model/user_m" "hilo-user/rpc" ) // 信令消息 type GroupSystemMsg struct { MsgId group_e.TypeSignalMsg `json:"msgId"` Source string `json:"source"` Target string `json:"target"` Content string `json:"content"` } type HiloUserInfo struct { WealthGrade uint32 `json:"wealthGrade"` CharmGrade uint32 `json:"charmGrade"` IsVip bool `json:"isVip"` IsPretty bool `json:"isPretty"` Medals []uint32 `json:"medals"` PowerName string `json:"powerName"` // 用户加入的国家势力的绑定群组的名称 NobleLevel uint16 `json:"nobleLevel"` SvipLevel int `json:"svipLevel"` } var GetGroupPowerNameByUserId func(model *domain.Model, userId uint64) (uint64, string, error) //不用返回错误 func GetHiloUserInfo(model *domain.Model, extId string) string { user, err := user_m.GetUserByExtId(model, extId) if err != nil { model.Log.Errorf("extId:%v, err:%+v", extId, err) return "" } wealthGrade, _, err := user_m.GetWealthGrade(model, user.ID) if err != nil { model.Log.Errorf("extId:%v, err:%v", extId, err) return "" } charmGrade, _, err := user_m.GetCharmGrade(model, user.ID) if err != nil { model.Log.Errorf("extId:%v, err:%v", extId, err) return "" } isVip, _, err := user_m.IsVip(user.ID) if err != nil { model.Log.Errorf("extId:%v, err:%v", extId, err) return "" } // isPretty := user.IsPrettyCode() // medals, err := user_m.GetUserMedalMerge(model.Log, model.Db, user.ID) if err != nil { model.Log.Errorf("extId:%v, err:%v", extId, err) return "" } _, powerName, err := GetGroupPowerNameByUserId(model, user.ID) if err != nil { model.Log.Errorf("extId:%v, err:%v", extId, err) return "" } nobleLevel, err := noble_m.GetNobleLevel(model.Db, user.ID) if err != nil { model.Log.Errorf("extId:%v, err:%v", extId, err) return "" } svip, _ := rpc.GetUserSvip(model, user.ID) hilo := HiloUserInfo{ WealthGrade: wealthGrade, CharmGrade: charmGrade, IsVip: isVip, IsPretty: isPretty, Medals: medals, PowerName: powerName, NobleLevel: nobleLevel, SvipLevel: svip.SvipLevel, } buf, err := json.Marshal(hilo) if err != nil { model.Log.Errorf("hilo:%+v, err:%v", hilo, err) } return string(buf) }