package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxActivitySpecialTripBill struct { Id int `orm:"column(id);pk"` UserId int `description:"用户id,多个用,隔开"` ActivityId int `description:"活动ID"` CreateTime time.Time `description:"创建时间"` Mobile string `description:"手机号"` Email string `description:"邮箱号"` CompanyId int `description:"公司ID"` CompanyName string `description:"公司名称"` RealName string `description:"用户实际名称"` AdminId int `description:"销售/管理员ID"` Source int `description:"来源,1小程序,2后台添加, 3开发人员手动添加"` BillDetailed int `description:"流水明细,判断是进账还是出账"` DoType int `description:"操作方式,1报名,2取消报名"` RegisterPlatform int `description:"来源 1小程序,2:网页"` ChartPermissionId int `description:"行业id"` ChartPermissionName string `description:"行业名称"` Way int `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"` Content string `description:"内容"` Total string `description:"总和"` } // 添加 func AddCygxActivitySpecialTripBill(item *CygxActivitySpecialTripBill) (err error) { o := orm.NewOrm() _, err = o.Insert(item) if err != nil { return } return } func GetCygxActivitySpecialTripBill(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBill, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_special_trip_bill WHERE 1 = 1 ` + condition _, err = o.Raw(sql, pars).QueryRows(&item) return } type CygxActivitySpecialTripBillList struct { Id int `orm:"column(id);pk"` UserId int `description:"用户id,多个用,隔开"` ActivityId int `description:"活动ID"` CreateTime time.Time `description:"创建时间"` Mobile string `description:"手机号"` Email string `description:"邮箱号"` CompanyId int `description:"公司ID"` CompanyName string `description:"公司名称"` RealName string `description:"用户实际名称"` AdminId int `description:"销售/管理员ID"` Source int `description:"来源,1小程序,2后台添加, 3开发人员手动添加"` BillDetailed int `description:"流水明细,判断是进账还是出账"` DoType int `description:"操作方式,1报名,2取消报名"` RegisterPlatform int `description:"来源 1小程序,2:网页"` ChartPermissionId int `description:"行业id"` ChartPermissionName string `description:"行业名称"` Way int `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"` Content string `description:"内容"` } func GetCygxActivitySpecialTripBillList(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillList, err error) { o := orm.NewOrm() sql := `SELECT b.* FROM cygx_activity_special_trip_bill AS b WHERE 1 = 1` + condition _, err = o.Raw(sql, pars).QueryRows(&item) return } // GetCygxActivitySpecialTripBillLastDetialByActivityId 根据活动ID获取最后一条扣点明细 func GetCygxActivitySpecialTripBillLastDetialByActivityId(activityId, userId int) (item *CygxActivitySpecialTripBill, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_special_trip_bill WHERE 1 = 1 AND activity_id =? AND user_id = ? ORDER BY id DESC LIMIT 1 ` err = o.Raw(sql, activityId, userId).QueryRow(&item) return }