123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- package cygx
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type YanXuanActivityPointsRedis struct {
- UserId int `description:"用户ID"`
- ComapnyId int `description:"公司ID"`
- CompanyContractId 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 string `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 string `gorm:"column:company_name;NOT NULL" json:"company_name"` // 公司名称
- UserPointsNum string `gorm:"column:user_points_num;default:0;NOT NULL" json:"user_points_num"` // 参会人扣点数量
- PointsType string `gorm:"column:points_type;default:0;NOT NULL" json:"points_type"` // 扣点形式,1:报名即扣点,2:到会即扣点
- CompanyPointsNum string `gorm:"column:company_points_num;default:0;NOT NULL" json:"company_points_num"` // 办会人扣点数量
- CancelDeadlineType string `gorm:"column:cancel_deadline_type;default:0;NOT NULL" json:"cancel_deadline_type"` // 取消报名截止时间类型,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"` // 更新时间
- }
- type CygxActivityPointsSetRsq struct {
- ActivityId int `gorm:"column:activity_id;NOT NULL" json:"ActivityId"` // 活动ID
- PointsObject string `gorm:"column:points_object;NOT NULL" json:"PointsObject"` // 扣点对象,1:参会人、2:办会人、3:办会人和参会人
- CompanyId int `gorm:"column:company_id;default:0;NOT NULL" json:"CompanyId"` // 公司ID
- CompanyName string `gorm:"column:company_name;NOT NULL" json:"CompanyName"` // 公司名称
- UserPointsNum string `gorm:"column:user_points_num;default:0;NOT NULL" json:"UserPointsNum"` // 参会人扣点数量
- PointsType string `gorm:"column:points_type;default:0;NOT NULL" json:"PointsType"` // 扣点形式,1:报名即扣点,2:到会即扣点
- CompanyPointsNum string `gorm:"column:company_points_num;default:0;NOT NULL" json:"CompanyPointsNum"` // 办会人扣点数量
- CancelDeadlineType string `description:"取消报名截止时间类型,0:不设置,1:同报名截止时间, 2:24小时之前、3:48小时之前"`
- }
- type CygxActivityPointsSetConfigListResp struct {
- List []*CygxActivityPointsSetConfigResp
- }
- type CygxActivityPointsSetConfigResp struct {
- PointsNum string `gorm:"column:user_points_num;default:0;NOT NULL" json:"PointsNum"` // 扣点数量
- }
- // 通过活动ID获取详情
- func GetCygxActivityPointsSetDetail(activityId int) (item *CygxActivityPointsSetRsq, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- 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.NewOrmUsingDB("hz_cygx")
- 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.NewOrmUsingDB("hz_cygx")
- err = o.Raw(sqlCount, ActivityId).QueryRow(&count)
- return
- }
- type CygxActivitySearcCompanyListResp struct {
- List []*CygxActivitySearcCompanyResp
- }
- type CygxActivitySearcCompanyResp struct {
- CompanyId int `description:"公司ID"`
- CompanyName string `description:"公司名称"`
- RealName string `description:"用户实际名称"`
- AdminId int `description:"销售/管理员ID"`
- }
- // 搜索权益机构名称以及管理的销售
- func GetCygxActivitySearcCompanyList(companyName string) (items []*CygxActivitySearcCompanyResp, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- c.company_id,
- c.company_name,
- a.admin_id,
- a.real_name
- FROM
- company AS c
- INNER JOIN company_product AS p ON p.company_id = c.company_id
- INNER JOIN admin AS a ON a.admin_id = p.seller_id
- WHERE
- 1 = 1
- AND p.product_id = 2
- AND c.company_name LIKE '%` + companyName + `%' `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
|