notify.go 925 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package dao
  2. import (
  3. "context"
  4. "time"
  5. "go-common/app/admin/main/workflow/model/param"
  6. "go-common/app/job/main/workflow/model"
  7. "go-common/library/ecode"
  8. "go-common/library/queue/databus/report"
  9. )
  10. // SendMessage .
  11. func (d *Dao) SendMessage(c context.Context, chs []*model.ChallRes, msg *param.MessageParam) (err error) {
  12. params := msg.Query()
  13. var res struct {
  14. Code int `json:"code"`
  15. }
  16. if err = d.httpSearch.Post(c, d.messageURL, "", params, &res); err != nil {
  17. return
  18. }
  19. if res.Code != 0 {
  20. err = ecode.Int(res.Code)
  21. return
  22. }
  23. for _, ch := range chs {
  24. report.Manager(&report.ManagerInfo{
  25. UID: 2233,
  26. Uname: "",
  27. Business: 11,
  28. Type: 2,
  29. Oid: ch.OID,
  30. Ctime: time.Now(),
  31. Action: "notify_users_received",
  32. Content: map[string]interface{}{
  33. "mid": ch.MID,
  34. "message": "zhoushuguang",
  35. },
  36. Index: []interface{}{ch.ID, ch.GID, ch.MID},
  37. })
  38. }
  39. return
  40. }