http.go 758 B

1234567891011121314151617181920212223242526272829303132
  1. package dao
  2. import (
  3. "context"
  4. "net/url"
  5. "go-common/library/log"
  6. "github.com/pkg/errors"
  7. )
  8. const (
  9. couponSystemNotify = "4"
  10. couponMC = "10_99_1"
  11. sendMessage = "/api/notify/send.user.notify.do"
  12. )
  13. //SendMessage send message.
  14. func (d *Dao) SendMessage(c context.Context, mids, title, content, ip string) (err error) {
  15. params := url.Values{}
  16. params.Set("mc", couponMC)
  17. params.Set("title", title)
  18. params.Set("context", content)
  19. params.Set("data_type", couponSystemNotify)
  20. params.Set("mid_list", mids)
  21. if err = d.client.Post(c, d.c.Prop.MessageURL+sendMessage, ip, params, nil); err != nil {
  22. err = errors.WithStack(err)
  23. }
  24. log.Info("send message url:%+v params:%+v err:%+v", d.c.Prop.MessageURL+sendMessage, params, err)
  25. return
  26. }