1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package models
- import (
- "eta_gn/eta_report/global"
- "time"
- )
- // EnglishCompany 英文客户
- type EnglishCompany struct {
- CompanyId int `gorm:"primaryKey;autoIncrement;column:company_id"`
- CompanyName string `gorm:"column:company_name" description:"客户名称"`
- CountryCode string `gorm:"column:country_code" description:"国家Code"`
- Country string `gorm:"column:country" description:"国家"`
- SellerId int `gorm:"column:seller_id" description:"销售ID"`
- SellerName string `gorm:"column:seller_name" description:"销售姓名"`
- ViewTotal int `gorm:"column:view_total" description:"累计点击量/阅读量"`
- IsDeleted int `gorm:"column:is_deleted" description:"删除状态:0-正常;1-已删除"`
- CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
- ModifyTime time.Time `gorm:"column:modify_time" description:"更新时间"`
- }
- func (item *EnglishCompany) TableName() string {
- return "english_company"
- }
- func (item *EnglishCompany) Create() (err error) {
- err = global.DEFAULT_DmSQL.Create(item).Error
- return
- }
- // EnglishCompanySaveReq 英文客户-保存请求体
- type EnglishCompanySaveReq struct {
- CompanyId int `description:"客户ID"`
- CompanyName string `description:"客户名称"`
- CountryCode string `description:"国家代码"`
- Country string `description:"国家"`
- SellerId int `description:"销售ID"`
- }
- func (item *EnglishCompany) Update(cols []string) (err error) {
- err = global.DEFAULT_DmSQL.Model(item).Select(cols).Updates(item).Error
- return
- }
- // UpdateEnglishCompanyViewTotal 更新英文客户阅读量
- func UpdateEnglishCompanyViewTotal(companyId int) (err error) {
- sql := `UPDATE english_company SET view_total = view_total+1 WHERE company_id = ? `
- err = global.DEFAULT_DmSQL.Exec(sql, companyId).Error
- return
- }
- // UpdateTrialEnglishCompanyViewTotal 更新英文客户阅读量-ETA试用平台
- func UpdateTrialEnglishCompanyViewTotal(companyId int) (err error) {
- sql := `UPDATE english_company SET view_total = view_total+1 WHERE company_id = ? `
- err = global.DEFAULT_DmSQL.Exec(sql, companyId).Error
- return
- }
|