handler.go 878 字节
package event

import (
	"github.com/gookit/event"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/event/command"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/event/service"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
)

func tableDataChangeHandler(e event.Event) error {
	et := &domain.EventTable{}
	et.ResolveEvent(e)
	svr := service.NewTableEventService(nil)
	// 此处优先处理冲突状态更新(后续删除更新缓存比较慢)
	svr.HandlerTableAffectedMarkToConflictStatus(et.Context, &command.TableEventCommand{
		EventTable: et,
	})

	_, err := svr.Handler(nil, &command.TableEventCommand{
		EventTable: et,
	})

	_, err = svr.DigitalPlatformEventSubscribe(nil, &command.TableEventCommand{
		EventTable: et,
	})
	return err
}