package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type YanXuanActivityPointsRedis struct { UserId int `description:"用户ID"` ComapnyId int `description:"公司ID"` ActivityId int `description:"活动ID"` PublishStatus int `description:"发布状态 1已发布,0未发布"` SourceType int `description:"1:报名、 2:取消报名、3:活动编辑、4:活动发布,取消发布、5:活动到会。"` AdminId int `description:"管理员、销售ID"` Source int `description:" 来源,1客户端,2后台添加, 3开发人员手动添加、4定时任务"` RegisterPlatform int `description:"来源 1小程序,2:网页"` CreateTime time.Time `description:"创建时间"` } type CygxActivityPointsSet struct { Id int `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"` ActivityId int `gorm:"column:activity_id;NOT NULL" json:"activity_id"` // 活动ID PointsObject int `gorm:"column:points_object;default:1;NOT NULL" json:"points_object"` // 扣点对象,1:参会人、2:办会人、3:办会人和参会人 CompanyId int `gorm:"column:company_id;default:0;NOT NULL" json:"company_id"` // 公司ID CompanyName float64 `gorm:"column:company_name;NOT NULL" json:"company_name"` // 公司名称 UserPointsNum float64 `gorm:"column:user_points_num;default:0;NOT NULL" json:"user_points_num"` // 参会人扣点数量 PointsType int `gorm:"column:points_type;default:0;NOT NULL" json:"points_type"` // 扣点形式,1:报名即扣点,2:到会即扣点 CompanyPointsNum float64 `gorm:"column:company_points_num;default:0;NOT NULL" json:"company_points_num"` // 办会人扣点数量 CancelDeadlineType int `description:"取消报名截止时间类型,0:不设置,1:同报名截止时间, 2:24小时之前、3:48小时之前"` CreateTime time.Time `gorm:"column:create_time;NOT NULL" json:"create_time"` // 创建时间 ModifyTime time.Time `gorm:"column:modify_time;NOT NULL" json:"modify_time"` // 更新时间 } // 通过活动ID获取详情 func GetCygxActivityPointsSetDetail(activityId int) (item *CygxActivityPointsSet, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_points_set WHERE activity_id=? ` err = o.Raw(sql, activityId).QueryRow(&item) return } // 通过活动ID获取详情 func GetCygxActivityPointsSetUserNum(activityId int) (userPointsNum float64, err error) { o := orm.NewOrm() sql := `SELECT user_points_num FROM cygx_activity_points_set WHERE activity_id=? ` err = o.Raw(sql, activityId).QueryRow(&userPointsNum) return } // 通过互动ID获取数量 func GetCygxActivityPointsSetCountByActivityId(ActivityId int) (count int, err error) { sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity_points_set WHERE activity_id=? ` o := orm.NewOrm() err = o.Raw(sqlCount, ActivityId).QueryRow(&count) return } // 列表 func GetCygxActivityPointsSetList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityPointsSet, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_points_set as art WHERE 1= 1 ` if condition != "" { sql += condition } if startSize+pageSize == 0 { _, err = o.Raw(sql, pars).QueryRows(&items) } else { sql += ` LIMIT ?,? ` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) } return }