group_send_msg.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // GroupSendMsgAddReq 群发消息请求
  7. type GroupSendMsgAddReq struct {
  8. JumpType int8 `description:"跳转类型,1:h5;2:小程序;3:文字;4-图片"`
  9. LinkUrl string `description:"跳转地址,长度255"`
  10. ImgUrl string `description:"图片地址,长度255"`
  11. Title string `description:"标题,长度64"`
  12. Description string `description:"摘要"`
  13. Label string `description:"标签,多个标签用、隔开;长度255"`
  14. }
  15. // 群发消息
  16. type GroupSendMsg struct {
  17. MsgId int `orm:"column(msg_id);pk" description:"消息Id"`
  18. JumpType int8 `description:"跳转类型,1:h5;2:小程序;3:文字;4-图片"`
  19. LinkUrl string `description:"跳转地址"`
  20. ImgUrl string `description:"图片地址"`
  21. Title string `description:"标题"`
  22. Description string `description:"摘要"`
  23. Label string `description:"标签"`
  24. Status int8 `description:"发送结果,0:待发送,-1发送失败,1发送成功"`
  25. Remark string `description:"发送失败原因"`
  26. CreateTime time.Time `description:"发送时间"`
  27. }
  28. // 新增群发消息
  29. func (groupSendMsg *GroupSendMsg) Add() (err error) {
  30. o := orm.NewOrm()
  31. id, err := o.Insert(groupSendMsg)
  32. if err != nil {
  33. return
  34. }
  35. groupSendMsg.MsgId = int(id)
  36. return
  37. }
  38. // 修改群发消息
  39. func (groupSendMsg *GroupSendMsg) Update(cols []string) (err error) {
  40. o := orm.NewOrm()
  41. _, err = o.Update(groupSendMsg, cols...)
  42. return
  43. }