package event_s import ( "git.hilo.cn/hilo-common/domain" "hilo-user/domain/event/gift_ev" "hilo-user/domain/model/cp_m" ) // 送礼增加cp值 func CpLevelEvent() { gift_ev.AddSendGiftEventAsync(func(model *domain.Model, event interface{}) error { sendGiftEvent, ok := event.(*gift_ev.SendGiftEvent) if !ok { model.Log.Errorf("AddSendGiftEventAsync event type err") return nil } for _, receiverUid := range sendGiftEvent.ReceiveUserIds { diamonds := sendGiftEvent.GiftN * sendGiftEvent.ResGift.DiamondNum // 有cp关系 if cpRelation, exits := cp_m.GetCpRelation(model, sendGiftEvent.SendUserId, receiverUid); exits { return cp_m.AddCpLevelPoints(model, cpRelation, diamonds) // 业务场景允许提前break(cp是唯一的) } } return nil }) }