task.go 791 B

12345678910111213141516171819202122232425
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/interface/live/push-live/model"
  5. "go-common/library/log"
  6. "github.com/pkg/errors"
  7. )
  8. const (
  9. _createNewTask = "INSERT INTO ap_push_task(type,target_id,alert_title,alert_body,mid_source,link_type,link_value,expire_time,total) VALUES (?,?,?,?,?,?,?,?,?)"
  10. )
  11. // CreateNewTask 新增推送任务记录
  12. func (d *Dao) CreateNewTask(c context.Context, task *model.ApPushTask) (affected int64, err error) {
  13. res, err := d.db.Exec(c, _createNewTask, model.LivePushType, task.TargetID, task.AlertTitle,
  14. task.AlertBody, task.MidSource, task.LinkType, task.LinkValue, task.ExpireTime, task.Total)
  15. if err != nil {
  16. err = errors.WithStack(err)
  17. log.Error("[dao.task|CreateNewTask] db.Exec() error(%v)", err)
  18. return
  19. }
  20. return res.RowsAffected()
  21. }