12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- // 报名
- type CygxActivityOfflineMeetingDetail 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:"公司名称"`
- IsMeeting int `description:"是否到会 1.是 ,0否"`
- SigninTime string `description:"签到时间"`
- }
- // 列表
- func GetOfflineMeetingList(condition string, pars []interface{}) (items []*CygxActivitySignupList, err error) {
- o := orm.NewOrm()
- sql := `SELECT *
- FROM cygx_activity_offline_meeting_detail WHERE 1 =1 ` + condition
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- // 批量添加
- func AddCygxActivityOfflineMeetingDetailList(items []*CygxActivityOfflineMeetingDetail) (lastId int64, err error) {
- lenitems := len(items)
- if lenitems == 0 {
- return
- }
- o := orm.NewOrm()
- _, err = o.InsertMulti(1, items)
- return
- }
- // 添加
- func AddCygxActivityOfflineMeetingDetail(item *CygxActivityOfflineMeetingDetail) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(item)
- return
- }
- // 获取数量
- func GetCygxActivityOfflineMeetingDetailCount(condition string, pars []interface{}) (count int, err error) {
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity_offline_meeting_detail as art WHERE 1= 1 `
- if condition != "" {
- sqlCount += condition
- }
- o := orm.NewOrm()
- err = o.Raw(sqlCount, pars).QueryRow(&count)
- return
- }
- // UpdateCygxActivityOfflineMeetingDetailSigninTime 修改签到时间
- func UpdateCygxActivityOfflineMeetingDetailSigninTime(activityId, userId int) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE cygx_activity_offline_meeting_detail SET signin_time = NOW() ,is_meeting = 1 WHERE activity_id = ? AND user_id = ? `
- _, err = o.Raw(sql, activityId, userId).Exec()
- return
- }
- // 报名
- type CygxActivityOfflineMeetingDetailResp struct {
- ActivityId int `description:"活动ID "`
- ActivityName string `description:"活动名称"`
- List []*CygxActivitySignupResp
- }
|