Parcourir la source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx_9.1

xingzai il y a 2 ans
Parent
commit
df536e0293

+ 2 - 5
controllers/activity.go

@@ -382,15 +382,12 @@ func (this *ActivityCoAntroller) ActivityList() {
 		}
 	}
 	resp := new(models.GetCygxActivityListRep)
-
 	//处理音频回放
 	mapActivityVoice, err := services.GetActivityVoiceResp(mapActivityId)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "GetActivityVoiceResp,Err:" + err.Error()
 	}
-	fmt.Println(mapActivityId)
-	fmt.Println(mapActivityVoice)
 	//处理列表的标签是否展示逻辑
 	for k, v := range list {
 		if mapActivityVoice[v.ActivityId] != nil {
@@ -449,7 +446,8 @@ func (this *ActivityCoAntroller) ScheduleList() {
 		conditionCount += ` AND art.yidong_activity_id = '' `
 	}
 	total, err := models.GetScheduleCount(conditionCount, uid)
-	page := paging.GetPaging(currentIndex, pageSize, total)
+	specialtotal, err := models.GetSpecialScheduleCount(uid)
+	page := paging.GetPaging(currentIndex, pageSize, total+specialtotal)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
@@ -565,7 +563,6 @@ func (this *ActivityCoAntroller) ScheduleList() {
 		}
 		if strings.Contains(v.ChartPermissionName, "研选") && v.ActivityTypeId == 1 {
 			list[k].ActivityTypeName = "买方研选电话会"
-			//list[k].ImgUrlText = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211221/bIdfv8t86xrFRpDOeGGHXOmKEuKl.png"
 			list[k].ImgUrlText = utils.YAN_XUAN_IMG
 		}
 		if v.ActivityType == 0 {

+ 106 - 3
controllers/chart.go

@@ -2,7 +2,6 @@ package controllers
 
 import (
 	"encoding/json"
-	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
@@ -89,7 +88,6 @@ func (this *ChartController) Collection() {
 	var listCollection []*models.HomeChartListResp
 	var total int
 	//var err error
-	fmt.Println(user)
 	chartUserTokenByMobile, _ := services.GetUserTokenByMobile(mobile)
 	if chartUserTokenByMobile != "" {
 		list, err, _ := services.GetChartCollectionByApi(mobile, 9999, 0)
@@ -98,7 +96,6 @@ func (this *ChartController) Collection() {
 			br.ErrMsg = "获取图表分类失败 Err:" + err.Error()
 			return
 		}
-		fmt.Println(len(list))
 		var chartIds string
 		var condition string
 		var pars []interface{}
@@ -399,3 +396,109 @@ func (this *ChartController) ChartTop() {
 	br.Success = true
 	br.Data = resp
 }
+
+// @Title 季度列表
+// @Description 季度列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.HomeChartListItem
+// @router /jidu [get]
+func (this *ChartController) Jidu() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	mobile := user.Mobile
+	uid := user.UserId
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = paging.StartIndex(currentIndex, pageSize)
+
+	resp := new(models.HomeChartListItem)
+	if mobile == "" {
+		page := paging.GetPaging(currentIndex, pageSize, 0)
+		resp.Paging = page
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = resp
+		resp.IsBindingMobile = false
+		return
+	} else {
+		resp.IsBindingMobile = true
+	}
+	var listCollection []*models.HomeChartListResp
+	var total int
+	var err error
+	chartUserTokenByMobile, _ := services.GetUserTokenByMobile(mobile)
+	chartIds := "5424,5587,5423,5589"
+	if chartUserTokenByMobile != "" {
+		var condition string
+		var pars []interface{}
+		condition = ` AND a.chart_id IN (` + chartIds + `) `
+		total, err = models.GetChartCollentCount(condition, pars)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.Msg = "获取帖子总数失败,Err:" + err.Error()
+			return
+		}
+		listCollection, err = models.GetChartListCollection(chartIds, uid, startSize, pageSize)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.Msg = "获取信息失败,GetChartListCollection Err:" + err.Error()
+			return
+		}
+	} else {
+		total, err = models.GetChartCountByUser(uid)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.Msg = "获取总数失败,Err:" + err.Error()
+			return
+		}
+		listCollection, err = models.GetChartListCollectionWithCygx(uid, startSize, pageSize)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.Msg = "获取信息失败,GetChartListCollection Err:" + err.Error()
+			return
+		}
+	}
+	for k, v := range listCollection {
+		if v.NumTop > 0 {
+			listCollection[k].IsTop = true
+		}
+		listCollection[k].Source = 2
+		if v.PtagName != "" {
+			listCollection[k].CtagNamePc = v.PtagName
+		}
+		if v.CtagName != "" {
+			listCollection[k].CtagNamePc += "," + v.CtagName
+		}
+		if v.PtagNameTwo != "" {
+			listCollection[k].CtagNamePc += "," + v.PtagNameTwo
+		}
+		if v.CtagNameTwo != "" {
+			listCollection[k].CtagNamePc += "," + v.CtagNameTwo
+		}
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = listCollection
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 189 - 52
controllers/home.go

@@ -9,6 +9,7 @@ import (
 	"html"
 	"strconv"
 	"strings"
+	"time"
 )
 
 type HomeController struct {
@@ -321,6 +322,15 @@ Loop:
 			list[k].Pv = 999
 		}
 	}
+	list, err = services.HandleArticleCategoryImg(list)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.Msg = "图片预处理失败,HandleArticleCategoryImg,Err:" + err.Error()
+		return
+	}
+	for _, v := range list {
+		v.Body = ""
+	}
 	resp.List = list
 	resp.Paging = page
 	br.Ret = 200
@@ -569,72 +579,199 @@ func (this *HomeController) ListHomeArtAndChart() {
 			list = homeList
 		}
 
-		//研选的五张图片
-		detailResearch, err := models.GetConfigByCode("category_research_img_url")
+		////研选的五张图片
+		//detailResearch, err := models.GetConfigByCode("category_research_img_url")
+		//if err != nil {
+		//	br.Msg = "获取数据失败"
+		//	br.ErrMsg = "获取数据研选分类图片失败,Err:" + err.Error()
+		//	return
+		//}
+		//researchList := strings.Split(detailResearch.ConfigValue, "{|}")
+		////对应分类的所图片
+		//detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
+		//if err != nil {
+		//	br.Msg = "获取数据失败"
+		//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
+		//	return
+		//}
+		//categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
+		//mapCategoryUrl := make(map[string]string)
+		//var categoryId string
+		//var imgUrlChart string
+		//for _, v := range categoryUrlList {
+		//	vslice := strings.Split(v, "_")
+		//	categoryId = vslice[0]
+		//	imgUrlChart = vslice[len(vslice)-1]
+		//	mapCategoryUrl[categoryId] = imgUrlChart
+		//}
+		//
+		//for k, v := range list {
+		//	if v.HomeType != 0 {
+		//		continue
+		//	}
+		//	item := list[k]
+		//	//如果文章一开始的内容是图片,优先展示第一张图片
+		//	imgurl, _ := services.FixArticleImgUrl(html.UnescapeString(list[k].Body))
+		//	newBody, _ := services.GetReportContentTextSubByarticle(item.Body, item.Annotation, item.ArticleId)
+		//	list[k].Body = newBody
+		//	if imgurl != "" {
+		//		list[k].BodyHtml = imgurl
+		//	}
+		//	list[k].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
+		//	if strings.Contains(item.CategoryName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		//		list[k].IsResearch = true
+		//	}
+		//	if item.Pv > 999 {
+		//		list[k].Pv = 999
+		//	}
+		//	//如果是研选系列的任意取五张图片的中的一张
+		//	if v.CategoryId == "0" {
+		//		knum := v.ArticleId % 5
+		//		list[k].ImgUrlPc = researchList[knum]
+		//	} else {
+		//		list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
+		//	}
+		//	if list[k].ArticleId < utils.SummaryArticleId {
+		//		list[k].HttpUrl = utils.StrategyPlatform + strconv.Itoa(v.ArticleId)
+		//		list[k].IsNeedJump = true
+		//	}
+		//	list[k].Source = 1
+		//}
+		resp.List, err = services.HandleArticleCategoryImg(list)
 		if err != nil {
-			br.Msg = "获取数据失败"
-			br.ErrMsg = "获取数据研选分类图片失败,Err:" + err.Error()
+			br.Msg = "获取信息失败"
+			br.Msg = "处理封面图片失败,HandleArticleCategoryImg,Err:" + err.Error()
 			return
 		}
-		researchList := strings.Split(detailResearch.ConfigValue, "{|}")
-		//对应分类的所图片
-		detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
+		resp.List = list
+	}
+	if chartTotal > total {
+		total = chartTotal
+	}
+
+	page = paging.GetPaging(currentIndex, pageSize, total)
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 首页列表接口
+// @Description 首页列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.HomeArtAndChartListResp
+// @router /new [get]
+func (this *HomeController) NewList() {
+	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
+	}
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+
+	startSize = paging.StartIndex(currentIndex, pageSize)
+
+	var condition string
+	var conditionInit string
+	var pars []interface{}
+	var total int
+	resp := new(models.HomeResourceDataListResp)
+
+	//condition += " AND source = 'article' "
+	//查询近一个月的数据
+	conditionInit = " AND publish_date  >   '" + time.Now().AddDate(0, 0, -30).Format(utils.FormatDateTime) + "'"
+	if user.CompanyId <= 1 {
+		condition += " AND source IN ('roadshow','article','activityvideo','activityvoice') " + conditionInit
+		if user.Mobile == "" && user.Email == "" {
+			startSize = 0
+			pageSize = 4
+		}
+	} else {
+		condition += ` AND source NOT IN ('activity','activityspecial','newchart') ` + conditionInit
+		conditionActivity, err := services.GetActivityonditionList(user, "", "", "", "1,2,3", "", 0, 0, "", 0)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
+			return
+		}
+		conditionActivity += ` AND art.is_limit_people = 1 AND art.publish_status = 1 `
+		var conditionOrder string
+		conditionOrder = ` ORDER BY art.activity_time DESC ,  art.active_state ASC   `
+		conditionActivity += conditionOrder
+		listActivity, err := models.GetActivityListHomeNew(conditionActivity, 0, 200)
 		if err != nil {
-			br.Msg = "获取数据失败"
-			br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取可见活动数据失败,Err:" + err.Error()
 			return
 		}
-		categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
-		mapCategoryUrl := make(map[string]string)
-		var categoryId string
-		var imgUrlChart string
-		for _, v := range categoryUrlList {
-			vslice := strings.Split(v, "_")
-			categoryId = vslice[0]
-			imgUrlChart = vslice[len(vslice)-1]
-			mapCategoryUrl[categoryId] = imgUrlChart
+
+		var activityIds []int
+		for _, v := range listActivity {
+			activityIds = append(activityIds, v.ActivityId)
+		}
+		lenActivityIds := len(activityIds)
+		if lenActivityIds > 0 {
+			condition += ` OR ( source = 'activity' AND source_id IN (` + utils.GetOrmInReplace(lenActivityIds) + `) ` + conditionInit + ` )    `
+			pars = append(pars, activityIds)
 		}
 
-		for k, v := range list {
-			if v.HomeType != 0 {
-				continue
-			}
-			item := list[k]
-			//如果文章一开始的内容是图片,优先展示第一张图片
-			imgurl, _ := services.FixArticleImgUrl(html.UnescapeString(list[k].Body))
-			newBody, _ := services.GetReportContentTextSubByarticle(item.Body, item.Annotation, item.ArticleId)
-			list[k].Body = newBody
-			if imgurl != "" {
-				list[k].BodyHtml = imgurl
-			}
-			list[k].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
-			if strings.Contains(item.CategoryName, utils.CHART_PERMISSION_NAME_YANXUAN) {
-				list[k].IsResearch = true
-			}
-			if item.Pv > 999 {
-				list[k].Pv = 999
-			}
-			//如果是研选系列的任意取五张图片的中的一张
-			if v.CategoryId == "0" {
-				knum := v.ArticleId % 5
-				list[k].ImgUrlPc = researchList[knum]
-			} else {
-				list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
-			}
-			if list[k].ArticleId < utils.SummaryArticleId {
-				list[k].HttpUrl = utils.StrategyPlatform + strconv.Itoa(v.ArticleId)
-				list[k].IsNeedJump = true
-			}
-			list[k].Source = 1
+		listActivitySpecial, _, err := services.GetActivitySpecialList(user, 1, 200, "")
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取专项调研可见权限失败失败,Err:" + err.Error()
+			return
+		}
+
+		var activityspecialIds []int
+		for _, v := range listActivitySpecial {
+			activityspecialIds = append(activityspecialIds, v.ActivityId)
+		}
+		lenActivityspecialIds := len(activityspecialIds)
+		if lenActivityspecialIds > 0 {
+			condition += ` OR ( source = 'activityspecial' AND source_id IN (` + utils.GetOrmInReplace(lenActivityspecialIds) + `) ` + conditionInit + ` )   `
+			pars = append(pars, activityspecialIds)
 		}
-		resp.List = list
 	}
-	if chartTotal > total {
-		total = chartTotal
+	total, err := models.GetResourceDataCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
 	}
 
+	if user.Mobile == "" && user.Email == "" {
+		total = pageSize
+	}
+
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+	list, err := services.GetResourceDataList(condition, pars, startSize, pageSize, user)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
 	page = paging.GetPaging(currentIndex, pageSize, total)
 	resp.Paging = page
+	resp.List = list
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 103 - 0
controllers/report_billboard.go

@@ -3,6 +3,7 @@ package controllers
 import (
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
 	"time"
 )
@@ -148,6 +149,108 @@ func (this *ReportBillboardController) FllowList() {
 		list[k].PermissionName = permissionMap[v.ChartPermissionId]
 	}
 
+	//查询产业视频
+	industrialVideoMap := make(map[int]*models.MicroVideoSimpleInfo)
+	var industrialManagementIds []int
+	for _, v := range list {
+		if v.IndustrialManagementId > 0 {
+			industrialManagementIds = append(industrialManagementIds, v.IndustrialManagementId)
+		}
+	}
+
+	// 用户权限
+	authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
+		return
+	}
+	mapUPdateTime := make(map[int]string)
+
+	if len(industrialManagementIds) > 0 {
+		// 获取默认图配置
+		_, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
+		if e != nil {
+			br.Msg = "获取视频默认配置图失败"
+			br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
+			return
+		}
+		videoList, err := models.GetMicroRoadshowVideoByIndustryIds(industrialManagementIds)
+		if err != nil {
+			br.Msg = "产业视频列表失败"
+			br.ErrMsg = "产业视频列表失败, Err: " + err.Error()
+			return
+		}
+		for _, v := range videoList {
+			tmp := &models.MicroVideoSimpleInfo{
+				Id:                  v.VideoId,
+				Title:               "5min逻辑【" + v.IndustryName + "】解析",
+				ResourceUrl:         v.VideoUrl,
+				BackgroundImg:       v.ImgUrl,
+				PlaySeconds:         v.VideoDuration,
+				DetailImgUrl:        v.DetailImgUrl,
+				ChartPermissionId:   v.ChartPermissionId,
+				ChartPermissionName: v.ChartPermissionName,
+			}
+			if tmp.BackgroundImg == "" {
+				tmp.BackgroundImg = videoMap[v.ChartPermissionId]
+			}
+			industrialVideoMap[v.IndustryId] = tmp
+		}
+		//获取这些产业下最新更新的文章
+		listUpdateTime, err := models.GetNewArticleDetailByIndustrialIds(industrialManagementIds)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			return
+		}
+		for _, v := range listUpdateTime {
+			mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
+		}
+
+		//时间线的更新时间
+		//	maptimelineUPdateTime := make(map[int]string)
+		listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialManagementIds)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			return
+		}
+		for _, v := range listtimelinePublishdate {
+			if mapUPdateTime[v.IndustrialManagementId] != "" {
+				if utils.StrTimeToTime(v.PublishDate).After(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
+					mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
+				}
+			}
+		}
+	}
+
+	for k, v := range list {
+		//展示产业视频
+		if video, ok := industrialVideoMap[v.IndustrialManagementId]; ok {
+			//控制用户权限
+			// 权限
+			au := new(models.UserPermissionAuthInfo)
+			au.SellerName = authInfo.SellerName
+			au.SellerMobile = authInfo.SellerMobile
+			au.HasPermission = authInfo.HasPermission
+			au.OperationMode = authInfo.OperationMode
+			if au.HasPermission == 1 {
+				// 非宏观权限进一步判断是否有权限
+				if video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
+					au.HasPermission = 2
+				}
+			}
+			// 无权限的弹框提示
+			if au.HasPermission != 1 {
+				if au.OperationMode == services.UserPermissionOperationModeCall {
+					au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
+				} else {
+					au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
+				}
+				video.ResourceUrl = ""
+			}
+			list[k].AuthInfo = au
+			list[k].IndustryVideo = video
+		}
+	}
+
 	page := paging.GetPaging(1, topNum, len(list))
 	resp := new(models.IndustrialManagementList)
 	resp.List = list

+ 33 - 3
models/activity.go

@@ -318,6 +318,19 @@ func GetActivityListByDateTime(startDate, endDate, activityIds, activityIdsLongT
 	return
 }
 
+//获取我的日程数量
+func GetSpecialScheduleCount(uid int) (count int, err error) {
+	o := orm.NewOrm()
+	sqlCount := `
+SELECT COUNT( 1 ) AS count FROM
+			cygx_activity_special AS art
+			INNER JOIN cygx_activity_special_trip AS my ON my.activity_id = art.activity_id 
+		WHERE
+			1 = 1 AND my.user_id = ? AND my.is_cancel = 0`
+	err = o.Raw(sqlCount, uid).QueryRow(&count)
+	return
+}
+
 //获取数量
 func GetActivityCount(condition string, playBack int, pars []interface{}, filter int) (count int, err error) {
 	var sqlJiontable string
@@ -396,7 +409,8 @@ func GetScheduleAndSpecilList(condition string, pars []interface{}, conditionSpe
 			art.activity_type_id,
 			art.limit_people_num,
 			1 AS source_type,
-			art.activity_time 
+			art.activity_time, 
+			art.city
 		FROM
 			cygx_activity AS art
 			INNER JOIN cygx_my_schedule AS my ON my.activity_id = art.activity_id
@@ -426,7 +440,8 @@ func GetScheduleAndSpecilList(condition string, pars []interface{}, conditionSpe
 			"",
 			"",
 			2 AS source_type,
-			art.activity_time 
+			art.activity_time,
+			""
 		FROM
 			cygx_activity_special AS art
 			INNER JOIN cygx_activity_special_trip AS my ON my.activity_id = art.activity_id 
@@ -1064,7 +1079,22 @@ func GetActivityListNew(condition string, pars []interface{}, uid, startSize, pa
 		tempCondition = strings.TrimRight(tempCondition, ",")
 		sql = `SELECT * FROM(` + sql + `) AS t WHERE t.activity_type_name IN (` + tempCondition + `)`
 	}
-	_, err = o.Raw(sql, pars, uid, uid, uid, startSize, pageSize).QueryRows(&items)
+	_, err = o.Raw(sql, uid, uid, uid, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+//列表
+func GetActivityListHomeNew(condition string, startSize, pageSize int) (items []*ActivityDetail, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT activity_id
+		FROM cygx_activity as art
+		INNER JOIN cygx_activity_type  as t ON t.activity_type_id = art.activity_type_id
+		INNER JOIN  chart_permission  AS c ON c.chart_permission_id = art.chart_permission_id  WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?`
+	_, err = o.Raw(sql, startSize, pageSize).QueryRows(&items)
 	return
 }
 

+ 11 - 0
models/activity_signup.go

@@ -581,3 +581,14 @@ func UpdateCygxActivitySignupisMeet(activityId int, mobile string) (err error) {
 	_, err = o.Raw(sql, activityId, mobile).Exec()
 	return
 }
+
+//UpdateCygxActivitySignupisMeetList 批量修改易董的活动,用户已到会
+func UpdateCygxActivitySignupisMeetList(condition string, pars []interface{}) (err error) {
+	if condition == "" {
+		return
+	}
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_activity_signup SET is_meeting=1 WHERE  1= 1 ` + condition
+	_, err = o.Raw(sql, pars).Exec()
+	return
+}

+ 4 - 80
models/activity_signup_detail.go

@@ -142,73 +142,14 @@ func UpdateActivitySignupDetailMulti(items []*CygxActivitySignupDetail) (err err
 	return
 }
 
-type CygxActivitySignupDetailCopy struct {
-	Id                    int       `orm:"column(id);pk"`
-	ActivityId            int       `description:"活动ID"`
-	UserId                int       `description:"用户ID"`
-	CreateTime            time.Time `description:"创建时间"`
-	Mobile                string    `description:"手机号"`
-	Email                 string    `description:"邮箱"`
-	CompanyId             int       `description:"公司id"`
-	CompanyName           string    `description:"公司名称"`
-	FailType              int       `description:"失败原因,0,未失败,1总人数已满,2单机构超限制,3,爽约次数超限"`
-	SignupType            int       `description:"报名方式,1预约外呼,2自主拨入,3我要报名"`
-	DoFailType            int       `description:"失败原因,0,未失败,1总人数已满,2单机构超限制,3,爽约次数超限"`
-	OutboundMobile        string    `description:"外呼手机号"`
-	CountryCode           string    `description:"手机国家区号"`
-	RealName              string    `description:"用户实际名称"`
-	SellerName            string    `description:"所属销售"`
-	FirstMeetingTime      string    `description:"首次入会时间"`
-	LastMeetingTime       string    `description:"最后退出时间"`
-	Duration              string    `description:"参会时长"`
-	MeetingTypeStr        string    `description:"参会方式"`
-	MeetingAuthentication string    `description:"参会权鉴"`
-	MeetingStatusStr      string    `description:"参会状态"`
-	Position              string    `description:"职位"`
-	IsMeeting             int       `description:"是否到会,1到会,0未到会"`
-	UseridEntity          int       `description:"参会者身份. 1:主讲人, 2:主持人, 3:嘉宾, 4:普通参会者, 5:联席主讲人, 6:会议助理"`
-	ActivityTime          string    `description:"活动时间"`
-	CrmCompanyMapStatusId int       `description:"转换后的对应状态信息:1=正式客户, 2=曾使用客户, 3=其他"`
-}
-
-//添加
-func AddCygxActivitySignupDetailCopy(items []*CygxActivitySignupDetailCopy) (err error) {
-	o, err := orm.NewOrm().Begin()
-	if err != nil {
-		return
-	}
-	defer func() {
-		if err == nil {
-			o.Commit()
-		} else {
-			o.Rollback()
-		}
-	}()
-	if len(items) > 0 {
-		//批量添加
-		_, err = o.InsertMulti(len(items), items)
-		if err != nil {
-			return err
-		}
-	}
-	return
-}
-
-// UpdateActivitySignupDetailMulti 批量修改用户报名信息且报名的人
-func UpdateActivitySignupDetailMultiCopy(items []*CygxActivitySignupDetailCopy) (err error) {
+// UpdateActivitySignupDetailMultiByYiDong 易董批量修改用户报名信息且报名的人
+func UpdateActivitySignupDetailMultiByYiDong(items []*CygxActivitySignupDetail) (err error) {
 	o := orm.NewOrm()
-	p, err := o.Raw(` UPDATE cygx_activity_signup_detail_copy SET 
+	p, err := o.Raw(` UPDATE cygx_activity_signup_detail SET 
 							first_meeting_time = ?,
 							last_meeting_time = ?,
 							duration = ?,
-							meeting_type_str = ?,
-							meeting_authentication = ?,
-							meeting_status_str = ?,
-							position = ?,
-							is_meeting = ?,
-							userid_entity = ?,
-							activity_time = ?,
-							crm_company_map_status_id = ?
+							is_meeting = ?
 							WHERE mobile = ? AND activity_id = ? `).Prepare()
 	if err != nil {
 		return
@@ -221,14 +162,7 @@ func UpdateActivitySignupDetailMultiCopy(items []*CygxActivitySignupDetailCopy)
 			v.FirstMeetingTime,
 			v.LastMeetingTime,
 			v.Duration,
-			v.MeetingTypeStr,
-			v.MeetingAuthentication,
-			v.MeetingStatusStr,
-			v.Position,
 			v.IsMeeting,
-			v.UseridEntity,
-			v.ActivityTime,
-			v.CrmCompanyMapStatusId,
 			v.Mobile, v.ActivityId)
 		if err != nil {
 			return
@@ -236,13 +170,3 @@ func UpdateActivitySignupDetailMultiCopy(items []*CygxActivitySignupDetailCopy)
 	}
 	return
 }
-
-// 获取参会记录表列表
-func GetSignupDetailListCopy(condition string, pars []interface{}) (list []*CygxActivitySignupDetail, err error) {
-	sql := `SELECT * FROM cygx_activity_signup_detail_copy  WHERE  1= 1 `
-	if condition != "" {
-		sql += condition
-	}
-	_, err = orm.NewOrm().Raw(sql, pars).QueryRows(&list)
-	return
-}

+ 28 - 0
models/activity_video.go

@@ -16,6 +16,18 @@ type CygxActivityVideo struct {
 	CreateTime    string `description:"创建时间"`
 }
 
+type CygxActivityVideoResp struct {
+	VideoId           int    `orm:"column(video_id);pk"description:"视频id"`
+	ChartPermissionId int    `description:"权限id"`
+	VideoName         string `description:"视频名称"`
+	ActivityId        int    ` description:"活动ID"`
+	ModifyDate        string `description:"更新时间"`
+	VideoDuration     string `description:"视频时长"`
+	VideoCounts       int    `description:"播放量"`
+	VideoUrl          string `description:"视频地址"`
+	CreateTime        string `description:"创建时间"`
+}
+
 type CygxActivityVideoReq struct {
 	VideoName     string `description:"视频名称"`
 	VideoDuration string `description:"视频时长"`
@@ -69,3 +81,19 @@ func GetCygxActivityVideoById(activityId int) (item *CygxActivityVideo, err erro
 	err = orm.NewOrm().Raw(sql, activityId).QueryRow(&item)
 	return
 }
+
+//列表
+func GetActivityVideoList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityVideoResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	v.*,art.chart_permission_id
+FROM
+	cygx_activity_video AS v 
+	INNER JOIN cygx_activity as art ON art.activity_id = v.activity_id    WHERE 1= 1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?`
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 30 - 0
models/activity_voice.go

@@ -18,6 +18,20 @@ type CygxActivityVoice struct {
 	CreateTime       time.Time `description:"创建时间"`
 }
 
+// ActivityVoice 活动语音表结构体
+type CygxActivityVoiceResp struct {
+	ActivityVoiceId     int    `orm:"column(activity_voice_id);pk" description:"活动音频ID"`
+	ActivityId          int    ` description:"活动ID"`
+	VoiceUrl            string `description:"音频地址"`
+	VoiceName           string `description:"音频名称"`
+	VoicePlaySeconds    string `description:"音频时长"`
+	VoiceCounts         int    `description:"播放量"`
+	ModifyTime          string `description:"更新时间"`
+	CreateTime          string `description:"创建时间"`
+	ChartPermissionId   int    `description:"权限id"`
+	ChartPermissionName string `description:"行业名称"`
+}
+
 // ActivityVoiceReq 音频数据
 type CygxActivityVoiceReq struct {
 	ActivityId      int    ` description:"活动ID"`
@@ -83,3 +97,19 @@ func GetCygxActivityVoiceByActivityId(activityId int) (item *CygxActivityVoice,
 	err = orm.NewOrm().Raw(sql, activityId).QueryRow(&item)
 	return
 }
+
+//列表
+func GetActivityVoiceList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityVoiceResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	v.*,art.chart_permission_id
+FROM
+	cygx_activity_voice AS v 
+	INNER JOIN cygx_activity as art ON art.activity_id = v.activity_id    WHERE 1= 1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?`
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 27 - 22
models/article.go

@@ -84,28 +84,33 @@ func AddCygxArticle(item *CygxArticle) (lastId int64, err error) {
 }
 
 type HomeArticle struct {
-	ArticleId        int                  `description:"文章id"`
-	Title            string               `description:"标题"`
-	TitleEn          string               `description:"英文标题 "`
-	UpdateFrequency  string               `description:"更新周期"`
-	CreateDate       string               `description:"创建时间"`
-	PublishDate      string               `description:"发布时间"`
-	Body             string               `description:"内容"`
-	BodyHtml         string               `description:"内容带有HTML标签"`
-	Abstract         string               `description:"摘要"`
-	CategoryName     string               `description:"一级分类"`
-	SubCategoryName  string               `description:"二级分类"`
-	ExpertBackground string               `description:"专家背景"`
-	IsResearch       bool                 `description:"是否属于研选"`
-	Pv               int                  `description:"PV"`
-	ImgUrlPc         string               `description:"图片链接"`
-	CategoryId       string               `description:"文章分类"`
-	HttpUrl          string               `description:"文章链接跳转地址"`
-	IsNeedJump       bool                 `description:"是否需要跳转链接地址"`
-	Source           int                  `description:"来源  1:文章, 2:图表"`
-	Annotation       string               `description:"核心观点"`
-	HomeType         int                  `description:"数据类型:0-纪要(默认); 1-微路演音频"`
-	MicroAudio       *MicroAudioUnionList `description:"微路演音频"`
+	ArticleId           int                  `description:"文章id"`
+	Title               string               `description:"标题"`
+	TitleEn             string               `description:"英文标题 "`
+	UpdateFrequency     string               `description:"更新周期"`
+	CreateDate          string               `description:"创建时间"`
+	PublishDate         string               `description:"发布时间"`
+	Body                string               `description:"内容"`
+	BodyHtml            string               `description:"内容带有HTML标签"`
+	Abstract            string               `description:"摘要"`
+	CategoryName        string               `description:"一级分类"`
+	SubCategoryName     string               `description:"二级分类"`
+	ExpertBackground    string               `description:"专家背景"`
+	IsResearch          bool                 `description:"是否属于研选"`
+	Pv                  int                  `description:"PV"`
+	ImgUrlPc            string               `description:"图片链接"`
+	CategoryId          string               `description:"文章分类"`
+	HttpUrl             string               `description:"文章链接跳转地址"`
+	IsNeedJump          bool                 `description:"是否需要跳转链接地址"`
+	Source              int                  `description:"来源  1:文章, 2:图表"`
+	Annotation          string               `description:"核心观点"`
+	HomeType            int                  `description:"数据类型:0-纪要(默认); 1-微路演音频"`
+	MicroAudio          *MicroAudioUnionList `description:"微路演音频"`
+	ChartPermissionName string               `description:"权限名称"`
+	ArticleTypeName     string               `description:"权限名称"`
+	IsReport            int                  `description:"是否属于报告,1是,0否"`
+	ArticleResponse     int                  `description:"报告类型 0:啥也不是,1研选报告,2:研选纪要,3:研选沙龙,4;研选观点"`
+	List                []*IndustrialManagementIdInt
 }
 
 type ArticleDetail struct {

+ 25 - 0
models/chart.go

@@ -219,6 +219,31 @@ func GetChartListCollection(chartIds string, userId, startSize, pageSize int) (i
 	return
 }
 
+//获取图表列表
+func GetChartListCollectionNew(condition string, pars []interface{}, userId, startSize, pageSize int) (items []*HomeChartListResp, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT a.*,
+			t.create_time AS t_create_time,
+			c.create_time AS c_create_time,
+			( SELECT COUNT(*) FROM cygx_chart_top AS t WHERE t.chart_id = a.chart_id AND t.user_id = ? ) AS is_top,
+			( SELECT COUNT(*) FROM cygx_chart_collect AS c WHERE c.chart_id = a.chart_id AND c.user_id = ? ) AS num_c 
+		FROM
+			cygx_chart_all AS a
+			LEFT JOIN cygx_chart_top AS t ON t.chart_id = a.chart_id
+			LEFT JOIN cygx_chart_collect AS c ON c.chart_id = a.chart_id 
+		WHERE
+ 1=1
+			` + condition + `
+			
+		GROUP BY
+			a.chart_id 
+		ORDER BY
+			t_create_time DESC,
+			c_create_time DESC LIMIT ?,? `
+	_, err = o.Raw(sql, userId, userId, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
 //获取图表列表本地
 func GetChartListCollectionWithCygx(userId, startSize, pageSize int) (items []*HomeChartListResp, err error) {
 	o := orm.NewOrm()

+ 0 - 1
models/db.go

@@ -121,7 +121,6 @@ func init() {
 		new(CygxIndustrialArticleGroupManagement),
 		new(ArticleTopHistoryRecord),
 		new(CygxActivitySignupDetail),
-		new(CygxActivitySignupDetailCopy),
 		new(CygxMicroRoadshowVideoHistory),
 		new(MicroRoadshowVideo),
 		new(CygxActivityVideoHistory),

+ 1 - 0
models/industrial_management.go

@@ -246,6 +246,7 @@ type IndustrialManagementIdInt struct {
 	SubjectName            string `description:"标的名称"`
 	ArticleId              int    `description:"文章ID"`
 	IsResearch             bool   `description:"是否属于研选"`
+	ChartPermissionId      int    `description:"权限id"`
 }
 
 type IndustrialManagementIdInts struct {

+ 11 - 0
models/micro_roadshow.go

@@ -318,6 +318,17 @@ type MicroRoadshowCollectReq struct {
 	SourceType int `description:"视频来源: 1-音频; 2-活动视频; 3-微路演视频 (不传默认为1)"`
 }
 
+// GetMicroRoadshowVideoListBycondition 根据搜索条件获取搜索列表
+func GetMicroRoadshowVideoListBycondition(condition string, pars []interface{}, startSize, pageSize int) (list []*MicroRoadshowVideo, err error) {
+	sql := `SELECT * FROM cygx_micro_roadshow_video WHERE  1 =1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += `  LIMIT ?,? `
+	_, err = orm.NewOrm().Raw(sql, pars, startSize, pageSize).QueryRows(&list)
+	return
+}
+
 // GetMicroRoadshowVideoList 获取已经发布的微路演视频
 func GetMicroRoadshowVideoList() (list []*MicroRoadshowVideo, err error) {
 	sql := `SELECT * FROM cygx_micro_roadshow_video WHERE  publish_status = 1`

+ 41 - 0
models/resource_data.go

@@ -2,6 +2,7 @@ package models
 
 import (
 	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"time"
 )
 
@@ -16,6 +17,46 @@ type CygxResourceData struct {
 	Abstract    string    `description:"摘要"`
 }
 
+type CygxResourceDataResp struct {
+	Id              int                        `orm:"column(id);pk"`
+	SourceId        int                        `description:"资源ID"`
+	Source          string                     `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+	PublishDate     string                     `description:"发布时间"`
+	Article         *HomeArticle               `description:"文章"`
+	Newchart        *HomeChartListResp         `description:"图表"`
+	Roadshow        *MicroRoadShowPageList     `description:"微路演"`
+	Activity        *ActivityDetail            `description:"活动"`
+	Activityvideo   *MicroRoadShowPageList     `description:"活动视频"`
+	Activityvoice   *MicroRoadShowPageList     `description:"活动音频"`
+	Activityspecial *CygxActivitySpecialDetail `description:"专项调研活动"`
+}
+
+//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+type HomeResourceDataListResp struct {
+	Paging *paging.PagingItem
+	List   []*CygxResourceDataResp `description:"列表"`
+}
+
+//列表
+func GetResourceDataList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxResourceData, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT	 *   FROM cygx_resource_data  WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` ORDER BY publish_date  DESC ,  id  DESC   LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+//获取用户报名成功数量
+func GetResourceDataCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := `SELECT COUNT(1) AS count FROM cygx_resource_data    WHERE 1= 1 ` + condition
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
 //添加
 func AddCygxResourceData(item *CygxResourceData) (lastId int64, err error) {
 	o := orm.NewOrm()

+ 8 - 8
models/yidong.go

@@ -97,14 +97,14 @@ type ApifoxModaluser struct {
 }
 
 type Resultuser struct {
-	DeviceType      *int64  `json:"deviceType"`                // 参会方式,1-PC,2-Mac,3-Android,4-IOS,5-Web,6-iPad,7-Android Pad,8-小程序
-	Duration        *string `json:"duration"`                  // 参会时长
-	EndTime         string  `json:"endTime"`                   // 最后退会时间
-	ID              string  `json:"id,omitempty"`              // 主键id
-	PersonTelephone string  `json:"personTelephone,omitempty"` // 用户手机号
-	StartTime       string  `json:"startTime"`                 // 最早入会时间
-	Status          string  `json:"status"`                    // 状态,D表示被删除
-	UserID          string  `json:"userId,omitempty"`          // 用户id
+	DeviceType      *int64 `json:"deviceType"`                // 参会方式,1-PC,2-Mac,3-Android,4-IOS,5-Web,6-iPad,7-Android Pad,8-小程序
+	Duration        string `json:"duration"`                  // 参会时长
+	EndTime         string `json:"endTime"`                   // 最后退会时间
+	ID              string `json:"id,omitempty"`              // 主键id
+	PersonTelephone string `json:"personTelephone,omitempty"` // 用户手机号
+	StartTime       string `json:"startTime"`                 // 最早入会时间
+	Status          string `json:"status"`                    // 状态,D表示被删除
+	UserID          string `json:"userId,omitempty"`          // 用户id
 }
 
 type ApifoxModalUserTgc struct {

+ 18 - 0
routers/commentsRouter.go

@@ -565,6 +565,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "Jidu",
+            Router: `/jidu`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartController"],
         beego.ControllerComments{
             Method: "Collection",
@@ -682,6 +691,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:HomeController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:HomeController"],
+        beego.ControllerComments{
+            Method: "NewList",
+            Router: `/new`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MicroRoadShowController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MicroRoadShowController"],
         beego.ControllerComments{
             Method: "Collect",

+ 47 - 39
services/activity.go

@@ -1490,60 +1490,68 @@ func ActivityButtonShow(item *models.ActivityDetail) (articleDetail *models.Acti
 		articleDetail.IsShowDetails = true
 		return
 	}
+
+	articleDetail.Expert, _ = GetReportContentTextSub(item.Expert)
+
+	//专家电话会 1
+	if articleDetail.ActivityTypeId == 1 && articleDetail.IsLimitPeople == 0 && (articleDetail.ActiveState == "1" || articleDetail.ActiveState == "2") {
+		articleDetail.IsShowHelpSsk = true
+	}
 	//新的是否展示规则
 	if articleDetail.IsCanAppointmentMinutes == 1 {
 		articleDetail.IsShowAppointment = true
 	} else {
 		articleDetail.IsShowAppointment = false
 	}
-
-	//专家电话会 1
-	if articleDetail.ActivityTypeId == 1 {
-		articleDetail.IsShowOutboundCall = true
-		//if articleDetail.LimitPeopleNum == 0 {
-		//	articleDetail.IsShowMeetingReminder = true
-		//	articleDetail.IsShowHelpSsk = true
-		//}
-		articleDetail.IsShowMeetingReminder = true
-		articleDetail.IsShowHelpSsk = true
-	}
-
-	//分析师电话会 2
-	if articleDetail.ActivityTypeId == 2 {
-		articleDetail.IsShowOutboundCall = true
-		if articleDetail.LimitPeopleNum == 0 {
+	if articleDetail.ActiveState == "1" {
+		//专家电话会 1
+		if articleDetail.ActivityTypeId == 1 {
+			articleDetail.IsShowOutboundCall = true
+			//if articleDetail.LimitPeopleNum == 0 {
+			//	articleDetail.IsShowMeetingReminder = true
+			//	articleDetail.IsShowHelpSsk = true
+			//}
 			articleDetail.IsShowMeetingReminder = true
+			articleDetail.IsShowHelpSsk = true
 		}
-	}
 
-	//公司调研电话会 3
-	if articleDetail.ActivityTypeId == 3 {
-		if articleDetail.LimitPeopleNum == 0 {
-			articleDetail.IsShowMeetingReminder = true
+		//分析师电话会 2
+		if articleDetail.ActivityTypeId == 2 {
 			articleDetail.IsShowOutboundCall = true
-		} else {
-			articleDetail.IsShowSignup = true
+			if articleDetail.LimitPeopleNum == 0 {
+				articleDetail.IsShowMeetingReminder = true
+			}
 		}
-	}
 
-	//公司线下调研 4
-	if articleDetail.ActivityTypeId == 4 {
-		articleDetail.IsShowSignup = true
-	}
+		//公司调研电话会 3
+		if articleDetail.ActivityTypeId == 3 {
+			if articleDetail.LimitPeopleNum == 0 {
+				articleDetail.IsShowMeetingReminder = true
+				articleDetail.IsShowOutboundCall = true
+			} else {
+				articleDetail.IsShowSignup = true
+			}
+		}
 
-	//专家线下沙龙 5
-	if articleDetail.ActivityTypeId == 5 {
-		articleDetail.IsShowSignup = true
-	}
+		//公司线下调研 4
+		if articleDetail.ActivityTypeId == 4 {
+			articleDetail.IsShowSignup = true
+		}
 
-	//分析师线下沙龙 6
-	if articleDetail.ActivityTypeId == 6 {
-		articleDetail.IsShowSignup = true
-	}
+		//专家线下沙龙 5
+		if articleDetail.ActivityTypeId == 5 {
+			articleDetail.IsShowSignup = true
+		}
+
+		//分析师线下沙龙 6
+		if articleDetail.ActivityTypeId == 6 {
+			articleDetail.IsShowSignup = true
+		}
 
-	//分析师电话会(C类) 7
-	if articleDetail.ActivityTypeId == 7 {
-		articleDetail.IsShowSignup = true
+		//分析师电话会(C类) 7
+		if articleDetail.ActivityTypeId == 7 {
+			articleDetail.IsShowSignup = true
+		}
 	}
 	articleDetail.SourceType = 1
 	activityTimeText := articleDetail.ActivityTimeText

+ 264 - 0
services/article.go

@@ -11,6 +11,8 @@ import (
 	"hongze/hongze_cygx/utils"
 	"html"
 	"net/url"
+	"regexp"
+	"sort"
 	"strconv"
 	"strings"
 	"time"
@@ -1661,3 +1663,265 @@ func GetArticNewLabelWhithActivity3Month() (labelMap map[int]bool, err error) {
 	}
 	return
 }
+
+//HandleArticleCategoryImg 预处理文章的封面图片
+func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeArticle, err error) {
+	//研选的五张图片
+	detailResearch, e := models.GetConfigByCode("category_research_img_url")
+	if e != nil {
+		err = errors.New("获取研选的五张图片失败" + e.Error())
+		return
+	}
+	researchList := strings.Split(detailResearch.ConfigValue, "{|}")
+	//对应分类的所图片
+	detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
+	if err != nil {
+		err = errors.New("获取对应分类的所图片失败" + err.Error())
+		return
+	}
+	categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
+	mapCategoryUrl := make(map[string]string)
+	var categoryId string
+	var imgUrlChart string
+	for _, v := range categoryUrlList {
+		vslice := strings.Split(v, "_")
+		categoryId = vslice[0]
+		imgUrlChart = vslice[len(vslice)-1]
+		mapCategoryUrl[categoryId] = imgUrlChart
+	}
+
+	mapChartPerssion := make(map[string]string)
+	reportMappingList, err := models.GetReportMappingStrategyAll()
+	if err != nil {
+		err = errors.New("GetReportMappingStrategyAll err" + err.Error())
+		return
+	}
+
+	for _, v := range reportMappingList {
+		mapChartPerssion[strconv.Itoa(v.CategoryId)] = v.ChartPermissionName
+	}
+	for k, v := range list {
+		list[k].Abstract, _ = GetReportContentTextSub(v.Abstract)
+		item := list[k]
+		//如果文章一开始的内容是图片,优先展示第一张图片
+		if list[k].Annotation == "" {
+			imgurl, _ := FixArticleImgUrl(html.UnescapeString(list[k].Body))
+			if imgurl != "" {
+				list[k].BodyHtml = imgurl
+			}
+		}
+
+		//newBody, _ := GetReportContentTextSubByarticle(item.Body, item.Annotation, item.ArticleId)
+		list[k].Annotation = ArticleAnnotation(item)
+		list[k].Body = ""
+		list[k].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
+		if item.Pv > 999 {
+			list[k].Pv = 999
+		}
+
+		list[k].ChartPermissionName = mapChartPerssion[v.CategoryId]
+		//如果是研选系列的任意取五张图片的中的一张
+		if v.CategoryId == "0" || v.ArticleId > utils.SummaryArticleId {
+			knum := v.ArticleId % 5
+			list[k].ImgUrlPc = researchList[knum]
+		} else {
+			list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
+		}
+		list[k].ArticleResponse = 4 //  默认展示核心观点
+		//ArticleResponse     int                  `description:"报告类型 0:啥也不是,1研选报告,2:研选纪要,3:研选沙龙,4;核心观点"`
+		if list[k].ArticleId >= utils.SummaryArticleId {
+			list[k].HttpUrl = utils.StrategyPlatform + strconv.Itoa(v.ArticleId)
+			list[k].IsNeedJump = true
+			list[k].ArticleResponse = 1
+			//if v.IsReport == 1 {
+			//	list[k].ArticleResponse = 1
+			//} else if v.ArticleTypeName == "纪要" {
+			//	list[k].ArticleResponse = 2
+			//} else if v.ArticleTypeName == "观点" {
+			//	list[k].ArticleResponse = 3
+			//} else if v.ArticleTypeName == "沙龙" {
+			//	list[k].ArticleResponse = 3
+			//} else if v.ArticleTypeName == "路演精华" {
+			//	list[k].ArticleResponse = 1
+			//}
+		}
+		list[k].Source = 1
+		//添加行业默认图片
+		if v.ImgUrlPc == "" {
+			if v.ChartPermissionName == utils.YI_YAO_NAME {
+				list[k].ImgUrlPc = utils.YI_YAO_OTHER_IMG
+			} else if v.ChartPermissionName == utils.XIAO_FEI_NAME {
+				list[k].ImgUrlPc = utils.XIAO_FEI_OTHER_IMG
+			} else if v.ChartPermissionName == utils.KE_JI_NAME {
+				list[k].ImgUrlPc = utils.KE_JI_OTHER_IMG
+			} else if v.ChartPermissionName == utils.ZHI_ZAO_NAME {
+				list[k].ImgUrlPc = utils.ZHI_ZAO_OTHER_IMG
+			}
+		}
+
+	}
+
+	articleIds := make([]int, 0)
+	for i := range list {
+		articleIds = append(articleIds, list[i].ArticleId)
+	}
+	// 报告关联产业信息
+	industryMap := make(map[int][]*models.IndustrialManagementIdInt, 0)
+	if len(articleIds) > 0 {
+		var industryCond string
+		var industryPars []interface{}
+		industryCond += ` AND mg.article_id IN (` + utils.GetOrmInReplace(len(articleIds)) + `)`
+		industryPars = append(industryPars, articleIds)
+		industryList, e := models.GetIndustrialListByarticleId(industryPars, industryCond)
+		if e != nil {
+			err = errors.New("GetIndustrialListByarticleId" + e.Error())
+			return
+		}
+		for i := range industryList {
+			v := industryList[i]
+			industryMap[v.ArticleId] = append(industryMap[v.ArticleId], &models.IndustrialManagementIdInt{
+				ArticleId:              v.ArticleId,
+				IndustrialManagementId: v.IndustrialManagementId,
+				IndustryName:           v.IndustryName,
+				ChartPermissionId:      v.ChartPermissionId,
+			})
+		}
+	}
+	for k, v := range list {
+		if len(industryMap[v.ArticleId]) > 0 {
+			list[k].List = industryMap[v.ArticleId]
+		} else {
+			list[k].List = make([]*models.IndustrialManagementIdInt, 0)
+		}
+	}
+
+	if len(list) == 0 {
+		list = make([]*models.HomeArticle, 0)
+	}
+	items = list
+	return
+}
+
+//处理核心观点的展示规则
+func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
+	if item.ArticleId >= utils.SummaryArticleId {
+		item.Annotation = YxArticleAnnotation(item)
+	}
+	if item.Annotation != "" {
+		annotation = strings.Replace(item.Annotation, "<br>", "", -1)
+	} else {
+		return
+	}
+	bodyText, _ := GetReportContentTextSubNew(annotation)
+	if bodyText == "" {
+		return
+	}
+	if annotation != "" {
+		annotation = html.UnescapeString(annotation)
+		doc, _ := goquery.NewDocumentFromReader(strings.NewReader(annotation))
+		docText := doc.Text()
+		mapDoc := make(map[int]string)
+		var mapSort []int
+		p := doc.Find("p")
+		p.Each(func(tk int, pd *goquery.Selection) {
+			pdText := pd.Text()
+			pdText = strings.Replace(pdText, " ", "", -1)
+			if pdText != "" {
+				textLen := strings.Index(docText, pdText)
+				mapDoc[(strings.Index(docText, pdText))] = pdText
+				mapSort = append(mapSort, textLen)
+			}
+		})
+		li := doc.Find("li")
+		li.Each(func(tk int, li *goquery.Selection) {
+			liText := li.Text()
+			liText = strings.Replace(liText, " ", "", -1)
+			if liText != "" {
+				textLen := strings.Index(docText, liText)
+				mapDoc[(strings.Index(docText, liText))] = strconv.Itoa(tk+1) + "." + liText
+				mapSort = append(mapSort, textLen)
+			}
+		})
+
+		ul := doc.Find("ul")
+		ul.Each(func(tk int, ul *goquery.Selection) {
+			ulText := ul.Text()
+			ulText = strings.Replace(ulText, " ", "", -1)
+			if ulText != "" {
+				textLen := strings.Index(docText, ulText)
+				mapDoc[(strings.Index(docText, ulText))] = ulText
+				mapSort = append(mapSort, textLen)
+			}
+		})
+		if len(mapSort) == 0 {
+			return
+		} else {
+			//排序
+			sort.Ints(mapSort)
+			var annotationHtml string
+			for _, vSort := range mapSort {
+				for k, v := range mapDoc {
+					if k == vSort && v != "" {
+						annotationHtml += v + "<br>"
+					}
+				}
+			}
+			annotationHtml = strings.TrimRight(annotationHtml, "<br>")
+			annotationHtml = "<p>" + annotationHtml + "</p>"
+			annotation = annotationHtml
+		}
+	}
+	return
+}
+
+//解析研选内容中的核心观点
+func YxArticleAnnotation(article *models.HomeArticle) (annotation string) {
+	//如果不规范,就获取内容主体
+	if strings.Count(article.Body, "<hr") == 0 {
+		//如果内容不规范而且,还有图片,就把核心观点置空
+		if article.BodyHtml != "" {
+			return
+		}
+		annotation, _ = GetReportContentTextSub(article.Body)
+		return
+	}
+	body := strings.ReplaceAll(article.Body, "<strong>", "")
+	body = strings.ReplaceAll(body, "</strong>", "")
+	body = strings.ReplaceAll(body, "</ol>", "</div>")
+	body = strings.ReplaceAll(body, "<ol>", "<div>")
+	body = strings.ReplaceAll(body, "</li>", "</p>")
+	body = strings.ReplaceAll(body, "<li>", "<p>")
+	re, _ := regexp.Compile("<strong.*?>")
+	body = re.ReplaceAllString(body, "")
+	reLi, _ := regexp.Compile("<li.*?>")
+	body = reLi.ReplaceAllString(body, "")
+	var plus int
+	coreIndex := strings.Index(body, "核心观点:")
+	plus = 15
+	if coreIndex == -1 {
+		coreIndex = strings.Index(body, "核心观点:")
+		plus = 13
+	}
+	if coreIndex == -1 {
+		coreIndex = strings.Index(body, "核心观点")
+		plus = 12
+	}
+	if coreIndex == -1 {
+		coreIndex = strings.Index(body, "核心结论:")
+		plus = 15
+	}
+	if coreIndex == -1 {
+		coreIndex = strings.Index(body, "核心结论:")
+		plus = 13
+	}
+	if coreIndex == -1 {
+		coreIndex = strings.Index(body, "核心结论")
+		plus = 12
+	}
+	endIndex := strings.Index(body, "<hr")
+	if coreIndex != -1 && endIndex != -1 {
+		body = body[coreIndex+plus : endIndex]
+	}
+	annotation = body
+	return
+}

+ 326 - 0
services/resource_data.go

@@ -1,13 +1,339 @@
 package services
 
 import (
+	"errors"
 	"fmt"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/utils"
 	"strconv"
+	"strings"
 	"time"
 )
 
+func GetResourceDataList(condition string, pars []interface{}, startSize, pageSize int, user *models.WxUserItem) (items []*models.CygxResourceDataResp, err error) {
+
+	uid := user.UserId
+	list, e := models.GetResourceDataList(condition, pars, startSize, pageSize)
+	if e != nil {
+		err = errors.New("GetResourceDataList, Err: " + e.Error())
+		return
+	}
+	mapItems := make(map[string]*models.CygxResourceDataResp)
+	for _, v := range list {
+		//预处理文章
+		item := new(models.CygxResourceDataResp)
+		item.Id = v.Id
+		item.SourceId = v.SourceId
+		item.Source = v.Source
+		item.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
+		mapItems[fmt.Sprint(v.Source, v.SourceId)] = item
+	}
+
+	var articleIds []int
+	var newchartIds []int
+	var roadshowIds []string
+	var activityIds []int
+	var activityvideoIds []string
+	var activityvoiceIds []string
+	var activityspecialIds []int
+	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+	for _, v := range list {
+		if v.Source == "article" {
+			articleIds = append(articleIds, v.SourceId)
+		} else if v.Source == "newchart" {
+			newchartIds = append(newchartIds, v.SourceId)
+		} else if v.Source == "roadshow" {
+			roadshowIds = append(roadshowIds, strconv.Itoa(v.SourceId))
+		} else if v.Source == "activity" {
+			activityIds = append(activityIds, v.SourceId)
+		} else if v.Source == "activityvideo" {
+			activityvideoIds = append(activityvideoIds, strconv.Itoa(v.SourceId))
+		} else if v.Source == "activityvoice" {
+			activityvoiceIds = append(activityvoiceIds, strconv.Itoa(v.SourceId))
+		} else if v.Source == "activityspecial" {
+			activityspecialIds = append(activityspecialIds, v.SourceId)
+		}
+	}
+
+	//处理文章
+	if len(articleIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND a.article_id IN (` + utils.GetOrmInReplace(len(articleIds)) + `)`
+		pars = append(pars, articleIds)
+
+		listArticle, e := models.GetHomeList(condition, pars, 0, len(articleIds))
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+
+		listArticle, e = HandleArticleCategoryImg(listArticle)
+		if e != nil {
+			err = errors.New("HandleArticleCategoryImg, Err: " + e.Error())
+			return
+		}
+		for _, v := range listArticle {
+			v.Body = ""
+			mapItems[fmt.Sprint("article", v.ArticleId)].Article = v
+		}
+	}
+
+	detail, e := models.GetConfigByCode("city_img_url")
+	if e != nil {
+		err = errors.New("GetResourceDataList, Err: " + e.Error())
+		return
+	}
+	detailChart, e := models.GetConfigByCode("chart_img_url")
+	if e != nil {
+		err = errors.New("GetResourceDataList, Err: " + e.Error())
+		return
+	}
+	addressList := strings.Split(detail.ConfigValue, "{|}")
+	mapAddress := make(map[string]string)
+	chartList := strings.Split(detailChart.ConfigValue, "{|}")
+	mapChart := make(map[string]string)
+	var cityName string
+	var chartName string
+	var imgUrl string
+	var imgUrlChart string
+	for _, v := range addressList {
+		vslice := strings.Split(v, "_")
+		cityName = vslice[0]
+		imgUrl = vslice[len(vslice)-1]
+		mapAddress[cityName] = imgUrl
+	}
+	for _, v := range chartList {
+		vslice := strings.Split(v, "_")
+		chartName = vslice[0]
+		imgUrlChart = vslice[len(vslice)-1]
+		mapChart[chartName] = imgUrlChart
+	}
+	var imgUrlResp string
+
+	//处理活动
+	if len(activityIds) > 0 {
+		for _, vss := range activityIds {
+			imgUrlResp += strconv.Itoa(vss) + ","
+		}
+		pars = make([]interface{}, 0)
+		condition = ` AND art.activity_id IN (` + utils.GetOrmInReplace(len(activityIds)) + `)`
+		pars = append(pars, activityIds)
+		activityList, e := models.GetActivityListNew(condition, pars, uid, 0, len(activityIds), 0, 0, "")
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+		var activityListRersp []*models.ActivityDetail
+		for _, v := range activityList {
+			activityListRersp = append(activityListRersp, ActivityButtonShow(v))
+		}
+		for _, v := range activityListRersp {
+			if v == nil {
+				continue
+			}
+			if v.ActivityType == 0 {
+				if mapAddress[v.City] != "" {
+					imgUrlResp = mapAddress[v.City]
+				} else {
+					imgUrlResp = mapAddress["其它"]
+				}
+			} else {
+				if mapChart[v.ChartPermissionName] != "" {
+					imgUrlResp = mapChart[v.ChartPermissionName]
+				}
+			}
+			mapItems[fmt.Sprint("activity", v.ActivityId)].Activity = v
+		}
+	}
+
+	//处理图表
+	if len(newchartIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND a.chart_id IN (` + utils.GetOrmInReplace(len(newchartIds)) + `)`
+		pars = append(pars, newchartIds)
+		chartDateList, e := models.GetChartListCollectionNew(condition, pars, uid, 0, len(newchartIds))
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+		for _, v := range chartDateList {
+			mapItems[fmt.Sprint("newchart", v.ChartId)].Newchart = v
+		}
+	}
+
+	//处理专项调研
+	if len(activityspecialIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND art.activity_id IN (` + utils.GetOrmInReplace(len(activityspecialIds)) + `)`
+		pars = append(pars, activityspecialIds)
+		activitySpeciallist, e := models.GetCygxActivitySpecialDetailList(condition, pars, user.UserId, 0, len(activityspecialIds))
+		if e != nil {
+			err = errors.New("GetCygxActivitySpecialDetailList, Err: " + e.Error())
+			return
+		}
+		UserMap, e := GetSpecialTripUserMap(activityIds, user.UserId)
+		if e != nil {
+			err = errors.New("GetSpecialTripUserMap, Err: " + e.Error())
+			return
+		}
+		for _, v := range activitySpeciallist {
+			if mapChart[v.ChartPermissionName] != "" {
+				imgUrlResp = mapChart[v.ChartPermissionName]
+			}
+			if _, ok := UserMap[v.ActivityId]; ok {
+				v.IsTrip = 1
+			}
+			if v.Days == 0 {
+				v.TripStatus = 1
+				v.TripImgLink = v.TripImgLink
+			} else {
+				v.TripStatus = 2
+				v.TripImgLink = v.TripImgLinkFix
+			}
+			resultTimeStart := utils.StrTimeToTime(v.ActivityTime)  //时间字符串格式转时间格式
+			resultTimeEnd := utils.StrTimeToTime(v.ActivityTimeEnd) //时间字符串格式转时间格式
+			if resultTimeStart.After(time.Now()) {
+				v.ActiveState = 1
+			} else if time.Now().After(resultTimeEnd) {
+				v.ActiveState = 3
+			} else {
+				v.ActiveState = 2
+			}
+			v.ImgUrl = imgUrlResp
+			mapItems[fmt.Sprint("activityspecial", v.ActivityId)].Activityspecial = v
+
+		}
+	}
+
+	if len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds) > 0 {
+
+		audioIdstr := strings.Join(activityvoiceIds, ",")
+		ideoIdsStr := strings.Join(roadshowIds, ",")
+		activityVideoIdsStr := strings.Join(activityvideoIds, ",")
+
+		list, _, e := GetMicroRoadShowMycollect(len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds), 0, audioIdstr, ideoIdsStr, activityVideoIdsStr)
+		if e != nil {
+			err = errors.New("GetMicroRoadShowMycollect, Err: " + e.Error())
+			return
+		}
+
+		for _, item := range list {
+			if item.Type == 1 {
+				//音频
+				count, e := models.GetVoiceCollectCount(user.UserId, item.Id)
+				if e != nil {
+					err = errors.New("GetVoiceCollectCount, Err: " + e.Error())
+					return
+				}
+				if count > 0 {
+					item.IsCollect = true
+				}
+			} else if item.Type == 2 {
+				//活动视频
+				count, e := models.GetActivityVideoCollectCount(user.UserId, item.Id)
+				if e != nil {
+					err = errors.New("GetActivityVideoCollectCount, Err: " + e.Error())
+					return
+				}
+				if count > 0 {
+					item.IsCollect = true
+				}
+			} else if item.Type == 3 {
+				//微路演视频
+				count, e := models.GetVideoCollectCount(user.UserId, item.Id)
+				if e != nil {
+					err = errors.New("GetVideoCollectCount, Err: " + e.Error())
+					return
+				}
+				if count > 0 {
+					item.IsCollect = true
+				}
+			}
+		}
+		// 用户权限
+		authInfo, permissionArr, e := GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+		if e != nil {
+			err = errors.New("GetUserRaiPermissionInfo, Err: " + e.Error())
+			return
+		}
+
+		// 获取默认图配置
+		audioMap, videoMap, audioShareMap, videoShareMap, e := GetMicroRoadShowDefaultImgConfig()
+		if e != nil {
+			err = errors.New("GetMicroRoadShowDefaultImgConfig, Err: " + e.Error())
+			return
+		}
+		//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+		for i := range list {
+			// 权限
+			au := new(models.UserPermissionAuthInfo)
+			au.SellerName = authInfo.SellerName
+			au.SellerMobile = authInfo.SellerMobile
+			au.HasPermission = authInfo.HasPermission
+			au.OperationMode = authInfo.OperationMode
+			if au.HasPermission == 1 {
+				// 非宏观权限进一步判断是否有权限
+				if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
+					au.HasPermission = 2
+				}
+			}
+			// 无权限的弹框提示
+			if au.HasPermission != 1 {
+				if au.OperationMode == UserPermissionOperationModeCall {
+					if list[i].Type == 1 {
+						au.PopupMsg = UserPermissionPopupMsgCallActivity
+					} else {
+						au.PopupMsg = UserPermissionPopupMsgCallMicroVideo
+					}
+				} else {
+					if list[i].Type == 1 {
+						au.PopupMsg = UserPermissionPopupMsgApplyActivity
+					} else {
+						au.PopupMsg = UserPermissionPopupMsgApplyMicroVideo
+					}
+				}
+			}
+			list[i].AuthInfo = au
+			list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
+			// 默认图
+			if list[i].BackgroundImg == "" {
+				if list[i].Type == 1 {
+					list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
+				} else {
+					list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
+				}
+			}
+			// 分享图
+			if list[i].ShareImg == "" {
+				if list[i].Type == 1 {
+					list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
+				} else {
+					list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
+				}
+			}
+		}
+		//Type                int    `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
+		for _, item := range list {
+			if item.Type == 1 {
+				mapItems[fmt.Sprint("activityvoice", item.Id)].Activityvoice = item
+			} else if item.Type == 2 {
+				mapItems[fmt.Sprint("activityvideo", item.Id)].Activityvideo = item
+			} else if item.Type == 3 {
+				mapItems[fmt.Sprint("roadshow", item.Id)].Roadshow = item
+			}
+		}
+	}
+
+	for _, vList := range list {
+		for _, v := range mapItems {
+			if v.SourceId == vList.SourceId {
+				items = append(items, v)
+			}
+		}
+	}
+	return
+}
+
 //同步活动到最新数据表
 func UpdateResourceData(sourceId int, source, doType, publishDate string) (err error) {
 	defer func() {

+ 38 - 5
services/yidong.go

@@ -556,11 +556,13 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 	condition += ` AND  activity_time < ` + "'" + endDate + "'"
 	//fmt.Println(startDate)
 	//fmt.Println(endDate)
+	condition = ` `
 	artivityListYidong, err := models.GetActivityListByYidong(condition)
 	if err != nil {
 		fmt.Println("GetActivityListByYidong Err:", err.Error())
 		return err
 	}
+	//fmt.Println("artivityListYidong", artivityListYidong)
 	//return err
 	if len(artivityListYidong) == 0 {
 		return err
@@ -615,6 +617,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 			fmt.Println("UpdateCygxActivitySubmitMeetingByYidong Err:", err.Error())
 			return err
 		}
+		var mobiles []string
 		if len(ApifoxModal.Result) > 0 {
 			itemlog := new(models.CygxYidongActivityMeetingApiLog)
 			itemlog.YidongActivityId = v.YidongActivityId
@@ -625,13 +628,43 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 				fmt.Println("AddCygxYidongActivityMeetingApiLog Err:", err.Error())
 				return err
 			}
+			var itemsUpdate []*models.CygxActivitySignupDetail
+
 			for _, vresult := range ApifoxModal.Result {
 				if vresult.EndTime != "" {
-					err = models.UpdateCygxActivitySignupisMeet(v.ActivityId, vresult.PersonTelephone)
-					if err != nil {
-						fmt.Println("UpdateCygxActivitySignupisMeet Err:", err.Error())
-						return err
-					}
+					mobiles = append(mobiles, vresult.PersonTelephone)
+					//err = models.UpdateCygxActivitySignupisMeet(v.ActivityId, vresult.PersonTelephone)
+					//if err != nil {
+					//	fmt.Println("UpdateCygxActivitySignupisMeet Err:", err.Error())
+					//	return err
+					//}
+					var itemDetail = new(models.CygxActivitySignupDetail)
+					itemDetail.Mobile = vresult.PersonTelephone
+					itemDetail.OutboundMobile = vresult.PersonTelephone
+					itemDetail.FirstMeetingTime = vresult.StartTime
+					itemDetail.LastMeetingTime = vresult.EndTime
+					itemDetail.Duration = vresult.Duration
+					itemDetail.IsMeeting = 1
+					itemDetail.ActivityId = v.ActivityId
+					itemsUpdate = append(itemsUpdate, itemDetail)
+				}
+			}
+
+			lenmobiles := len(mobiles)
+			if lenmobiles > 0 {
+				var parsYd []interface{}
+				var conditionYd string
+				conditionYd = ` AND mobile  IN (` + utils.GetOrmInReplace(lenmobiles) + `) AND  activity_id=?  `
+				parsYd = append(parsYd, mobiles, v.ActivityId)
+				err = models.UpdateCygxActivitySignupisMeetList(conditionYd, parsYd)
+				if err != nil {
+					fmt.Println("UpdateCygxActivitySignupisMeetList Err:", err.Error())
+					return err
+				}
+				err = models.UpdateActivitySignupDetailMultiByYiDong(itemsUpdate)
+				if err != nil {
+					fmt.Println("UpdateActivitySignupDetailMultiByYiDong Err:", err.Error())
+					return err
 				}
 			}
 		}

+ 4 - 0
utils/constants.go

@@ -82,12 +82,16 @@ const (
 	CE_LUE_NAME                      string = "策略"
 	CE_LUE_ID                        int    = 23
 	YI_YAO_NAME                      string = "医药"
+	YI_YAO_OTHER_IMG                 string = "https://hzstatic.hzinsights.com/static/temp/20221118202211/20221118/qzPm61bVf40Je7c5iL1s4CbrDcpv.png" //医药其它图片
 	YI_YAO_ID                        int    = 22
 	XIAO_FEI_NAME                    string = "消费"
+	XIAO_FEI_OTHER_IMG               string = "https://hzstatic.hzinsights.com/static/temp/20221118202211/20221118/BxOfzECjhqjipJCWwAa9Ep99OTMA.png" //消费其它图片
 	XIAO_FEI_ID                      int    = 21
 	KE_JI_NAME                       string = "科技"
+	KE_JI_OTHER_IMG                  string = "https://hzstatic.hzinsights.com/static/temp/20221118202211/20221118/vr7eTXIrl6YjJ80DDTVbdnFRQ9mJ.png" //科技其它图片
 	KE_JI_ID                         int    = 20
 	ZHI_ZAO_NAME                     string = "智造"
+	ZHI_ZAO_OTHER_IMG                string = "https://hzstatic.hzinsights.com/static/temp/20221118202211/20221118/SSaQcWzMk5slN3FkCwZifK3qcAWd.png" //智造其它图片
 	ZHI_ZAO_ID                       int    = 19
 	LINK_WX_EXPLAIN                         = "https://mp.weixin.qq.com/s?__biz=Mzg2OTYzODk0Nw==&mid=2247483662&idx=1&sn=3752df99025189b9d77fe658bfc0edbd&chksm=ce98b742f9ef3e54b49986e647dd951a3aad74f323174b252174e0938c264c0562c8ec455106#rd" //用户阅读数据
 	ACTIVITY_SPECIAL_EXPLAIN                = "预报名专项调研行程持续更新中,满10家即开团,欢迎点击感兴趣预报名"                                                                                                                                                                //用户阅读数据