send_gift.go 1.38 KB
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
package gift_ev

import (
	"git.hilo.cn/hilo-common/domain"
	"git.hilo.cn/hilo-common/resource/mysql"
	"hilo-group/_const/enum/gift_e"
)

var sendGiftListen = new(domain.EventBase)

// 送礼事件
type SendGiftEvent struct {
	SendUserId       mysql.ID
	ReceiveUserIds   []mysql.ID
	ResGift          EventResGift
	GiftOperateIds   []mysql.ID
	GiftN            mysql.Num
	SceneType        gift_e.GiftOperateSceneType
	SceneUid         mysql.Str
	NoDiamondConsume bool   // 不要消费钻石
	TotalConsume     uint64 // 房间的总消费额
}

type EventResGift struct {
	ID                mysql.ID
	Name              mysql.Str
	IconUrl           mysql.Str
	SvgaUrl           mysql.Str
	MusicUrl          mysql.Str
	DiamondNum        mysql.Num
	BeanNum           mysql.Num
	ReceiveDiamondNum mysql.Num
	Second            mysql.Num
	N                 mysql.Num
	GroupBroadcast    bool
	Cp                bool
	Together          bool
	Status            mysql.UserYesNo
	GiftType          mysql.Type
}

func AddSendGiftEventSync(callback func(model *domain.Model, event interface{}) error) {
	domain.AddEventSync(sendGiftListen, callback)
}

func AddSendGiftEventAsync(callback func(model *domain.Model, event interface{}) error) {
	domain.AddEventAsync(sendGiftListen, callback)
}

func PublishSendGiftEvent(model *domain.Model, event interface{}) error {
	return domain.PublishEvent(sendGiftListen, model, event)
}