Ver Fonte

活动首页列表

xingzai há 3 anos atrás
pai
commit
69ba3405c4
4 ficheiros alterados com 604 adições e 0 exclusões
  1. 223 0
      controllers/activity.go
  2. 343 0
      models/activity.go
  3. 33 0
      models/activity_type.go
  4. 5 0
      routers/router.go

+ 223 - 0
controllers/activity.go

@@ -0,0 +1,223 @@
+package controllers
+
+import (
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"rdluck_tools/paging"
+	"strconv"
+	"strings"
+	"time"
+)
+
+//活动
+type ActivityCoAntroller struct {
+	BaseAuthController
+}
+
+// @Title 活动类型列表
+// @Description活动类型列表接口
+// @Success 200 {object} models.ActivityTypeListResp
+// @router /activityTypelist [get]
+func (this *ActivityCoAntroller) List() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	resp := new(models.ActivityTypeListResp)
+	list, err := models.GetActivityTypeList()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	resp.List = list
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 活动列表
+// @Description 获取活动列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   ChartPermissionIds   query   string  false     "行业id 多个用 , 隔开"
+// @Param   ActivityTypeIds   query   string  false     "活动类型id 多个用 , 隔开"
+// @Param   KeyWord   query   string  false       "搜索关键词"
+// @Param   ActiveState   query   string  false       "活动进行状态 未开始:1、进行中2、已结束3"
+// @Success 200 {object} models.GetCygxActivityListRep
+// @router /list [get]
+func (this *ActivityCoAntroller) ActivityList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		return
+	}
+	uid := user.UserId
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	chartPermissionIds := this.GetString("ChartPermissionIds")
+	activityTypeIds := this.GetString("ActivityTypeIds")
+
+	keyWord := this.GetString("KeyWord")
+	activeState := this.GetString("ActiveState")
+	if activeState != "2" && activeState != "3" {
+		activeState = "1"
+	}
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	var condition string
+	var pars []interface{}
+	if keyWord != "" {
+		condition += ` AND (art.activity_name LIKE '%` + keyWord + `%' )  `
+	}
+	//行业名称
+	if len(chartPermissionIds) > 0 {
+		condition += ` AND art.chart_permission_id  IN (` + chartPermissionIds + `)`
+	}
+	condition += ` AND art.publish_status = 1 `
+	//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
+	resultTimeNow := time.Now().Format("2006-01-02 15:04:05")
+	resultTime30 := time.Now().Add(+time.Minute * 30).Format("2006-01-02 15:04:05")
+	resultTime_30 := time.Now().Add(-time.Minute * 30).Format("2006-01-02 15:04:05")
+	resultTime60 := time.Now().Add(+time.Minute * 60).Format("2006-01-02 15:04:05")
+	resultTime_60 := time.Now().Add(-time.Minute * 60).Format("2006-01-02 15:04:05")
+	if activeState == "1" {
+		if len(activityTypeIds) > 0 {
+			condition += ` AND art.activity_type_id   IN (` + activityTypeIds + `)`
+		}
+		condition += ` AND art.activity_time > ` + "'" + resultTimeNow + "'"
+	} else if activeState == "2" {
+		condition += ` AND art.activity_time > ` + "'" + resultTimeNow + "'"
+		if len(activityTypeIds) > 0 {
+			condition += ` AND art.activity_type_id  IN (` + activityTypeIds + `)`
+			condition += ` AND art.activity_time < ` + "'" + resultTime30 + "'"
+		} else {
+			var sqlOr string
+			sqlOr = condition
+			condition += ` AND (art.activity_type_id IN ( 1, 2, 3 ) AND  art.activity_time < ` + "'" + resultTime30 + "'" + ")"
+			condition += ` OR(art.activity_type_id IN ( 4, 5, 6 ) AND  art.activity_time < ` + "'" + resultTime60 + "'" + sqlOr + ")"
+		}
+	} else {
+		if len(activityTypeIds) > 0 {
+			condition += ` AND art.activity_type_id  IN (` + activityTypeIds + `)`
+			condition += ` AND art.activity_time > ` + "'" + resultTime_30 + "'"
+		} else {
+			var sqlOr string
+			sqlOr = condition
+			condition += ` AND (art.activity_type_id IN ( 1, 2, 3 ) AND  art.activity_time <` + "'" + resultTime_30 + "'" + ")"
+			condition += ` OR(art.activity_type_id IN ( 4, 5, 6 ) AND  art.activity_time < ` + "'" + resultTime_60 + "'" + sqlOr + ")"
+		}
+	}
+	total, err := models.GetActivityCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	if activeState != "1" {
+		condition += ` ORDER BY art.activity_time DESC `
+	}
+	//condition += ` ORDER BY art.activity_time DESC `
+	list, errList := models.GetActivityListAll(condition, pars, uid, startSize, pageSize)
+	srt30min := "1,2,3"
+	srt60min := "4,5,6"
+	for k, v := range list {
+		if strings.Contains(srt30min, strconv.Itoa(v.ActivityTypeId)) {
+			resultTime := utils.StrTimeToTime(v.ActivityTime) //时间字符串格式转时间格式
+			if resultTime.After(time.Now()) {
+				list[k].ActiveState = "1"
+			} else if time.Now().After(resultTime) && resultTime.After(time.Now().Add(+time.Minute*30)) {
+				list[k].ActiveState = "2"
+			} else {
+				list[k].ActiveState = "3"
+			}
+		}
+		if strings.Contains(srt60min, strconv.Itoa(v.ActivityTypeId)) {
+			resultTime := utils.StrTimeToTime(v.ActivityTime) //时间字符串格式转时间格式
+			if resultTime.After(time.Now()) {
+				list[k].ActiveState = "1"
+			} else if time.Now().After(resultTime) && resultTime.After(time.Now().Add(+time.Minute*60)) {
+				list[k].ActiveState = "2"
+			} else {
+				list[k].ActiveState = "3"
+			}
+		}
+	}
+	if errList != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + errList.Error()
+		return
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp := new(models.GetCygxActivityListRep)
+	resp.List = list
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title  活动详情
+// @Description 获取活动详情接口
+// @Param   ActivityId   query   int  true       "活动ID"
+// @Success Ret=200 {object} models.ActivityDetail
+// @router /detail [get]
+func (this *ActivityCoAntroller) Detail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	activityId, _ := this.GetInt("ActivityId")
+	if activityId < 1 {
+		br.Msg = "请输入活动ID"
+		return
+	}
+	activityInfo, err := models.GetAddActivityInfoById(activityId)
+	if activityInfo == nil {
+		br.Msg = "活动不存在"
+		br.ErrMsg = "活动ID错误,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+		return
+	}
+	detail, errDetail := models.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
+	if errDetail != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取信息失败,Err:" + errDetail.Error()
+		return
+	}
+	activityInfo.ShowType = detail.ShowType
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = activityInfo
+}

+ 343 - 0
models/activity.go

@@ -0,0 +1,343 @@
+package models
+
+import (
+	"fmt"
+	"github.com/PuerkitoBio/goquery"
+	"hongze/hongze_cygx/utils"
+	"rdluck_tools/orm"
+	"rdluck_tools/paging"
+	"regexp"
+	"strings"
+	"time"
+)
+
+type Activity struct {
+	ActivityTypeId   int    `description:"活动类型id"`
+	ActivityTypeName string `description:"活动名称"`
+	TemplateP        string `description:"活动模板,带P标签"`
+	Template         string `description:"活动模板"`
+	ShowType         string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
+}
+type ActivityIdRep struct {
+	ActivityId int `description:"活动id"`
+}
+
+type ActivityCcustomerType struct {
+	CustomerTypeId int    `description:"活动类型id"`
+	CustomerName   string `description:"活动名称"`
+}
+
+type ActivityCcustomerTypeList struct {
+	List []*ActivityCcustomerType
+}
+
+//列表
+func GetActivityCcustomerTypeList() (items []*ActivityCcustomerType, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_customer_type ORDER BY sort DESC`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+//活动添加、修改入参
+type ActivityRep struct {
+	ActivityTypeId    int    `description:"活动类型id"`
+	ChartPermissionId int    `description:"行业id"`
+	Body              string `description:"内容"`
+	LimitPeopleNum    int    `description:"限制的人数数量"`
+	CustomerTypeIds   string `description:"活动可见的客户类型,多个ID用 , 隔开"`
+	ActivityId        int    `description:"活动ID 等于0新增活动,大于0修改活动"`
+	DoType            int    `description:"操作类型 0,保存 、1,发布"`
+}
+
+//活动详情
+type ActivityDetail struct {
+	ActivityId          int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityTypeId      int    `description:"活动类型id"`
+	ActivityTypeName    string `description:"活动类型名称"`
+	ChartPermissionId   int    `description:"行业id"`
+	ChartPermissionName string `description:"行业名称"`
+	Body                string `description:"内容"`
+	CreateTime          string `description:"创建时间"`
+	IsLimitPeople       int    `description:"是否限制人数 1是,0否"`
+	LimitPeopleNum      string `description:"限制的人数数量"`
+	CustomerTypeIds     string `description:"活动可见的客户类型,多个ID用 , 隔开"`
+	PublishStatus       int    `description:"发布状态 1已发布,0未发布"`
+	LastUpdatedTime     string `description:"更新时间"`
+	ActivityTime        string `description:"活动时间"`
+	ActivityTimeText    string `description:"活动时间带文字"`
+	DistinguishedGuest  string `description:"嘉宾"`
+	Host                string `description:"主持人"`
+	MainlandTell        string `description:"大陆拨入号"`
+	HongKongTell        string `description:"香港拨入号"`
+	TaiwanTell          string `description:"台湾拨入号"`
+	AmericaTell         string `description:"美国拨入号"`
+	ParticipationCode   string `description:"参会密码"`
+	Theme               string `description:"主题"`
+	Expert              string `description:"专家"`
+	ActivityName        string `description:"活动名称"`
+	OnlineParticipation string `description:"网络参会"`
+	ReportLink          string `description:"报告链接"`
+	City                string `description:"城市"`
+	Address             string `description:"活动地址"`
+	Highlights          string `description:"活动亮点"`
+	Remarks             string `description:"备注"`
+	ShowType            string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
+}
+
+//活动详情
+type CygxActivity struct {
+	ActivityId          int       `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityTypeId      int       `description:"活动类型id"`
+	ActivityTypeName    string    `description:"活动类型名称"`
+	ChartPermissionId   int       `description:"行业id"`
+	ChartPermissionName string    `description:"行业名称"`
+	Body                string    `description:"内容"`
+	CreateTime          time.Time `description:"创建时间"`
+	IsLimitPeople       int       `description:"是否限制人数 1是,0否"`
+	LimitPeopleNum      int       `description:"限制的人数数量"`
+	CustomerTypeIds     string    `description:"活动可见的客户类型,多个ID用 , 隔开"`
+	PublishStatus       int       `description:"发布状态 1已发布,0未发布"`
+	LastUpdatedTime     time.Time `description:"更新时间"`
+	ActivityTime        string    `description:"活动时间"`
+	ActivityTimeText    string    `description:"活动时间带文字"`
+	DistinguishedGuest  string    `description:"嘉宾"`
+	Host                string    `description:"主持人"`
+	MainlandTell        string    `description:"大陆拨入号"`
+	HongKongTell        string    `description:"香港拨入号"`
+	TaiwanTell          string    `description:"台湾拨入号"`
+	AmericaTell         string    `description:"美国拨入号"`
+	ParticipationCode   string    `description:"参会密码"`
+	Theme               string    `description:"主题"`
+	Expert              string    `description:"专家"`
+	ActivityName        string    `description:"活动名称"`
+	OnlineParticipation string    `description:"网络参会"`
+	ReportLink          string    `description:"报告链接"`
+	City                string    `description:"城市"`
+	Address             string    `description:"活动地址"`
+	Highlights          string    `description:"活动亮点"`
+	Remarks             string    `description:"备注"`
+}
+
+type CygxActivityEditDetail struct {
+	ActivityId        int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityTypeId    int    `description:"活动类型id"`
+	ChartPermissionId int    `description:"行业id"`
+	Body              string `description:"内容"`
+	LimitPeopleNum    int    `description:"限制的人数数量"`
+	CustomerTypeIds   string `description:"活动可见的客户类型,多个ID用 , 隔开"`
+}
+
+//添加活动
+func AddActivity(item *CygxActivity) (newId int64, err error) {
+	o := orm.NewOrm()
+	newId, err = o.Insert(item)
+	return
+}
+
+//通过纪要ID获取活动详情
+func GetAddActivityInfoById(ActivityId int) (item *ActivityDetail, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity  WHERE activity_id=?`
+	err = o.Raw(sql, ActivityId).QueryRow(&item)
+	return
+}
+
+//通过纪要ID获取活动详情
+func GetAddActivityInfoEditById(ActivityId int) (item *CygxActivityEditDetail, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity  WHERE activity_id=?`
+	err = o.Raw(sql, ActivityId).QueryRow(&item)
+	return
+}
+
+//修改文章
+func EditActivity(item *CygxActivity, oldPublishStatus int) (err error) {
+	o := orm.NewOrm()
+	//if oldPublishStatus == 1 {
+	sql := `UPDATE cygx_activity SET activity_type_id=?, activity_type_name=?, chart_permission_id=?, chart_permission_name=?, body=?, is_limit_people=?,limit_people_num = ?,customer_type_ids=?,publish_status =?, last_updated_time=? ,activity_time=?, activity_time_text=?, distinguished_guest=?, host=?, mainland_tell=?, hong_kong_tell=?, taiwan_tell=?, america_tell=?, participation_code=?, theme=?, expert=?, activity_name=?, online_participation=?, report_link=?, city=?, address=?, highlights=?, remarks=? WHERE activity_id=?`
+	_, err = o.Raw(sql, item.ActivityTypeId, item.ActivityTypeName, item.ChartPermissionId, item.ChartPermissionName, item.Body, item.IsLimitPeople, item.LimitPeopleNum, item.CustomerTypeIds, item.PublishStatus, item.LastUpdatedTime, item.ActivityTime, item.ActivityTimeText, item.DistinguishedGuest, item.Host, item.MainlandTell, item.HongKongTell, item.TaiwanTell, item.AmericaTell, item.ParticipationCode, item.Theme, item.Expert, item.ActivityName, item.OnlineParticipation, item.ReportLink, item.City, item.Address, item.Highlights, item.Remarks, item.ActivityId).Exec()
+	//} else {
+	//if item.PublishStatus == 1 {
+	//	sql := `UPDATE cygx_article SET category_name=?, title=?, abstract=?, body=?, body_text=?, publish_status=?, publish_date =? ,last_updated_time = ?,seller_and_mobile=?,expert_background =?, expert_number=? ,interview_date=?, file_link=? WHERE id=? AND source = 1`
+	//	_, err = o.Raw(sql, item.CategoryName, item.Title, item.Abstract, item.Body, item.BodyText, item.PublishStatus, item.PublishDate, item.LastUpdatedTime, item.SellerAndMobile, item.ExpertBackground, item.ExpertNumber, item.InterviewDate, item.FileLink, item.SummaryManageId).Exec()
+	//} else {
+	//	sql := `UPDATE cygx_article SET category_name=?, title=?, abstract=?, body=?, body_text=?, publish_status=?,last_updated_time = ?, publish_date = '' ,seller_and_mobile=?,expert_background =?, expert_number=? ,interview_date=?, file_link=? WHERE id=? AND source = 1`
+	//	_, err = o.Raw(sql, item.CategoryName, item.Title, item.Abstract, item.Body, item.BodyText, item.PublishStatus, item.LastUpdatedTime, item.SellerAndMobile, item.ExpertBackground, item.ExpertNumber, item.InterviewDate, item.FileLink, item.SummaryManageId).Exec()
+	//}
+	//}
+
+	return
+}
+
+//活动详情
+type CygxActivityList struct {
+	ActivityId          int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityTypeId      int    `description:"活动类型id"`
+	ActivityName        string `description:"活动名称"`
+	ActivityTypeName    string `description:"活动类型名称"`
+	ChartPermissionId   int    `description:"行业id"`
+	ChartPermissionName string `description:"行业名称"`
+	IsLimitPeople       int    `description:"是否限制人数 1是,0否"`
+	LimitPeopleNum      int    `description:"限制的人数数量"`
+	ActivityTime        string `description:"活动时间"`
+	ActivityTimeText    string `description:"活动时间带文字"`
+	City                string `description:"城市"`
+	DistinguishedGuest  string `description:"嘉宾"`
+	Expert              string `description:"专家"`
+	IsSignup            int    `description:"是否已报名 1是 ,0 否"`
+	SignupNum           int    `description:"已报名人数"`
+	ActiveState         string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
+}
+
+type GetCygxActivityListRep struct {
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*CygxActivityList
+}
+
+//列表
+func GetActivityListAll(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*CygxActivityList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * ,
+		( SELECT COUNT( 1 ) FROM cygx_activity_signup AS s WHERE s.activity_id = art.activity_id AND s.user_id = ? ) AS is_signup,
+		( SELECT COUNT( DISTINCT user_id ) FROM cygx_activity_signup AS s WHERE s.activity_id = art.activity_id ) AS signup_num
+		FROM cygx_activity as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?`
+
+	_, err = o.Raw(sql, pars, uid, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+//获取文章数量
+func GetActivityCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_activity as art WHERE 1= 1  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+//获取文章数量
+func GetActivityCountById(activityId int) (count int, err error) {
+	o := orm.NewOrm()
+	sqlCount := `SELECT COUNT(1) AS count  FROM cygx_activity WHERE activity_id = ?`
+	err = o.Raw(sqlCount, activityId).QueryRow(&count)
+	return
+}
+
+//修改发布状态
+func ActivityPublishAndCancel(item *CygxActivity) (err error) {
+	sql := `UPDATE cygx_activity SET  publish_status=? , last_updated_time= ?  WHERE activity_id=? `
+	o := orm.NewOrm()
+	_, err = o.Raw(sql, item.PublishStatus, time.Now(), item.ActivityId).Exec()
+	return
+}
+
+//删除数据
+func DeleteActivity(activityId int) (err error) {
+	o := orm.NewOrm()
+	sql := ` DELETE FROM cygx_activity WHERE activity_id = ?`
+	_, err = o.Raw(sql, activityId).Exec()
+	return
+}
+
+func ActivityBodyAnalysis(body string) (itemr *CygxActivity, errstr string) {
+	item := new(CygxActivity)
+	doc, _ := goquery.NewDocumentFromReader(strings.NewReader(body))
+	doc.Find("p").Each(func(i int, s *goquery.Selection) {
+		contentTxt := s.Text()
+		contentTxt = strings.Replace(contentTxt, "\n", "", -1)
+		contentTxt = strings.Replace(contentTxt, " ", "", -1)
+
+		if strings.Contains(contentTxt, "活动名称:") {
+			item.ActivityName = strings.Replace(contentTxt, "活动名称:", "", -1)
+		}
+		if strings.Contains(contentTxt, "时间:") {
+			strText := strings.Replace(contentTxt, "时间:", "", -1)
+			item.ActivityTimeText = strText
+			strText = strings.Replace(strText, "AM", "", -1)
+			strText = strings.Replace(strText, "PM", "", -1)
+			strText = strings.Replace(strText, "(", "", -1)
+			strText = strings.Replace(strText, ")", "", -1)
+
+			fmt.Println("——————————")
+			var hrefRegexp = regexp.MustCompile("[^\\\\x00-\\\\xff]+")
+			match := hrefRegexp.FindAllString(strText, -1)
+			for _, v := range match {
+				fmt.Println(v)
+			}
+			fmt.Println("——————————")
+			if match != nil {
+				timeStr := strings.Replace(strText, match[len(match)-1], " ", -1)
+				resultTime := utils.StrTimeToTime(timeStr + ":00") //时间字符串格式转时间格式
+				fmt.Println(timeStr)
+				fmt.Println(resultTime)
+				item.ActivityTime = timeStr
+				//fmt.Println("+++++++++++++")
+				//fmt.Println(timeStr)
+				//fmt.Println(len(match))
+				//fmt.Println(match[0])
+				//fmt.Println(match[1])
+				//fmt.Println(match[2])
+				//fmt.Println(timeStr)
+				res := time.Now().After(resultTime)
+				if res {
+					errstr = "活动时间" + strText + "应在当前时间之后"
+				}
+				//fmt.Println("=================")
+			}
+		}
+		if strings.Contains(contentTxt, "嘉宾:") {
+			item.DistinguishedGuest = strings.Replace(contentTxt, "嘉宾:", "", -1)
+		}
+		if strings.Contains(contentTxt, "主持人:") {
+			item.Host = strings.Replace(contentTxt, "主持人:", "", -1)
+		}
+		if strings.Contains(contentTxt, "大陆拨入号:") {
+			item.MainlandTell = strings.Replace(contentTxt, "大陆拨入号:", "", -1)
+		}
+		if strings.Contains(contentTxt, "香港拨入号:") {
+			item.HongKongTell = strings.Replace(contentTxt, "香港拨入号:", "", -1)
+		}
+		if strings.Contains(contentTxt, "台湾拨入号:") {
+			item.TaiwanTell = strings.Replace(contentTxt, "台湾拨入号:", "", -1)
+		}
+		if strings.Contains(contentTxt, "美国拨入号:") {
+			item.AmericaTell = strings.Replace(contentTxt, "美国拨入号:", "", -1)
+		}
+		if strings.Contains(contentTxt, "参会密码:") {
+			item.ParticipationCode = strings.Replace(contentTxt, "参会密码:", "", -1)
+		}
+		if strings.Contains(contentTxt, "主题:") {
+			item.Theme = strings.Replace(contentTxt, "主题:", "", -1)
+		}
+		if strings.Contains(contentTxt, "专家:") {
+			item.Expert = strings.Replace(contentTxt, "专家:", "", -1)
+		}
+		if strings.Contains(contentTxt, "网络参会:") {
+			item.OnlineParticipation = strings.Replace(contentTxt, "网络参会:", "", -1)
+		}
+		if strings.Contains(contentTxt, "报告链接:") {
+			item.ReportLink = strings.Replace(contentTxt, "报告链接:", "", -1)
+		}
+		if strings.Contains(contentTxt, "城市:") {
+			item.City = strings.Replace(contentTxt, "城市:", "", -1)
+		}
+		if strings.Contains(contentTxt, "活动地址:") {
+			item.Address = strings.Replace(contentTxt, "活动地址:", "", -1)
+		}
+		if strings.Contains(contentTxt, "活动亮点:") {
+			item.Highlights = strings.Replace(contentTxt, "活动亮点:", "", -1)
+		}
+		if strings.Contains(contentTxt, "备注:") {
+			item.Remarks = strings.Replace(contentTxt, "备注:", "", -1)
+		}
+	})
+	itemr = item
+	return
+}

+ 33 - 0
models/activity_type.go

@@ -0,0 +1,33 @@
+package models
+
+import (
+	"rdluck_tools/orm"
+)
+
+type ActivityType struct {
+	ActivityTypeId   int    `description:"活动类型id"`
+	ActivityTypeName string `description:"活动名称"`
+	//TemplateP        string `description:"活动模板,带P标签"`
+	//Template         string `description:"活动模板"`
+	ShowType string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
+	IsChoose bool   `description:"是否选择"`
+}
+
+type ActivityTypeListResp struct {
+	List []*ActivityType
+}
+
+//列表
+func GetActivityTypeList() (items []*ActivityType, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity_type ORDER BY sort DESC`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+func GetActivityTypeDetailById(activityTypeId int) (item *ActivityType, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity_type WHERE activity_type_id = ? `
+	err = o.Raw(sql, activityTypeId).QueryRow(&item)
+	return
+}

+ 5 - 0
routers/router.go

@@ -81,6 +81,11 @@ func init() {
 				&controllers.ReportController{},
 			),
 		),
+		beego.NSNamespace("/activity",
+			beego.NSInclude(
+				&controllers.ActivityCoAntroller{},
+			),
+		),
 	)
 	beego.AddNamespace(ns)
 }