|
@@ -0,0 +1,63 @@
|
|
|
+package models
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "hongze/hongze_task/utils"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+// EnglishReportEmail 英文研报-邮箱/客户联系人
|
|
|
+type EnglishReportEmail struct {
|
|
|
+ Id int `orm:"column(id);pk" description:"邮箱ID"`
|
|
|
+ CompanyId int `description:"客户ID"`
|
|
|
+ Name string `description:"联系人名称"`
|
|
|
+ Email string `description:"邮箱地址"`
|
|
|
+ Mobile string `description:"手机号"`
|
|
|
+ CountryCode string `description:"区号,86、852、886等"`
|
|
|
+ BusinessCardUrl string `description:"名片"`
|
|
|
+ ViewTotal int `description:"累计点击量/阅读量"`
|
|
|
+ LastViewTime time.Time `description:"最后阅读时间"`
|
|
|
+ IsDeleted int `description:"删除状态:0-正常;1-已删除"`
|
|
|
+ Enabled int `description:"邮箱状态:1:有效,0:禁用"`
|
|
|
+ AdminId int `description:"创建人ID"`
|
|
|
+ AdminName string `description:"创建人姓名"`
|
|
|
+ Status int `description:"1:正式,2:临时,3:终止"`
|
|
|
+ CompanyName string `description:"公司名称"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"更新时间"`
|
|
|
+ RegisterTime time.Time `description:"注册时间"`
|
|
|
+}
|
|
|
+
|
|
|
+func (item *EnglishReportEmail) TableName() string {
|
|
|
+ return "english_report_email"
|
|
|
+}
|
|
|
+
|
|
|
+func (item *EnglishReportEmail) Create() (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ id, err := o.Insert(item)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item.Id = int(id)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (item *EnglishReportEmail) Update(cols []string) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ _, err = o.Update(item, cols...)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func GetEndEnglishReportEmailListByDate(endDate string) (items []*EnglishReportEmail, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM english_report_email WHERE register_time < '`+endDate+`' `
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func UpdateEnglishReportEmailTermination(disableIds []int) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `UPDATE english_report_email SET status = 3 WHERE id IN (` + utils.GetOrmInReplace(len(disableIds)) + `) `
|
|
|
+ _, err = o.Raw(sql, disableIds, ).Exec()
|
|
|
+ return
|
|
|
+}
|