eta_trial.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hongze_task/utils"
  5. )
  6. type ETATrialListRespItem struct {
  7. EtaTrialId int `orm:"column(eta_trial_id);pk" description:"eta试用客户id"`
  8. UserName string `description:"客户名称"`
  9. CompanyName string `description:"客户公司姓名"`
  10. Position string `description:"职位"`
  11. Mobile string `description:"手机号"`
  12. ActiveTime string `description:"累计活跃时长"`
  13. LastLoginTime string `description:"最后一次登陆时间"`
  14. SellerId int `description:"销售id"`
  15. Seller string `description:"销售员名称"`
  16. InterestModule string `description:"感兴趣模块"`
  17. Expiration int `description:"账号到期时长"`
  18. Enabled int `description:"1:有效,0:禁用"`
  19. IndexNum int `description:"累计添加指标"`
  20. ChartNum int `description:"累计添加图表"`
  21. Password string
  22. Account string
  23. CreateTime string
  24. ModifyTime string
  25. }
  26. func GetETATrialDisableList(endDate string) (items []*ETATrialListRespItem, err error) {
  27. o := orm.NewOrm()
  28. sql := `SELECT * FROM eta_trial WHERE modify_time < '`+endDate+`' `
  29. _, err = o.Raw(sql).QueryRows(&items)
  30. return
  31. }
  32. func UpdateETATrialDisable(disableIds []int) (err error) {
  33. o := orm.NewOrm()
  34. sql := `UPDATE eta_trial SET enabled = 0 WHERE eta_trial_id IN (` + utils.GetOrmInReplace(len(disableIds)) + `) `
  35. _, err = o.Raw(sql, disableIds, ).Exec()
  36. return
  37. }
  38. func UpdateETATrialAdminDisable(disableMobiles []string) (err error) {
  39. o := orm.NewOrmUsingDB("weekly_trial")
  40. sql := `UPDATE admin SET enabled = 0 WHERE mobile IN (` + utils.GetOrmInReplace(len(disableMobiles)) + `) `
  41. _, err = o.Raw(sql,disableMobiles).Exec()
  42. return
  43. }