comein_white_user.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hongze_task/utils"
  5. )
  6. type ComeinWhiteUser struct {
  7. UserId int `orm:"column(user_id);pk"`
  8. Email string
  9. Mobile string // 手机号码
  10. CountryCode string // 区号
  11. IsFake int // 0为真 1为假
  12. }
  13. // 添加分类
  14. func AddComeinWhiteUserMulti(items []*ComeinWhiteUser) (err error) {
  15. o := orm.NewOrm()
  16. _, err = o.InsertMulti(2000, items)
  17. return
  18. }
  19. func GetComeinWhiteUserMulti() (items []*ComeinWhiteUser, err error) {
  20. sql:=`SELECT * from comein_white_user `
  21. o:=orm.NewOrm()
  22. _, err=o.Raw(sql).QueryRows(&items)
  23. return
  24. }
  25. func DelComeinWhiteUserMulti(delIds []int) (err error) {
  26. sql:=`DELETE from comein_white_user WHERE user_id IN (` + utils.GetOrmInReplace(len(delIds)) + `) `
  27. o:=orm.NewOrm()
  28. _, err=o.Raw(sql, delIds).Exec()
  29. return
  30. }
  31. func GetComeinWhiteUser(mobiles,emails string) (items []*ComeinWhiteUser, err error) {
  32. sql:=`SELECT * from comein_white_user WHERE 1=1 AND mobile IN (` + mobiles + `) `
  33. if emails != "" {
  34. sql+= ` OR email IN (` + emails + `) `
  35. }
  36. o:=orm.NewOrm()
  37. _, err=o.Raw(sql).QueryRows(&items)
  38. return
  39. }