activity_remind.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package yb
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // ActivityRemind 活动会议提醒表
  7. type ActivityRemind struct {
  8. ActivityRemindId int `orm:"column(activity_remind_id);pk" description:"活动提醒ID"`
  9. ActivityId int `description:"活动ID"`
  10. UserId int `description:"微信用户表ID"`
  11. CompanyId int `description:"客户id"`
  12. RealName string `description:"用户实际名称"`
  13. Mobile string `description:"用户手机号"`
  14. //RegisterState int8 `description:"报名状态 0-取消报名 1-已报名"`
  15. CreateTime time.Time `description:"创建时间"`
  16. }
  17. // TableName 表名变更
  18. func (activityRemind *ActivityRemind) TableName() string {
  19. return "yb_activity_remind"
  20. }
  21. // GetAllActivityRemindListByActivityId 根据活动id获取所有的提醒用户
  22. func GetAllActivityRemindListByActivityId(activityId int) (list []*ActivityRemind, err error) {
  23. o := orm.NewOrm()
  24. sql := "select * from yb_activity_remind where activity_id = ? "
  25. sql += ` order by activity_remind_id asc ` //按照预约时间正序
  26. _, err = o.Raw(sql, activityId).QueryRows(&list)
  27. return
  28. }
  29. // Update 更新活动报名
  30. func (activityRemind *ActivityRemind) Update(cols []string) (err error) {
  31. o := orm.NewOrm()
  32. _, err = o.Update(activityRemind, cols...)
  33. return
  34. }
  35. // DelActivityReminds 根据活动ID清除所有提醒
  36. func DelActivityReminds(activityId int) (err error) {
  37. o := orm.NewOrm()
  38. sql := "DELETE FROM yb_activity_remind WHERE activity_id = ?"
  39. _, err = o.Raw(sql, activityId).Exec()
  40. return
  41. }