Commit a80e1c20 authored by hujiebin's avatar hujiebin

推全部获取家族成员

parent 46d29706
......@@ -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
}
......@@ -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
})
}
......
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