databus.go 917 B

123456789101112131415161718192021222324252627282930313233
  1. package dao
  2. import (
  3. "context"
  4. "strconv"
  5. "go-common/app/service/main/push/model"
  6. "go-common/library/log"
  7. )
  8. // PubReport add report to databus.
  9. func (d *Dao) PubReport(c context.Context, info *model.Report) (err error) {
  10. if err = d.reportPub.Send(c, info.Buvid, info); err != nil {
  11. PromError("databus:发送上报的设备信息")
  12. log.Error("d.reportPub.Send(%+v) error(%v)", info, err)
  13. return
  14. }
  15. PromInfo("databus:发送上报的设备信息")
  16. log.Info("PubReport(%+v) success.", info)
  17. return
  18. }
  19. // PubCallback add push arrive/click callback to databus.
  20. func (d *Dao) PubCallback(c context.Context, v []*model.Callback) (err error) {
  21. if err = d.callbackPub.Send(c, strconv.Itoa(len(v)), v); err != nil {
  22. PromError("databus:发送callback")
  23. log.Error("d.callbackPub.Send(%+v) error(%v)", v, err)
  24. return
  25. }
  26. PromInfo("databus:发送callback")
  27. log.Info("PubCallback(%+v) success.", v)
  28. return
  29. }