english_report_email.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hongze_task/utils"
  5. "time"
  6. )
  7. // EnglishReportEmail 英文研报-邮箱/客户联系人
  8. type EnglishReportEmail struct {
  9. Id int `orm:"column(id);pk" description:"邮箱ID"`
  10. CompanyId int `description:"客户ID"`
  11. Name string `description:"联系人名称"`
  12. Email string `description:"邮箱地址"`
  13. Mobile string `description:"手机号"`
  14. CountryCode string `description:"区号,86、852、886等"`
  15. BusinessCardUrl string `description:"名片"`
  16. ViewTotal int `description:"累计点击量/阅读量"`
  17. LastViewTime time.Time `description:"最后阅读时间"`
  18. IsDeleted int `description:"删除状态:0-正常;1-已删除"`
  19. Enabled int `description:"邮箱状态:1:有效,0:禁用"`
  20. AdminId int `description:"创建人ID"`
  21. AdminName string `description:"创建人姓名"`
  22. Status int `description:"1:正式,2:临时,3:终止"`
  23. CompanyName string `description:"公司名称"`
  24. CreateTime time.Time `description:"创建时间"`
  25. ModifyTime time.Time `description:"更新时间"`
  26. RegisterTime time.Time `description:"注册时间"`
  27. }
  28. func (item *EnglishReportEmail) TableName() string {
  29. return "english_report_email"
  30. }
  31. func (item *EnglishReportEmail) Create() (err error) {
  32. o := orm.NewOrmUsingDB("rddp")
  33. id, err := o.Insert(item)
  34. if err != nil {
  35. return
  36. }
  37. item.Id = int(id)
  38. return
  39. }
  40. func (item *EnglishReportEmail) Update(cols []string) (err error) {
  41. o := orm.NewOrmUsingDB("rddp")
  42. _, err = o.Update(item, cols...)
  43. return
  44. }
  45. func GetEndEnglishReportEmailListByDate(endDate string) (items []*EnglishReportEmail, err error) {
  46. o := orm.NewOrmUsingDB("rddp")
  47. sql := `SELECT * FROM english_report_email WHERE register_time < '`+endDate+`' AND status = 2 `
  48. _, err = o.Raw(sql).QueryRows(&items)
  49. return
  50. }
  51. func UpdateEnglishReportEmailTermination(disableIds []int) (err error) {
  52. o := orm.NewOrmUsingDB("rddp")
  53. sql := `UPDATE english_report_email SET status = 3 WHERE id IN (` + utils.GetOrmInReplace(len(disableIds)) + `) `
  54. _, err = o.Raw(sql, disableIds, ).Exec()
  55. return
  56. }