diff --git a/domain/model/groupPower_m/group_info.go b/domain/model/groupPower_m/group_info.go index 2040ac8d9c80f3bdcae2a6f4b1fca2b0fbc55ff8..e0feaba0edec61b0b3d202304b721f57822e600b 100644 --- a/domain/model/groupPower_m/group_info.go +++ b/domain/model/groupPower_m/group_info.go @@ -46,3 +46,12 @@ func MGetGroupPowerUsers(model *domain.Model, groupPowerIds []mysql.ID) (map[mys } return res, nil } + +// 获取家族成员 +func GetGroupPowerUser(model *domain.Model, groupPowerId mysql.ID) ([]*GroupPowerUser, error) { + m, err := MGetGroupPowerUsers(model, []mysql.ID{groupPowerId}) + if err != nil { + return nil, err + } + return m[groupPowerId], nil +} diff --git a/domain/service/event_s/event_init.go b/domain/service/event_s/event_init.go index 2830a9099915c11bac66ebf7dfd3d4692aab7bcf..4936fc1cab5b532dfd98451325646a982b6bf5cc 100644 --- a/domain/service/event_s/event_init.go +++ b/domain/service/event_s/event_init.go @@ -170,20 +170,25 @@ func GroupPowerEvents() { return nil } model.Log.Infof("msg AddGroupPowerUpgradeAsync GroupPowerId:%v", event.GroupPowerId) - //获取势力主 - mgrUserId, err := groupPower_m.GetGroupPowerMgr(model, event.GroupPowerId) + users, err := groupPower_m.GetGroupPowerUser(model, event.GroupPowerId) if err != nil { return err } - mgrUser, err := user_m.GetUser(model, mgrUserId) + var userIds []mysql.ID + for _, u := range users { + userIds = append(userIds, u.UserId) + } + userMaps, err := user_m.GetUserMapByIds(model, userIds) if err != nil { return err } - if err := msg_m.NewUserRecord(model, mgrUserId, msg_e.GroupPowerUpgrade, "", 0, "", "", "", "", "").Persistent(); err != nil { - model.Log.Errorf("msg AddGroupPowerLeaveAsync NewUserRecord err:%v", err) - return nil + for uid, u := range userMaps { + if err := msg_m.NewUserRecord(model, uid, msg_e.GroupPowerUpgrade, "", 0, "", "", "", "", "").Persistent(); err != nil { + model.Log.Errorf("msg AddGroupPowerLeaveAsync NewUserRecord err:%v", err) + return nil + } + msg_m.SendEmasMsgAssistant(model, u.ExternalId, u.DeviceType) } - msg_m.SendEmasMsgAssistant(model, mgrUser.ExternalId, mgrUser.DeviceType) return nil }) }