123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- package models
- import (
- //"fmt"
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- )
- // 专项调研活动列表
- type CygxActivitySpecialDetail struct {
- ActivityId int `description:"活动ID "`
- ActivityTypeName string `description:"活动名称"`
- SpecialType int `description:"调研形式、 1 线上 , 2 线下"`
- City string `description:"调研城市"`
- ChartPermissionName string `description:"行业名称"`
- ChartPermissionId int `description:"行业Id"`
- ResearchTheme string `description:"调研主题"`
- ActivityTimeText string `description:"活动预期时间带文字"`
- TripImgLink string `description:"行程图片链接"`
- IsSignup int `description:"是否感兴趣 1是 ,0 否"`
- Label string `description:"主题标签"`
- ImgUrl string `description:"图片链接"`
- ImgUrlText string `description:"图片链接文字"`
- IndustrialName string `description:"产业名称"`
- IndustrialSubjectName string `description:"标的名称(相关公司)"`
- Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
- CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"`
- IsTrip int `description:"是否报名 1是 ,0 否"`
- TripNum int `description:"已报名人数"`
- Days int `description:"调研天数"`
- Host string `description:"主持人"`
- PersonInCharge string `description:"纪要负责人"`
- LimitPeopleNum int `description:"限制人数数量"`
- TripImgLinkFix string `description:"确定行程之后的图片链接"`
- ActivityTimeTextByDay string `description:"活动预期时间带周日"`
- ActivityTime string `description:"活动预期时间"`
- ActivityTimeEnd string `description:"活动预期结束时间"`
- ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
- TripStatus int `description:"行程进行状态 1:预报名,2:确定行程"`
- Explain string `description:"说明"`
- AdminId int `description:"管理员ID"`
- ShareImg string `description:"分享图片"`
- }
- // 获取数量
- func GetActivitySpecialCount(condition string, pars []interface{}) (count int, err error) {
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity_special as art WHERE 1= 1 `
- if condition != "" {
- sqlCount += condition
- }
- o := orm.NewOrm()
- err = o.Raw(sqlCount, pars).QueryRow(&count)
- return
- }
- // 主题列表
- func GetActivitySpecialListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivitySpecialDetail, err error) {
- o := orm.NewOrm()
- sql := `SELECT *
- FROM cygx_activity_special as art WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- sql += ` ORDER BY art.last_updated_time DESC LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
- return
- }
- // 修改发布状态
- func UpdateActivitySpecialPublishStatus(publishStatus, activityId int) (err error) {
- sql := ` UPDATE cygx_activity_special SET publish_status= ? WHERE activity_id = ?`
- o := orm.NewOrm()
- _, err = o.Raw(sql, publishStatus, activityId).Exec()
- return
- }
- // 主题列表
- func GetActivityLabelSpecialListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityLabelList, err error) {
- o := orm.NewOrm()
- sql := `SELECT label,activity_id,is_show_subject_name,days
- FROM cygx_activity_special as art WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- sql += ` LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
- return
- }
- // 获取专项调研活动列表
- func GetCygxActivitySpecialDetailList(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*CygxActivitySpecialDetail, err error) {
- o := orm.NewOrm()
- sql := ` SELECT
- art.*,
- (
- SELECT
- COUNT( 1 )
- FROM
- cygx_activity_special_signup AS s
- WHERE
- s.activity_id = art.activity_id
- AND s.user_id = ?
- ) AS is_signup
- FROM
- cygx_activity_special AS art
- WHERE
- 1 = 1 `
- if condition != "" {
- sql += condition
- }
- sql += ` LIMIT ?,? `
- _, err = o.Raw(sql, uid, pars, startSize, pageSize).QueryRows(&items)
- return
- }
- type GetCygxActivitySpecialDetailListResp struct {
- IsFollow bool `description:"是否关注新调研通知"`
- IsBindingMobile bool `description:"是否绑定了手机号"`
- Paging *paging.PagingItem `description:"分页数据"`
- List []*CygxActivitySpecialDetail
- }
- type CygxActivitySpecialResp struct {
- HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
- PopupMsg string `description:"权限弹窗信息"`
- SellerMobile string `description:"销售电话"`
- SellerName string `description:"销售姓名"`
- IsFollow bool `description:"是否关注新调研通知"`
- Detail *CygxActivitySpecialDetail
- }
- // 通过活动ID获取活动详情
- func GetCygxActivitySpecialDetailById(uid, ActivityId int) (item *CygxActivitySpecialDetail, err error) {
- o := orm.NewOrm()
- sql := `SELECT *,( SELECT COUNT( 1 ) FROM cygx_activity_special_signup AS s WHERE s.activity_id = a.activity_id AND s.user_id = ? ) AS is_signup
- FROM
- cygx_activity_special AS a
- WHERE
- activity_id = ?
- AND publish_status = 1 AND is_offline = 0 `
- err = o.Raw(sql, uid, ActivityId).QueryRow(&item)
- return
- }
- type ActivityIdRep struct {
- ActivityId int `description:"活动id"`
- PlaySeconds int `description:"播放时长"`
- }
- // 通过活动ID获取活动详情
- func GetCygxActivitySpecialDetail(ActivityId int) (item *CygxActivitySpecialDetail, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_activity_special WHERE activity_id=? AND publish_status = 1 `
- err = o.Raw(sql, ActivityId).QueryRow(&item)
- return
- }
|