package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxUserYanxuanPermission struct { UserYanxuanPermissionId int64 `orm:"column(user_yanxuan_permission_id);pk"` UserId int `description:"用户ID"` CompanyId int `description:"权限开始日期"` StartDate string `description:"权限开始日期"` EndDate string `description:"权限结束日期"` Status string `description:"'试用','未开通'"` Mobile string `description:"手机号"` Email string `description:"邮箱"` RealName string `description:"用户实际名称"` CompanyName string `description:"公司名称"` AdminId int `description:"后台添加人员ID"` AdminRealName string `description:"后台添加人员姓名"` CreatedTime time.Time `description:"创建时间"` LastUpdatedTime time.Time `description:"修改时间根据时间戳自动更新"` ModifyTime time.Time `description:"修改时间"` } type CygxUserYanxuanPermissionLog struct { UserYanxuanPermissionId int64 `orm:"column(user_yanxuan_permission_log_id);pk"` UserId int `description:"用户ID"` CompanyId int `description:"权限开始日期"` StartDate string `description:"权限开始日期"` EndDate string `description:"权限结束日期"` Status string `description:"'试用','未开通'"` Mobile string `description:"手机号"` Email string `description:"邮箱"` RealName string `description:"用户实际名称"` CompanyName string `description:"公司名称"` AdminId int `description:"后台添加人员ID"` AdminRealName string `description:"后台添加人员姓名"` CreatedTime time.Time `description:"创建时间"` LastUpdatedTime time.Time `description:"修改时间根据时间戳自动更新"` ModifyTime time.Time `description:"修改时间"` } // 根据用户ID获取是否开通过研选权限 func GetCygxUserYanxuanPermissionCountByUserId(userId int) (count int, err error) { o := orm.NewOrm() sql := ` SELECT COUNT(1) FROM cygx_user_yanxuan_permission WHERE status = '试用' AND user_id = ? ` err = o.Raw(sql, userId).QueryRow(&count) return } // 根据用户ID获取研选开通详情 func GetCygxUserYanxuanPermissionDetailByUserId(userId int) (item *CygxUserYanxuanPermission, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_user_yanxuan_permission WHERE status = '试用' AND user_id = ? ` err = o.Raw(sql, userId).QueryRow(&item) return }