package models import ( "github.com/beego/beego/v2/client/orm" "hongze/hongze_task/utils" ) type ComeinWhiteUser struct { UserId int `orm:"column(user_id);pk"` Email string Mobile string // 手机号码 CountryCode string // 区号 IsFake int // 0为真 1为假 } // 添加分类 func AddComeinWhiteUserMulti(items []*ComeinWhiteUser) (err error) { o := orm.NewOrm() _, err = o.InsertMulti(2000, items) return } func GetComeinWhiteUserMulti() (items []*ComeinWhiteUser, err error) { sql:=`SELECT * from comein_white_user ` o:=orm.NewOrm() _, err=o.Raw(sql).QueryRows(&items) return } func DelComeinWhiteUserMulti(delIds []int) (err error) { sql:=`DELETE from comein_white_user WHERE user_id IN (` + utils.GetOrmInReplace(len(delIds)) + `) ` o:=orm.NewOrm() _, err=o.Raw(sql, delIds).Exec() return } func GetComeinWhiteUser(mobiles,emails string) (items []*ComeinWhiteUser, err error) { sql:=`SELECT * from comein_white_user WHERE 1=1 AND mobile IN (` + mobiles + `) ` if emails != "" { sql+= ` OR email IN (` + emails + `) ` } o:=orm.NewOrm() _, err=o.Raw(sql).QueryRows(&items) return }