Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx_10.4

xingzai 2 years ago
parent
commit
0e155ff863
48 changed files with 2353 additions and 361 deletions
  1. 25 0
      controllers/article.go
  2. 1 1
      controllers/chart_permission.go
  3. 23 0
      controllers/config.go
  4. 4 4
      controllers/micro_roadshow.go
  5. 192 0
      controllers/morning_meeting.go
  6. 130 0
      controllers/product_interior.go
  7. 96 77
      controllers/report.go
  8. 1 0
      controllers/report_selection.go
  9. 122 94
      controllers/tactics.go
  10. 36 0
      controllers/user.go
  11. 28 0
      models/about_us_video_history.go
  12. 18 0
      models/admin.go
  13. 6 3
      models/article.go
  14. 110 0
      models/article_category_mapping.go
  15. 21 10
      models/article_history_record_newpv.go
  16. 91 0
      models/cygx_morning_meeting_gather.go
  17. 12 75
      models/cygx_morning_meeting_review_chapter.go
  18. 6 0
      models/db.go
  19. 30 0
      models/industrial_management.go
  20. 2 2
      models/micro_roadshow.go
  21. 156 0
      models/product_interior.go
  22. 39 0
      models/product_interior_history.go
  23. 116 1
      models/report.go
  24. 97 0
      models/report_mapping.go
  25. 12 0
      models/report_selection.go
  26. 22 18
      models/resource_data.go
  27. 1 1
      models/user.go
  28. 42 0
      models/xzs_choose_category.go
  29. 45 0
      routers/commentsRouter.go
  30. 10 0
      routers/router.go
  31. 35 1
      services/admin.go
  32. 72 0
      services/article.go
  33. 34 0
      services/article_history.go
  34. 20 15
      services/chart.go
  35. 29 0
      services/config.go
  36. 13 0
      services/industrial_management.go
  37. 98 0
      services/init_10.3.go
  38. 35 12
      services/micro_roadshow.go
  39. 74 0
      services/morning_meeting.go
  40. 3 4
      services/page_history_record.go
  41. 163 0
      services/product_interior.go
  42. 70 0
      services/report_mapping.go
  43. 83 2
      services/resource_data.go
  44. 3 0
      services/task.go
  45. 32 0
      services/user.go
  46. 59 37
      services/yidong.go
  47. 27 0
      utils/common.go
  48. 9 4
      utils/constants.go

+ 25 - 0
controllers/article.go

@@ -86,6 +86,31 @@ func (this *ArticleController) Detail() {
 	if _, ok := lyjhTypeMap[detail.CategoryId]; ok {
 		detail.IsRoadShow = true
 	}
+
+	// 高毅资产的联系人,有权限的行业也不能查看报告详情页。提示无权限页面
+	if detail.ArticleTypeId == 0 && user.CompanyId == utils.GAO_YI_ZI_CHAN_COMPANY_ID {
+		_, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionArticle(user)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
+			return
+		}
+		resp.PopupMsg = popupMsg
+		resp.HasPermission = 3
+		resp.SellerName = sellerName
+		resp.SellerMobile = sellerMobile
+		detail.Body = ""
+		detail.Abstract = ""
+		detail.BodyText = ""
+		detail.SellerName = sellerName
+		detail.SellerMobile = sellerMobile
+		resp.Detail = detail
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = resp
+		return
+	}
 	articleCollectMap, _ := services.GetCygxArticleCollectMap(user.UserId)
 	detail.IsCollect = articleCollectMap[detail.ArticleId]
 	if isSendWx == 1 {

+ 1 - 1
controllers/chart_permission.go

@@ -173,7 +173,7 @@ func (this *ChartPermissionAuthController) StrategyDetail() {
 		chartPermissionId = utils.CE_LUE_ID
 	}
 	uid := user.UserId
-	list, err := models.GetReportMappingStrategyHomeAll(chartPermissionId)
+	list, err := models.GetReportMappingStrategyHomeAllByCygx(chartPermissionId)
 
 	if err != nil {
 		br.Msg = "获取信息失败"

+ 23 - 0
controllers/config.go

@@ -215,3 +215,26 @@ func (this *ConfigController) KeyWordLog() {
 	br.Success = true
 	br.Msg = "新增成功"
 }
+
+// @Title 关于我们浏览记录
+// @Description 关于我们浏览记录接口
+// @Success 200
+// @router /aboutUs/addHistory [post]
+func (this *ConfigController) AboutUsAdd() {
+	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
+	}
+	go services.AddCygxAboutUsVideoHistory(user)
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功!"
+}

+ 4 - 4
controllers/micro_roadshow.go

@@ -27,7 +27,7 @@ type MicroRoadShowController struct {
 // @Param   ActivityVideoIds	query	string		false	"活动视频IDs"
 // @Param   VideoIds			query	string		false	"视频IDs"
 // @Param   ActivityVideoId			query	int		false	"活动视频ID"
-// @Param   Filter			query	int		false	"筛选条件 0:全部 1:视频 2:音频"
+// @Param   Filter			query	string		false	"筛选条件 为空:全部 1:视频 2:音频 3:逻辑解析 4:路演回放 多个用 , 隔开"
 // @Success 200 {object} models.HomeListResp
 // @router /list [get]
 func (this *MicroRoadShowController) List() {
@@ -52,7 +52,7 @@ func (this *MicroRoadShowController) List() {
 	videoIds := this.GetString("VideoIds")
 	activityVideoIds := this.GetString("ActivityVideoIds")
 	activityVideoId, _ := this.GetInt("ActivityVideoId")
-	filter, _ := this.GetInt("Filter", 0)
+	filter := this.GetString("Filter")
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
 	}
@@ -83,7 +83,7 @@ func (this *MicroRoadShowController) List() {
 	if keywords != "" {
 		var pageSizeIk int
 		//获取总的数量
-		totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, filter, keyWordArr, audioIds, videoIds, activityVideoIds)
+		totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, keyWordArr, filter, audioIds, videoIds, activityVideoIds)
 		if e != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取微路演联想词列表失败, Err: " + e.Error()
@@ -97,7 +97,7 @@ func (this *MicroRoadShowController) List() {
 			startSizeIk = 0
 		}
 		if pageSizeIk > 0 {
-			lisIk, e := services.GetMicroRoadShowPageListIkWord(startSizeIk, pageSizeIk, audioId, videoId, activityVideoId, filter, keyWordArr, audioIds, videoIds, activityVideoIds, keywords)
+			lisIk, e := services.GetMicroRoadShowPageListIkWord(startSizeIk, pageSizeIk, audioId, videoId, activityVideoId, keyWordArr, filter, audioIds, videoIds, activityVideoIds, keywords)
 			if e != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()

+ 192 - 0
controllers/morning_meeting.go

@@ -0,0 +1,192 @@
+package controllers
+
+import (
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/services"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"strings"
+)
+
+// 晨会精华
+type MorningMeetingController struct {
+	BaseAuthController
+}
+
+// @Title 晨会精华汇总列表
+// @Description 晨会精华汇总列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success Ret=200 {object} cygx.GetCygxTacticsTimeLineResp
+// @router /gather/list [get]
+func (this *MorningMeetingController) GatherList() {
+	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
+	}
+	resp := new(models.CygxMorningMeetingGatherListResp)
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	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{}
+	condition += ` AND status = 1   AND  meeting_ids != '' `
+	total, err := models.GetCygxMorningMeetingGatherCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	condition += "	ORDER BY publish_time DESC ,id  DESC "
+	list, err := models.GetCygxMorningMeetingGatherList(condition, pars, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	var meetids string
+	for _, v := range list {
+		meetids += v.MeetingIds + ","
+	}
+	meetids = strings.TrimRight(meetids, ",")
+	mapMeetName := make(map[string]string)
+	if meetids != "" {
+		pars = make([]interface{}, 0)
+		condition = ` 	AND id  IN(` + meetids + `) AND  status = 1  `
+		listMeet, err := models.GetCygxMorningMeetingReviewsList(condition, pars, 0, 10000)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + err.Error()
+		}
+		for _, v := range listMeet {
+			mapMeetName[strconv.Itoa(v.Id)] = v.IndustryNames
+		}
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	for _, v := range list {
+		item := new(models.CygxMorningMeetingGatherResp)
+		item.Id = v.Id
+		item.Title = v.Title
+		sliceMeetingIds := strings.Split(v.MeetingIds, ",")
+		for _, vM := range sliceMeetingIds {
+			if mapMeetName[vM] != "" {
+				item.IndustryName += mapMeetName[vM] + ","
+			}
+		}
+		item.IndustryName = strings.TrimRight(item.IndustryName, ",")
+		item.IndustryName = strings.Replace(item.IndustryName, ",", "】,【", -1)
+		item.IndustryName = "【" + item.IndustryName + "】"
+		resp.List = append(resp.List, item)
+	}
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 晨会精华汇总详情
+// @Description 晨会精华汇总详情接口
+// @Param   Id   query   int  true       "Id"
+// @Success Ret=200 {object} cygx.GetCygxTacticsTimeLineResp
+// @router /gather/detail [get]
+func (this *MorningMeetingController) GatherDetail() {
+	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
+	}
+	id, _ := this.GetInt("Id")
+	resp := new(models.CygxMorningMeetingGatherDetailResp)
+	hasPermission, err := services.GetUserhasPermission(user)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
+	}
+	resp.HasPermission = hasPermission
+	if hasPermission != 1 {
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = resp
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition += ` AND status = 1 AND  id = ?  `
+	pars = append(pars, id)
+	total, err := models.GetCygxMorningMeetingGatherCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	if total == 0 {
+		br.Msg = "内容不存在,或未发布"
+	}
+	detail, err := models.GetCygxMorningMeetingGatherById(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	var meetids string
+	meetids = detail.MeetingIds
+	detailResp := new(models.CygxMorningMeetingGatherDetail)
+	if meetids != "" {
+		pars = make([]interface{}, 0)
+		condition = ` 	AND meeting_id  IN(` + meetids + `) `
+		listMeet, err := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + err.Error()
+		}
+		detailResp.List = listMeet
+		//for _, v := range listMeet {
+		//	detailResp.List = append(detailResp.List, &models.CygxMorningMeetingGatherDetailListResp{
+		//		Id:                  v.Id,
+		//		IndustryId:          v.IndustryId,
+		//		IndustryName:        v.IndustryName,
+		//		ChartPermissionName: v.ChartPermissionName,
+		//		ChartPermissionId:   v.ChartPermissionId,
+		//		MeetingId:           int(v.MeetingId),
+		//		Content:             v.Content,
+		//	})
+		//}
+	} else {
+		detailResp.List = make([]*models.CygxMorningMeetingGatherDetailListResp, 0)
+	}
+	detailResp.Id = detail.Id
+	detailResp.Title = detail.Title
+	detailResp.PublishTime = utils.GetTimeDateRemoveYear(detail.PublishTime)
+	detailResp.Department = "弘则产品组"
+	resp.Detail = detailResp
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 130 - 0
controllers/product_interior.go

@@ -0,0 +1,130 @@
+package controllers
+
+import (
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/services"
+	"hongze/hongze_cygx/utils"
+)
+
+// 产品内测
+type ProductInteriorController struct {
+	BaseAuthController
+}
+
+// @Title 列表
+// @Description 列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success Ret=200 {object} cygx.GetCygxTacticsTimeLineResp
+// @router /list [get]
+func (this *ProductInteriorController) List() {
+	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
+	}
+	resp := new(models.GetCygxProductInteriorResp)
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	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{}
+	condition += ` AND art.status = 1 `
+	total, err := models.GetCygxProductInteriorCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	condition += "	ORDER BY art.publish_time DESC , art.product_interior_id DESC "
+	list, err := models.GetCygxProductInteriorList(condition, pars, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	for _, v := range list {
+		v.PublishTime = utils.TimeRemoveHms(v.PublishTime)
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = list
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title  详情
+// @Description 获取详情接口
+// @Param   ProductInteriorId   query   int  true       "ID"
+// @Success Ret=200 {object} cygx.GetCygxProductInteriorDetailResp
+// @router /detail [get]
+func (this *ProductInteriorController) 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
+	}
+	resp := new(models.GetCygxProductInteriorDetailResp)
+	productInteriorId, _ := this.GetInt("ProductInteriorId")
+	if productInteriorId < 1 {
+		br.Msg = "请输入详情ID"
+		return
+	}
+	detail, err := models.GetCygxProductInteriorDetail(productInteriorId)
+	if err != nil {
+		br.Msg = "详情不存在"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	//判断用户权限
+	hasPermission, err := services.GetUserhasPermission(user)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
+	}
+	//未设置全部可见的只能给弘则内部查看
+	if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
+		resp.IsShow = true
+	}
+	resp.HasPermission = hasPermission
+	if hasPermission != 1 || !resp.IsShow {
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = resp
+		return
+	}
+	detail.PublishTime = utils.TimeRemoveHms2(detail.PublishTime)
+	resp.Detail = detail
+	detail.BodySlice = services.GetProductInteriorUrlBody(detail.Body)
+	go services.AddCygxProductInteriorHistory(user, productInteriorId)
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 96 - 77
controllers/report.go

@@ -41,27 +41,36 @@ func (this *ReportController) TradeList() {
 		br.Ret = 408
 		return
 	}
-	uid := user.UserId
+	//uid := user.UserId
 	ChartPermissionId, _ := this.GetInt("ChartPermissionId")
 	if ChartPermissionId < 1 {
 		br.Msg = "请输入分类ID"
 		return
 	}
-	list, err := models.GetTradeAll(ChartPermissionId)
+	listCategory, err := models.GetTradeArticleAndProductInterior(ChartPermissionId)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
-	var condition string
-	var pars []interface{}
-	for k, v := range list {
-		if v.PolymerizationId != "" {
-			condition = ` AND a.category_id IN(` + v.PolymerizationId + `)`
-		} else {
-			condition = ` AND a.category_id IN(` + strconv.Itoa(v.CategoryId) + `)`
+	var list []*models.TradeReportMapping
+	categoryMap := make(map[int]int)
+	for _, v := range listCategory {
+		if categoryMap[v.CategoryId] > 0 {
+			continue
 		}
-		listArticle, err := models.GetHomeList(condition, pars, 0, 1)
+		categoryMap[v.CategoryId] = v.CategoryId
+		list = append(list, v)
+	}
+	//var condition string
+	//var pars []interface{}
+	for k, v := range list {
+		//if v.PolymerizationId != "" {
+		//	condition = ` AND a.category_id IN(` + v.PolymerizationId + `)`
+		//} else {
+		//	condition = ` AND a.category_id IN(` + strconv.Itoa(v.CategoryId) + `)`
+		//}
+		listArticle, _, err := models.GetReportAndproductIndustrylList(v.CategoryId, 0, 1)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取信息失败"
 			br.Msg = "GetHomeList,Err:" + err.Error()
@@ -70,15 +79,15 @@ func (this *ReportController) TradeList() {
 		if len(listArticle) > 0 {
 			list[k].UpdateTime = utils.StrTimeToTime(listArticle[0].PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
 
-			count, err := models.CheckThisCategoryNewArticleIsRead(uid, v.CategoryId)
-			if err != nil {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
-				return
-			}
-			if count == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.UpdateTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.UpdateTime)) {
-				list[k].IsRed = true
-			}
+			//count, err := models.CheckThisCategoryNewArticleIsRead(uid, v.CategoryId)
+			//if err != nil {
+			//	br.Msg = "获取信息失败"
+			//	br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
+			//	return
+			//}
+			//if count == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.UpdateTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.UpdateTime)) {
+			//	list[k].IsRed = true
+			//}
 		}
 	}
 	resp := new(models.TradeReportMappingResp)
@@ -273,7 +282,7 @@ func (this *ReportController) ArticleCategoryList() {
 		br.Ret = 408
 		return
 	}
-	uid := user.UserId
+	//uid := user.UserId
 	industrialManagementId, _ := this.GetInt("IndustrialManagementId")
 	if industrialManagementId < 1 {
 		br.Msg = "请输入分类ID"
@@ -288,31 +297,37 @@ func (this *ReportController) ArticleCategoryList() {
 		br.ErrMsg = "获取信息失败,Err:" + err.Error()
 		return
 	}
-	list, err := models.IndustrialToArticleCategoryNew(industrialManagementId)
+	listCategory, err := models.IndustrialToArticleAndProductInteriorCategoryNew(industrialManagementId)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
-
-	for k, v := range list {
-		recordCount, err := models.IndustrialUserRecordArticleCount(uid, industrialManagementId, v.CategoryId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-			return
-		}
-		Newdetail, err := models.GetNewIndustrialUserRecordArticle(industrialManagementId, v.CategoryId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取信息失败,Err:" + err.Error()
-			return
-		}
-		if Newdetail != nil {
-			if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(Newdetail.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(Newdetail.PublishDate)) {
-				list[k].IsRed = true
-			}
+	var list []*models.IndustrialToArticleCategoryRep
+	categoryMap := make(map[int]int)
+	for _, v := range listCategory {
+		if categoryMap[v.CategoryId] > 0 {
+			continue
 		}
+		categoryMap[v.CategoryId] = v.CategoryId
+		list = append(list, v)
+		//recordCount, err := models.IndustrialUserRecordArticleCount(uid, industrialManagementId, v.CategoryId)
+		//if err != nil && err.Error() != utils.ErrNoRow() {
+		//	br.Msg = "获取信息失败"
+		//	br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
+		//	return
+		//}
+		//Newdetail, err := models.GetNewIndustrialUserRecordArticle(industrialManagementId, v.CategoryId)
+		//if err != nil && err.Error() != utils.ErrNoRow() {
+		//	br.Msg = "获取信息失败"
+		//	br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		//	return
+		//}
+		//if Newdetail != nil {
+		//	if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(Newdetail.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(Newdetail.PublishDate)) {
+		//		list[k].IsRed = true
+		//	}
+		//}
 	}
 
 	// 用户权限
@@ -508,42 +523,43 @@ func (this *ReportController) List() {
 	if categoryId != 99999 {
 		resp := new(models.TacticsListResp)
 		//获取该产业下所对应的行业图片
-		detail, errCategory := models.GetdetailByCategoryIdOne(categoryId)
-		if errCategory != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
-			return
-		}
-		//对应行业的图片
-		detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
-		if err != nil {
-			br.Msg = "获取数据失败"
-			br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-			return
-		}
-		chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
-		mapChartPermission := make(map[string]string)
-		var permissionName string
-		var imgUrlChartPermission string
-		for _, v := range chartPermissionUrlList {
-			vslice := strings.Split(v, "_")
-			permissionName = vslice[0]
-			imgUrlChartPermission = vslice[len(vslice)-1]
-			mapChartPermission[permissionName] = imgUrlChartPermission
-		}
-		total, err = models.GetReportIndustrialCount(categoryId, industrialManagementId)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
-			return
-		}
-		page = paging.GetPaging(currentIndex, pageSize, total)
-		list, err := models.GetReportIndustrialList(pars, categoryId, industrialManagementId, uid, startSize, pageSize)
+		//detail, errCategory := models.GetdetailByCategoryIdOne(categoryId)
+		//if errCategory != nil {
+		//	br.Msg = "获取信息失败"
+		//	br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
+		//	return
+		//}
+		////对应行业的图片
+		//detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
+		//if err != nil {
+		//	br.Msg = "获取数据失败"
+		//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
+		//	return
+		//}
+		//chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
+		//mapChartPermission := make(map[string]string)
+		//var permissionName string
+		//var imgUrlChartPermission string
+		//for _, v := range chartPermissionUrlList {
+		//	vslice := strings.Split(v, "_")
+		//	permissionName = vslice[0]
+		//	imgUrlChartPermission = vslice[len(vslice)-1]
+		//	mapChartPermission[permissionName] = imgUrlChartPermission
+		//}
+		//total, err := models.GetReportIndustrialCount(categoryId, industrialManagementId)
+		//if err != nil {
+		//	br.Msg = "获取信息失败"
+		//	br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
+		//	return
+		//}
+
+		list, total, err := models.GetReportAndproductInteriorIndustrialList(pars, categoryId, industrialManagementId, uid, startSize, pageSize)
 		if err != nil {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
 			return
 		}
+		page = paging.GetPaging(currentIndex, pageSize, total)
 		//对应分类的所图片
 		detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
 		if err != nil {
@@ -577,16 +593,18 @@ func (this *ReportController) List() {
 				list[k].IsHaveVideo = true
 			}
 			list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
-
-			if mapCategoryUrl[v.CategoryId] == "" {
-				if detail.ChartPermissionId == utils.YI_YAO_ID {
-					list[k].ImgUrlPc = utils.YI_YAO_QI_TA
-				}
+			if v.Resource == 2 {
+				v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
 			}
+			//if mapCategoryUrl[v.CategoryId] == "" {
+			//	if detail.ChartPermissionId == utils.YI_YAO_ID {
+			//		list[k].ImgUrlPc = utils.YI_YAO_QI_TA
+			//	}
+			//}
 		}
 
-		resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
-		resp.ChartPermissionId = detail.ChartPermissionId
+		//resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
+		//resp.ChartPermissionId = detail.ChartPermissionId
 		resp.List = list
 		resp.Paging = page
 		br.Ret = 200
@@ -1420,6 +1438,7 @@ func (this *ReportController) IsShow() {
 	resp.ActivitySpecialExplain = utils.ACTIVITY_SPECIAL_EXPLAIN
 	//resp.YanXuan_Explain = true
 	resp.IsShowFreeButton = IsShowFreeButton
+	resp.IsBelongRai = services.GetBelongingRai(user.Mobile)
 	//mobile := user.Mobile
 	//if mobile == "" {
 	//	br.Ret = 200

+ 1 - 0
controllers/report_selection.go

@@ -75,6 +75,7 @@ func (this *ReportSelectionController) Detail() {
 	}
 	resp.HasPermission = hasPermission
 	if hasPermission != 1 || !resp.IsShow {
+		resp.Detail = detail
 		br.Ret = 200
 		br.Success = true
 		br.Msg = "获取成功"

+ 122 - 94
controllers/tactics.go

@@ -42,7 +42,7 @@ func (this *TacticsController) List() {
 		br.Ret = 408
 		return
 	}
-	uid := user.UserId
+	//uid := user.UserId
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 	categoryId, _ := this.GetInt("CategoryId")
@@ -56,99 +56,121 @@ func (this *TacticsController) List() {
 	}
 	startSize = paging.StartIndex(currentIndex, pageSize)
 
-	var condition string
-	var listTacticsSrt string
-	var pars []interface{}
-	var total int
+	//var condition string
+	//var listTacticsSrt string
+	//var pars []interface{}
+	//var total int
 	resp := new(models.TacticsListResp)
-	page := paging.GetPaging(currentIndex, pageSize, total)
+	//page := paging.GetPaging(currentIndex, pageSize, total)
 
 	//获取该产业下所对应的行业图片
-	detail, errCategory := models.GetdetailByCategoryIdOneByHangye(categoryId)
-	if errCategory != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
-		return
-	}
+	//detail, errCategory := models.GetdetailByCategoryIdOneByHangye(categoryId)
+	//if errCategory != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
+	//	return
+	//}
 	//对应行业的图片
-	detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
-	if err != nil {
-		br.Msg = "获取数据失败"
-		br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-		return
-	}
-	chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
-	mapChartPermission := make(map[string]string)
-	var permissionName string
-	var imgUrlChartPermission string
-	for _, v := range chartPermissionUrlList {
-		vslice := strings.Split(v, "_")
-		permissionName = vslice[0]
-		imgUrlChartPermission = vslice[len(vslice)-1]
-		mapChartPermission[permissionName] = imgUrlChartPermission
-	}
+	//detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
+	//if err != nil {
+	//	br.Msg = "获取数据失败"
+	//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
+	//	return
+	//}
+	//chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
+	//mapChartPermission := make(map[string]string)
+	//var permissionName string
+	//var imgUrlChartPermission string
+	//for _, v := range chartPermissionUrlList {
+	//	vslice := strings.Split(v, "_")
+	//	permissionName = vslice[0]
+	//	imgUrlChartPermission = vslice[len(vslice)-1]
+	//	mapChartPermission[permissionName] = imgUrlChartPermission
+	//}
 
 	//对应分类的所图片
-	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 categoryIdStr string
-	var imgUrlChart string
-	for _, v := range categoryUrlList {
-		vslice := strings.Split(v, "_")
-		categoryIdStr = vslice[0]
-		imgUrlChart = vslice[len(vslice)-1]
-		mapCategoryUrl[categoryIdStr] = imgUrlChart
-	}
+	//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 categoryIdStr string
+	//var imgUrlChart string
+	//for _, v := range categoryUrlList {
+	//	vslice := strings.Split(v, "_")
+	//	categoryIdStr = vslice[0]
+	//	imgUrlChart = vslice[len(vslice)-1]
+	//	mapCategoryUrl[categoryIdStr] = imgUrlChart
+	//}
 
-	if categoryId < 0 {
-		listTactics, err := models.GetReportMappingStrategyAll()
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取分类权限信息失败,Err:" + err.Error()
-			return
-		}
-		for _, v := range listTactics {
-			listTacticsSrt = listTacticsSrt + strconv.Itoa(v.CategoryId) + `,`
-		}
-		listTacticsSrt = strings.TrimRight(listTacticsSrt, ",")
-		condition = ` AND category_id IN(` + listTacticsSrt + `)`
-	} else {
-		if detail.CeLueFieldId != "" {
-			condition = ` AND ce_lue_field_id IN(` + detail.CeLueFieldId + `)`
-		} else if detail.PolymerizationId != "" {
-			condition = ` AND category_id IN(` + detail.PolymerizationId + `)`
-		} else {
-			condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`
-		}
-	}
-	total, err = models.GetHomeCount(condition, pars)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.Msg = "获取帖子总数失败,Err:" + err.Error()
-		return
-	}
-	page = paging.GetPaging(currentIndex, pageSize, total)
-	list, err := models.GetReportTacticsList(condition, pars, uid, startSize, pageSize)
+	//if categoryId < 0 {
+	//	listTactics, err := models.GetReportMappingStrategyAll()
+	//	if err != nil && err.Error() != utils.ErrNoRow() {
+	//		br.Msg = "获取信息失败"
+	//		br.ErrMsg = "获取分类权限信息失败,Err:" + err.Error()
+	//		return
+	//	}
+	//	for _, v := range listTactics {
+	//		listTacticsSrt = listTacticsSrt + strconv.Itoa(v.CategoryId) + `,`
+	//	}
+	//	listTacticsSrt = strings.TrimRight(listTacticsSrt, ",")
+	//	condition = ` AND category_id IN(` + listTacticsSrt + `)`
+	//} else {
+	//	if detail.CeLueFieldId != "" {
+	//		condition = ` AND ce_lue_field_id IN(` + detail.CeLueFieldId + `)`
+	//	} else if detail.PolymerizationId != "" {
+	//		condition = ` AND category_id IN(` + detail.PolymerizationId + `)`
+	//	} else {
+	//		condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`
+	//	}
+	//}
+	//total, err = models.GetHomeCount(condition, pars)
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.Msg = "获取帖子总数失败,Err:" + err.Error()
+	//	return
+	//}
+
+	//list, err := models.GetReportTacticsList(condition, pars, uid, startSize, pageSize)
+
+	list, total, err := models.GetReportAndproductIndustrylList(categoryId, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.Msg = "获取帖子数据失败,Err:" + err.Error()
 		return
 	}
-
+	var articleIds []int
+	var productInteriorIs []int
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	for _, v := range list {
+		//if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
+		//	list[k].IsRed = true
+		//}
+		if v.Resource == 1 {
+			articleIds = append(articleIds, v.ArticleId)
+		} else {
+			productInteriorIs = append(productInteriorIs, v.ArticleId)
+		}
+		//list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
+	}
+	ArticleHistoryMap := services.GetArticleHistoryByUser(articleIds, user)
+	ProductInteriorHistoryMap := services.GetCygxProductInteriorHistoryListMap(articleIds, user)
 	for k, v := range list {
-		if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
-			list[k].IsRed = true
+		if v.Resource == 1 {
+			if ArticleHistoryMap[v.ArticleId] == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
+				list[k].IsRed = true
+			}
+		} else {
+			if ProductInteriorHistoryMap[v.ArticleId] == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
+				list[k].IsRed = true
+			}
 		}
-		list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
 	}
 	if categoryId > 0 {
-		detail, errCategory := models.GetdetailByCategoryId(categoryId)
+		detail, errCategory := models.GetCygxReportMappingCygxByCategoryId(categoryId)
 		if errCategory != nil {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
@@ -156,24 +178,30 @@ func (this *TacticsController) List() {
 		}
 		resp.MatchTypeName = detail.MatchTypeName
 	}
-	lenList := len(list)
-	for i := 0; i < lenList; i++ {
-		item := list[i]
-		list[i].Body, _ = services.GetReportContentTextSub(item.Body)
-		list[i].Abstract = html.UnescapeString(item.Abstract)
-		//list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
-		list[i].Annotation = strings.Replace(item.Annotation, "<br>", "", -1)
-		//行业比较研究、资金流向,显示报告的摘要
-		if resp.MatchTypeName == "行业比较研究" || resp.MatchTypeName == "资金流向" {
-			list[i].Annotation = list[i].Abstract
+
+	for _, v := range list {
+		if v.Resource == 2 {
+			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
 		}
-		//if item.ArticleId == 6881 {
-		//	fmt.Println(list[i].Annotation)
-		//}
-		list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
 	}
-
-	resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
+	//lenList := len(list)
+	//for i := 0; i < lenList; i++ {
+	//	item := list[i]
+	//	list[i].Body, _ = services.GetReportContentTextSub(item.Body)
+	//	list[i].Abstract = html.UnescapeString(item.Abstract)
+	//	//list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
+	//	list[i].Annotation = strings.Replace(item.Annotation, "<br>", "", -1)
+	//	//行业比较研究、资金流向,显示报告的摘要
+	//	if resp.MatchTypeName == "行业比较研究" || resp.MatchTypeName == "资金流向" {
+	//		list[i].Annotation = list[i].Abstract
+	//	}
+	//	//if item.ArticleId == 6881 {
+	//	//	fmt.Println(list[i].Annotation)
+	//	//}
+	//	list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
+	//}
+	//
+	//resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
 	resp.List = list
 	resp.Paging = page
 	br.Ret = 200

+ 36 - 0
controllers/user.go

@@ -891,6 +891,42 @@ func (this *UserController) ApplyTryOut() {
 			return
 		}
 		title = microVideo.VideoName
+	} else if tryType == "Researchsummary" {
+		// 本周研究汇总
+		ResearchSummaryInfo, e := models.GetCygxResearchSummaryInfoById(detailId)
+		if e != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "本周研究汇总信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
+			return
+		}
+		title = ResearchSummaryInfo.Title
+	} else if tryType == "Minutessummary" {
+		// 上周纪要汇总
+		MinutesSummaryInfo, e := models.GetCygxMinutesSummaryInfoById(detailId)
+		if e != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "上周纪要汇总信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
+			return
+		}
+		title = MinutesSummaryInfo.Title
+	} else if tryType == "ReportSelection" {
+		// 报告精选
+		ReportSelectionInfo, e := models.GetCygxReportSelectionInfoById(detailId)
+		if e != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "报告精选信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
+			return
+		}
+		title = ReportSelectionInfo.Title
+	} else if tryType == "ProductInterior" {
+		// 产品内测
+		ProductInteriorDetail, e := models.GetCygxProductInteriorDetail(detailId)
+		if e != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "产品内测信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
+			return
+		}
+		title = ProductInteriorDetail.Title
 	}
 
 	fmt.Println(title)

+ 28 - 0
models/about_us_video_history.go

@@ -0,0 +1,28 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxAboutUsVideoHistory struct {
+	Id               int `orm:"column(id);pk"`
+	UserId           int
+	CreateTime       time.Time
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	ModifyTime       time.Time `description:"修改时间"`
+	RealName         string    `description:"用户实际名称"`
+	SellerName       string    `description:"所属销售"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
+}
+
+// 添加历史信息
+func AddCygxAboutUsVideoHistory(item *CygxAboutUsVideoHistory) (lastId int64, err error) {
+	o := orm.NewOrm()
+	item.ModifyTime = time.Now()
+	lastId, err = o.Insert(item)
+	return
+}

+ 18 - 0
models/admin.go

@@ -60,3 +60,21 @@ func GetSysAdminById(adminId int) (item *Admin, err error) {
 	err = o.Raw(sql, adminId).QueryRow(&item)
 	return
 }
+
+// 获取权益内部人员手机号
+func GetRaiAdmin() (items []*AdminMobileResp, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT
+	mobile
+FROM
+	admin 
+WHERE
+	role_type_code LIKE '%rai%' 
+	AND group_id NOT IN ( 19, 10 ) 
+	AND enabled = 1 
+	OR (
+	department_name = '产品技术部' 
+	AND enabled = 1) `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 6 - 3
models/article.go

@@ -404,6 +404,7 @@ type ReportArticle struct {
 	ImgUrlPc         string `description:"图片链接"`
 	CategoryId       string `description:"文章分类"`
 	Annotation       string `description:"核心观点"`
+	Resource         int    `description:"来源类型,1:文章、2:产品内测"`
 }
 
 func GetReportPermission(categoryName string) (item []*ChartPermission, err error) {
@@ -439,10 +440,12 @@ func GetPermissionMappingCategoryID() (item []*PermissionMappingCategoryRep, err
 
 // 检查用户是否阅读某一分类最新文章
 func GetUserIsReadThisNewCategoryArticleCount(categoryId, uid int) (count int, err error) {
-	sqlCount := `SELECT COUNT(1) as count FROM
+	sqlCount := `SELECT
+	COUNT( 1 ) AS count 
+FROM
 	cygx_article_history_record 
-	WHERE
-	article_id = ( SELECT article_id FROM cygx_article WHERE category_id = ? ORDER BY publish_date DESC LIMIT 0, 1 )
+WHERE
+	article_id = ( SELECT article_id FROM cygx_article WHERE category_id IN ( SELECT category_id_celue FROM cygx_report_mapping_group WHERE id_cygx = ? ) ORDER BY publish_date DESC LIMIT 0, 1 ) 
 	AND user_id = ?`
 	o := orm.NewOrm()
 	err = o.Raw(sqlCount, categoryId, uid).QueryRow(&count)

+ 110 - 0
models/article_category_mapping.go

@@ -0,0 +1,110 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+	//"time"
+)
+
+type CygxArticleCategoryMapping struct {
+	Id                  int    `orm:"column(id);pk" description:"id"`
+	ChartPermissionId   int    `description:"行业ID"`
+	CategoryId          int    `description:"分类ID"`
+	ChartPermissionName string `description:"行业名称"`
+	MatchTypeName       string `description:"分类名称"`
+	ReportType          int    `description:"报告类型,2产业报告,1行业报告"`
+	SubCategoryName     string `description:"主题"`
+	Sort                int    `description:"排序"`
+	IsCustom            int    `description:"是否属于自定义的匹配类型 ,1是,0否"`
+	IsSummary           int    `description:"是否是纪要库,1是,0否"`
+	IsReport            int    `description:"是否是报告,1是,0否"`
+	PermissionType      int    `description:"1主观,2客观"`
+	CygxId              int    `description:"分类聚合ID"`
+	CeLueId             int    `description:"策略平台领域ID"`
+}
+
+// 添加
+func AddCygxArticleCategoryMapping(item *CygxArticleCategoryMapping) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+type CygxReportMappingCygx struct {
+	Id                  int    `orm:"column(id);pk" description:"id"`
+	ChartPermissionId   int    `description:"行业ID"`
+	ChartPermissionName string `description:"行业名称"`
+	MatchTypeName       string `description:"分类名称"`
+	ReportType          int    `description:"报告类型,2产业报告,1行业报告"`
+	Sort                int    `description:"排序"`
+	IsCustom            int    `description:"是否属于自定义的匹配类型 ,1是,0否"`
+	IsSummary           int    `description:"是否是纪要库,1是,0否"`
+	IsReport            int    `description:"是否是报告,1是,0否"`
+	PermissionType      int    `description:"1主观,2客观"`
+}
+
+type CygxReportMappingGroup struct {
+	Id              int       `orm:"column(id);pk" description:"id"`
+	IdCygx          int       `description:"分类ID"`
+	CategoryIdCelue int       `description:"分类ID"`
+	CreateTime      time.Time `description:"创建时间"`
+	ModifyTime      time.Time `description:"更新时间"`
+}
+
+// 添加
+func AddCygxReportMappingGroup(item *CygxReportMappingGroup) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+// 添加
+func AddCygxReportMappingCygx(item *CygxReportMappingCygx) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+// 获取数量
+func GetCygxReportMappingCygxCount(condition string) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_report_mapping_cygx as art WHERE 1= 1  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount).QueryRow(&count)
+	return
+}
+
+// 获取所有的报告分类 查研观向
+func GetCygxReportMappingCygx() (items []*CygxReportMappingCygx, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+				* 
+			FROM
+				cygx_report_mapping_cygx `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// 获取所有的报告分类 策略
+func GetCygxReportMappingcelue(condition string) (items []*CygxReportMapping, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+				* 
+			FROM
+				cygx_report_mapping_celue WHERE 1= 1  `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// 通过分类ID获取详情
+func GetCygxReportMappingCygxByCategoryId(categoryId int) (item *CygxReportMappingCygx, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_report_mapping_cygx WHERE  id=? `
+	err = o.Raw(sql, categoryId).QueryRow(&item)
+	return
+}

+ 21 - 10
models/article_history_record_newpv.go

@@ -23,7 +23,7 @@ type CygxArticleHistoryRecordNewpv struct {
 	Source      string `description:"来源,MOBILE:手机端,PC:电脑端"`
 }
 
-//添加阅读记录信息
+// 添加阅读记录信息
 func AddCygxArticleViewRecordNewpv(item *CygxArticleHistoryRecordNewpv) (lastId int64, err error) {
 	o, err := orm.NewOrm().Begin()
 	if err != nil {
@@ -69,7 +69,7 @@ func AddCygxArticleViewRecordNewpv(item *CygxArticleHistoryRecordNewpv) (lastId
 	return
 }
 
-//获取最新的一条阅读记录
+// 获取最新的一条阅读记录
 func GetNewArticleHistoryRecordNewpv(uid, articleId int, modifytime string) (item *AddStopTimeNewRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM  cygx_article_history_record_newpv WHERE user_id = ? AND article_id = ? 	AND modify_time <='` + modifytime + `'  ORDER BY id DESC LIMIT 1;`
@@ -77,7 +77,7 @@ func GetNewArticleHistoryRecordNewpv(uid, articleId int, modifytime string) (ite
 	return
 }
 
-//把十分钟之内的阅读记录进行累加
+// 把十分钟之内的阅读记录进行累加
 func UpdateCygxArticleViewRecordNewpv(itemRep *CygxArticleHistoryRecordNewpv, stopTime int) (err error) {
 	o, err := orm.NewOrm().Begin()
 	if err != nil {
@@ -113,7 +113,7 @@ func UpdateCygxArticleViewRecordNewpv(itemRep *CygxArticleHistoryRecordNewpv, st
 	return
 }
 
-//把十分钟之内的阅读记录进行累加
+// 把十分钟之内的阅读记录进行累加
 func UpdateCygxArticleViewRecordNewpvList(itemRep *CygxArticleHistoryRecordNewpv, stopTime int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_article_history_record_newpv 
@@ -148,7 +148,7 @@ type CygxArticleHistoryRecordAll struct {
 	IsDel          int       `description:"是否删除"`
 }
 
-//获取当天总表的阅读记录
+// 获取当天总表的阅读记录
 func GetArticleHistoryRecordAllList() (items []*CygxArticleHistoryRecordNewpv, err error) {
 	o := orm.NewOrm()
 	sql := ` SELECT * FROM cygx_article_history_record_all WHERE create_time >= date(NOW()) 
@@ -159,7 +159,7 @@ func GetArticleHistoryRecordAllList() (items []*CygxArticleHistoryRecordNewpv, e
 	return
 }
 
-//获取列表信息根据手机号分组
+// 获取列表信息根据手机号分组
 func GetArticleHistoryRecordAllByMobileList(condition string) (items []*CygxArticleHistoryRecordAll, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_article_history_record_all  WHERE 1 = 1 ` + condition + `  GROUP BY mobile   `
@@ -167,7 +167,7 @@ func GetArticleHistoryRecordAllByMobileList(condition string) (items []*CygxArti
 	return
 }
 
-//修改用户阅读的相关信息
+// 修改用户阅读的相关信息
 func UpdateCygxArticleHistoryRecordAll(wxUser *WxUserItem) (err error) {
 	o := orm.NewOrm()
 	var sql string
@@ -201,7 +201,7 @@ type EsUserInteraction struct {
 	CompanyArticleHistoryNum int    `description:"机构阅读数量"`
 }
 
-//机构阅读记录列表
+// 机构阅读记录列表
 func GetCygxArticleHistoryRecordByCompanyList(condition string, startSize, pageSize int) (items []*EsUserInteraction, err error) {
 	o := orm.NewOrm()
 	sql := ` SELECT
@@ -239,7 +239,7 @@ func GetCygxArticleHistoryRecordByCompanyList(condition string, startSize, pageS
 	return
 }
 
-//获取阅读记录数量
+// 获取阅读记录数量
 func GetCygxArticleHistoryCountByCompany(condition string) (count int, err error) {
 	o := orm.NewOrm()
 	sqlCount := `SELECT
@@ -270,7 +270,7 @@ type CygxArticleHistoryAllTopResp struct {
 	Num       int `description:"数量"`
 }
 
-//获取近15天之内的阅读数据最多的15报告
+// 获取近15天之内的阅读数据最多的15报告
 func GetCygxArticleHistoryAllTop(pars []interface{}, condition string) (items []*CygxArticleHistoryAllTopResp, err error) {
 	o := orm.NewOrm()
 	sql := ` SELECT
@@ -291,3 +291,14 @@ func GetCygxArticleHistoryAllTop(pars []interface{}, condition string) (items []
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+// 列表
+func GetCygxArticleHistoryRecordNewpvList(condition string, pars []interface{}) (items []*CygxArticleHistoryRecordNewpv, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_article_history_record_newpv as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 91 - 0
models/cygx_morning_meeting_gather.go

@@ -0,0 +1,91 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
+)
+
+type CygxMorningMeetingGather struct {
+	Id          int       `orm:"column(id);pk"`
+	MeetingIds  string    `description:"主表ID多个用 , 隔开"`
+	PublishTime string    `description:"发布日期"`
+	CreateTime  time.Time `description:"创建时间"`
+	ModifyTime  time.Time `description:"更新时间"`
+	Title       string    `description:"标题"`
+	Status      int       `description:"0:未发布,1:已发布"`
+}
+
+// 添加
+func AddCygxMorningMeetingGather(item *CygxMorningMeetingGather) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+func GetCygxMorningMeetingGatherCount(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM cygx_morning_meeting_gather WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	err = o.Raw(sql, pars).QueryRow(&count)
+	return
+}
+
+type CygxMorningMeetingGatherResp struct {
+	Id           int    `description:"ID"`
+	Title        string `description:"标题"`
+	IndustryName string `description:"多个产业名称"`
+}
+
+type CygxMorningMeetingGatherListResp struct {
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*CygxMorningMeetingGatherResp
+}
+
+// 列表
+func GetCygxMorningMeetingGatherList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxMorningMeetingGather, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_morning_meeting_gather WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+func GetCygxMorningMeetingGatherById(condition string, pars []interface{}) (item *CygxMorningMeetingGather, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_morning_meeting_gather WHERE  1= 1`
+	if condition != "" {
+		sql += condition
+	}
+	err = o.Raw(sql, pars).QueryRow(&item)
+	return
+}
+
+type CygxMorningMeetingGatherDetailListResp struct {
+	Id                  int    `description:"ID"`
+	IndustryId          int    `description:"产业id"` // 产业id
+	IndustryName        string `description:"产业名称"` // 产业名称
+	ChartPermissionName string `description:"行业名称"` // 行业名称
+	ChartPermissionId   int    `description:"行业id"` // 行业id
+	MeetingId           int    `description:"主表id"` // 主表id
+	Content             string `description:"内容"`   // 内容
+	PublishTime         string `description:"发布日期"`
+}
+
+type CygxMorningMeetingGatherDetailResp struct {
+	HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	Detail        *CygxMorningMeetingGatherDetail
+}
+
+type CygxMorningMeetingGatherDetail struct {
+	Id          int    `description:"ID"`
+	Title       string `description:"标题"`
+	PublishTime string `description:"发布日期"`
+	Department  string `description:"作者"`
+	List        []*CygxMorningMeetingGatherDetailListResp
+}

+ 12 - 75
models/cygx_morning_meeting_review_chapter.go

@@ -20,36 +20,16 @@ type CygxMorningMeetingReviewChapter struct {
 	Content              string    `json:"content"`             // 内容
 }
 
-type AddMorningMeetingReviewItem struct {
-	ChapterId            int
-	Content              string
-	ChartPermissionId    int
-	ChartPermissionName  string
-	IndustryId           int
-	IndustryName         string
-	IndustrialSubjectIds string
-}
-
-type AddMorningMeetingReviewsReq struct {
-	List        []*AddMorningMeetingReviewItem
-	MeetingId   int
-	MeetingTime string
-	PublishTime string
-	DoType      int `description:"操作类型 0,保存 、1,发布"`
-}
-
-//添加晨报点评章节
-func AddCygxMorningMeetingReviewChapter(item *CygxMorningMeetingReviewChapter) (err error) {
-	o := orm.NewOrm()
-	_, err = o.Insert(item)
-	return
-}
-
-//列表
-func GetCygxMorningMeetingReviewsListById(meetingId int) (items []*CygxMorningMeetingReviewChapter, err error) {
+// 列表
+func GetCygxMorningMeetingReviewChapterList(condition string, pars []interface{}) (items []*CygxMorningMeetingGatherDetailListResp, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE meeting_id = ? `
-	_, err = o.Raw(sql, meetingId).QueryRows(&items)
+	sql := `SELECT c.*,r.publish_time
+			FROM cygx_morning_meeting_review_chapter  as  c 
+			INNER JOIN cygx_morning_meeting_reviews as r ON  r.id = c.meeting_id   WHERE 1 = 1  AND r.status = 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
 
@@ -74,51 +54,8 @@ type CygxMorningMeetingReviewChapterRespItem struct {
 
 type CygxMorningMeetingReviewChapterResp struct {
 	MeetingTime string
-	Status int
-	List []*CygxMorningMeetingReviewChapterRespItem
-}
-
-//删除晨会点评章节
-func DeleteMorningMeetingChapter(reviewId int) (err error) {
-	o := orm.NewOrm()
-	sql := ` DELETE FROM cygx_morning_meeting_review_chapter WHERE meeting_id =? `
-	_, err = o.Raw(sql, reviewId).Exec()
-	return
-}
-
-//更新晨报点评章节
-func UpdateCygxMorningMeetingReviewChapter(item *CygxMorningMeetingReviewChapter) (err error) {
-	o := orm.NewOrm()
-	sql := `UPDATE cygx_morning_meeting_review_chapter
-			SET
-			  meeting_time =?,
-			  modify_time = ?,
-			  industry_id = ?,
-			  industry_name = ?,
-			  chart_permission_id = ?,
-			  chart_permission_name = ?,
-			  industrial_subject_ids = ?,
-			  content = ? 
-			WHERE id = ? `
-	_, err = o.Raw(sql, item.MeetingTime, item.ModifyTime, item.IndustryId, item.IndustryName,
-		item.ChartPermissionId, item.ChartPermissionName, item.IndustrialSubjectIds, item.Content, item.Id).Exec()
-
-	return
-}
-
-func GetCygxMorningMeetingReviewsListByIdAndIndustryId(meetingId,  industryId int) (item *CygxMorningMeetingReviewChapter, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE meeting_id = ? AND industry_id = ? `
-	err = o.Raw(sql, meetingId, industryId).QueryRow(&item)
-	return
-}
-
-//删除晨会点评章节
-func DeleteMorningMeetingChapterById(chapterId int) (err error) {
-	o := orm.NewOrm()
-	sql := ` DELETE FROM cygx_morning_meeting_review_chapter WHERE id =? `
-	_, err = o.Raw(sql, chapterId).Exec()
-	return
+	Status      int
+	List        []*CygxMorningMeetingReviewChapterRespItem
 }
 
 func GetCygxMorningMeetingReviewsListByIndustrialIds(industrialIds string) (items []*CygxMorningMeetingReviewChapter, err error) {
@@ -126,4 +63,4 @@ func GetCygxMorningMeetingReviewsListByIndustrialIds(industrialIds string) (item
 	sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE industry_id IN (` + industrialIds + `)  `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
-}
+}

+ 6 - 0
models/db.go

@@ -138,6 +138,12 @@ func init() {
 		new(CygxActivitySignin),
 		new(CygxActivitySigninLog),
 		new(CygxActivityOfflineMeetingDetail),
+		new(CygxProductInteriorHistory),
+		new(CygxMorningMeetingGather),
+		new(CygxArticleCategoryMapping),
+		new(CygxReportMappingCygx),
+		new(CygxReportMappingGroup),
+		new(CygxAboutUsVideoHistory),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 30 - 0
models/industrial_management.go

@@ -220,6 +220,10 @@ type IndustrialManagementId struct {
 	IndustrialManagementId string `description:"产业Id"`
 }
 
+type IndustrialManagementName struct {
+	IndustryName string `description:"产业名称"`
+}
+
 // 获取归类产业报告数量大于10的
 func GetIndustrialMorethan10() (items []*IndustrialManagementId, err error) {
 	o := orm.NewOrm()
@@ -761,6 +765,32 @@ func GetNewArticleDetailByIndustrialIds(industrialIdArr []int) (items []*Industr
 	return
 }
 
+// 获取该产业下最新的产品内测详情
+func GetNewProductInteriorByIndustrialIds(industrialIdArr []int) (items []*IndustrialManagementArticle, err error) {
+	arrLen := len(industrialIdArr)
+	if arrLen == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	sql := `SELECT
+			mg.industrial_management_id,
+			MAX( a.product_interior_id ) AS article_id,
+			a.title,
+			MAX( a.publish_time ) AS publish_date 
+		FROM
+			cygx_product_interior_industrial_group_management AS mg
+			INNER JOIN cygx_product_interior AS a ON mg.product_interior_id = a.product_interior_id 
+		WHERE
+			1 = 1 
+			AND a.STATUS = 1 
+			AND a.visible_range = 1 
+			AND mg.industrial_management_id IN(` + utils.GetOrmInReplace(len(industrialIdArr)) + `)   
+		GROUP BY
+			mg.industrial_management_id`
+	_, err = o.Raw(sql, industrialIdArr).QueryRows(&items)
+	return
+}
+
 // GetIndustrialManagementArticleNewPublishData 获取产业关联文章的最新发布时间
 func GetIndustrialManagementArticleNewPublishData() (items []*IndustrialManagement, err error) {
 	o := orm.NewOrm()

+ 2 - 2
models/micro_roadshow.go

@@ -60,7 +60,7 @@ type MicroRoadShowPageList struct {
 }
 
 // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
-func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId, filter int) (total int, list []*MicroRoadShowPageList, err error) {
+func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
 	o := orm.NewOrm()
 	var sql string
 	//if audioId+activityVideoId == 0 && filter != 2 {
@@ -222,7 +222,7 @@ func CountMicroRoadShowVideoPageList(condition string, pars []interface{}, condi
 }
 
 // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
-func GetMicroRoadShowVideoPageListIkWord(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId, filter int) (list []*MicroRoadShowPageList, err error) {
+func GetMicroRoadShowVideoPageListIkWord(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}) (list []*MicroRoadShowPageList, err error) {
 	o := orm.NewOrm()
 	var sql string
 	//if audioId+activityVideoId == 0 && filter != 2 {

+ 156 - 0
models/product_interior.go

@@ -0,0 +1,156 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
+)
+
+type CygxProductInterior struct {
+	ProductInteriorId int       `orm:"column(product_interior_id);pk"`
+	ColumnName        string    `description:"栏目名称"`
+	Title             string    `description:"标题"`
+	PublishTime       time.Time `description:"发布日期"`
+	CreateTime        time.Time `description:"创建时间"`
+	ModifyTime        time.Time `description:"更新时间"`
+	Status            int       `description:"0:未发布,1:已发布"`
+	Body              string    `description:"内容"`
+	IsCancel          int       `description:"是否取消,1是,0否"`
+	VisibleRange      int       `description:"设置可见范围1全部,0内部"`
+	Abstract          string    `description:"摘要"`
+	Department        string    `description:"作者"`
+	AdminId           int       `description:"管理员ID"`
+}
+
+type AddProductInteriorReq struct {
+	ProductInteriorId int    `description:"ID"`
+	DoType            int    `description:"操作类型 0,保存 、1,发布"`
+	ColumnName        string `description:"栏目名称"`
+	Title             string `description:"标题"`
+	Abstract          string `description:"摘要"`
+	Department        string `description:"作者"`
+	Body              string `description:"内容"`
+	PublishTime       string `description:"发布日期"`
+}
+type ProductInteriorIdReq struct {
+	ProductInteriorId int `description:"ID"`
+}
+
+// 添加
+func AddProductInterior(item *CygxProductInterior) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+// 修改
+func UpdateProductInterior(item *CygxProductInterior) (err error) {
+	to := orm.NewOrm()
+	updateParams := make(map[string]interface{})
+	updateParams["PublishTime"] = item.PublishTime
+	updateParams["ModifyTime"] = item.ModifyTime
+	updateParams["ColumnName"] = item.ColumnName
+	updateParams["Title"] = item.Title
+	updateParams["Status"] = item.Status
+	updateParams["Body"] = item.Body
+	updateParams["IsCancel"] = item.IsCancel
+	updateParams["VisibleRange"] = item.VisibleRange
+	updateParams["Abstract"] = item.Abstract
+	updateParams["Department"] = item.Department
+	ptrStructOrTableName := "cygx_product_interior"
+	whereParam := map[string]interface{}{"product_interior_id": item.ProductInteriorId}
+	qs := to.QueryTable(ptrStructOrTableName)
+	for expr, exprV := range whereParam {
+		qs = qs.Filter(expr, exprV)
+	}
+	_, err = qs.Update(updateParams)
+	return
+}
+
+type GetCygxProductInteriorResp struct {
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*CygxProductInteriorResp
+}
+
+type CygxProductInteriorResp struct {
+	ProductInteriorId int                       `description:"ID"`
+	PublishTime       string                    `description:"发布日期"`
+	CreateTime        string                    `description:"创建时间"`
+	ModifyTime        string                    `description:"更新时间"`
+	Title             string                    `description:"标题"`
+	ColumnName        string                    `description:"栏目名称"`
+	Body              string                    `description:"内容"`
+	BodySlice         []*ProductInteriorUrlResp `description:"内容切片"`
+	IsCancel          int                       `description:"是否取消,1是,0否"`
+	VisibleRange      int                       `description:"设置可见范围1全部,0内部"`
+	Abstract          string                    `description:"摘要"`
+	Department        string                    `description:"作者"`
+}
+
+type ProductInteriorUrlResp struct {
+	ChartPermissionId int    `description:"行业id"`
+	SourceId          int    `description:"资源ID"`
+	Type              int    `description:"类型:1普通文本,2:文章、3:活动、4:产业"`
+	Body              string `description:"内容"`
+}
+
+// 获取数量
+func GetCygxProductInteriorCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_product_interior as art WHERE 1= 1  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+// 列表
+func GetCygxProductInteriorList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxProductInteriorResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_product_interior as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+type GetCygxProductInteriorDetailResp struct {
+	Detail        *CygxProductInteriorResp
+	HasPermission int  `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	IsShow        bool `description:"是否展示"`
+}
+
+// 通过ID获取详情
+func GetCygxProductInteriorDetail(productInteriorId int) (item *CygxProductInteriorResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_product_interior  WHERE product_interior_id=? AND status = 1  `
+	err = o.Raw(sql, productInteriorId).QueryRow(&item)
+	return
+}
+
+// 删除数据
+func DeleteProductInterior(productInteriorId int) (err error) {
+	o := orm.NewOrm()
+	sql := ` DELETE FROM cygx_product_interior WHERE product_interior_id = ?`
+	_, err = o.Raw(sql, productInteriorId).Exec()
+	return
+}
+
+// 修改是否展示
+func EditProductInteriorStatus(status, isCancel, productInteriorId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_product_interior SET status=?,is_cancel = ? , modify_time=NOW()   WHERE product_interior_id=? `
+	_, err = o.Raw(sql, status, isCancel, productInteriorId).Exec()
+	return
+}
+
+// 修改可见范围
+func ProductInteriorVisibleRange(visibleRange, productInteriorId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_product_interior SET visible_range=?, modify_time=NOW()   WHERE product_interior_id=?  `
+	_, err = o.Raw(sql, visibleRange, productInteriorId).Exec()
+	return
+}

+ 39 - 0
models/product_interior_history.go

@@ -0,0 +1,39 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxProductInteriorHistory struct {
+	Id                int `orm:"column(id);pk"`
+	ProductInteriorId int
+	UserId            int
+	CreateTime        time.Time
+	Mobile            string    `description:"手机号"`
+	Email             string    `description:"邮箱"`
+	CompanyId         int       `description:"公司id"`
+	CompanyName       string    `description:"公司名称"`
+	ModifyTime        time.Time `description:"修改时间"`
+	RealName          string    `description:"用户实际名称"`
+	SellerName        string    `description:"所属销售"`
+}
+
+// 添加历史信息
+func AddCygxProductInteriorHistory(item *CygxProductInteriorHistory) (lastId int64, err error) {
+	o := orm.NewOrm()
+	item.ModifyTime = time.Now()
+	lastId, err = o.Insert(item)
+	return
+}
+
+// 列表
+func GetCygxProductInteriorHistoryList(condition string, pars []interface{}) (items []*CygxProductInteriorHistory, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_product_interior_history as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 116 - 1
models/report.go

@@ -108,6 +108,80 @@ WHERE
 	return
 }
 
+// 获取产业报告列表
+func GetReportAndproductInteriorIndustrialList(pars []interface{}, categoryId, industrialManagementId, userId, startSize, pageSize int) (items []*ReportArticle, total int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			art.article_id,
+			art.title,
+			art.publish_date,
+			( SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(userId) + ` AND rec.article_id = art.article_id ) AS readnum , 
+			1 AS resource 
+		FROM
+			cygx_article AS art
+			INNER JOIN cygx_industrial_article_group_management AS man_g ON man_g.article_id = art.article_id 
+		WHERE
+			art.publish_status = 1 
+			AND category_id IN ( SELECT category_id_celue FROM cygx_report_mapping_group WHERE id_cygx = ` + strconv.Itoa(categoryId) + ` ) 
+			AND art.is_class = 1 
+			AND man_g.industrial_management_id =` + strconv.Itoa(industrialManagementId) + ` 
+		GROUP BY
+			art.article_id UNION ALL
+		SELECT
+			art.product_interior_id AS article_id,
+			art.title,
+			art.publish_time AS publish_date,
+			( SELECT COUNT( 1 ) FROM cygx_product_interior_history AS rec WHERE rec.user_id = ` + strconv.Itoa(userId) + ` AND rec.product_interior_id = art.product_interior_id ) AS readnum ,
+			2 AS resource 
+		FROM
+			cygx_product_interior AS art
+			INNER JOIN cygx_product_interior_industrial_group_management AS man_g ON man_g.product_interior_id = art.product_interior_id 
+		WHERE
+			art.STATUS = 1 
+			AND art.visible_range = 1 
+			AND art.match_type_id = ` + strconv.Itoa(categoryId) + ` 
+			AND man_g.industrial_management_id = ` + strconv.Itoa(industrialManagementId) + ` 
+		GROUP BY
+			art.product_interior_id `
+
+	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
+	err = o.Raw(totalSql, pars).QueryRow(&total)
+	sql += `    ORDER BY publish_date DESC LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// 获取行业报告列表
+func GetReportAndproductIndustrylList(categoryId, startSize, pageSize int) (items []*ReportArticle, total int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			art.article_id,
+			art.title,
+			art.publish_date,
+			1 AS resource 
+		FROM
+			cygx_article AS art 
+		WHERE
+			art.publish_status = 1 
+			AND category_id IN ( SELECT category_id_celue FROM cygx_report_mapping_group WHERE id_cygx = ` + strconv.Itoa(categoryId) + ` ) UNION ALL
+		SELECT
+			art.product_interior_id AS article_id,
+			art.title,
+			art.publish_time AS publish_date,
+			2 AS resource 
+		FROM
+			cygx_product_interior AS art 
+		WHERE
+			art.STATUS = 1 
+			AND art.visible_range = 1 
+			AND art.match_type_id = ` + strconv.Itoa(categoryId)
+	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
+	err = o.Raw(totalSql).QueryRow(&total)
+	sql += `    ORDER BY publish_date DESC LIMIT ?,? `
+	_, err = o.Raw(sql, startSize, pageSize).QueryRows(&items)
+	return
+}
+
 // 产业下所关联的文章分类列表
 func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int) (items []*IndustrialToArticleCategoryRep, err error) {
 	o := orm.NewOrm()
@@ -143,6 +217,46 @@ func IndustrialToArticleCategoryNew(industrialManagementId int) (items []*Indust
 	return
 }
 
+// 产业下所关联的文章、产品内测分类列表 2023-04-14
+func IndustrialToArticleAndProductInteriorCategoryNew(industrialManagementId int) (items []*IndustrialToArticleCategoryRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			map.match_type_name,
+			map.id AS category_id 
+		FROM
+			cygx_report_mapping_cygx AS map
+			INNER JOIN cygx_report_mapping_group AS g ON g.id_cygx = map.id
+			INNER JOIN cygx_report_mapping_celue AS cl ON cl.category_id = g.category_id_celue
+			INNER JOIN cygx_article AS art ON art.category_id = cl.category_id
+			INNER JOIN cygx_industrial_article_group_management AS man_g ON man_g.article_id = art.article_id 
+		WHERE
+			1 = 1 
+			AND map.report_type = 2 
+			AND map.is_report = 1 
+			AND art.is_report = 1 
+			AND art.publish_status = 1 
+			AND man_g.industrial_management_id = ?
+		GROUP BY
+			map.match_type_name UNION ALL
+		SELECT
+			map.match_type_name,
+			map.id AS category_id 
+		FROM
+			cygx_report_mapping_cygx AS map
+			INNER JOIN cygx_industrial_management AS im ON im.chart_permission_id = map.chart_permission_id
+			INNER JOIN cygx_product_interior AS art ON art.match_type_id = map.id
+			INNER JOIN cygx_product_interior_industrial_group_management AS man_g ON man_g.product_interior_id = art.product_interior_id 
+		WHERE
+			1 = 1 
+			AND art.STATUS = 1 
+			AND art.visible_range = 1 
+			AND man_g.industrial_management_id = ? 
+		GROUP BY
+			map.match_type_name`
+	_, err = o.Raw(sql, industrialManagementId, industrialManagementId).QueryRows(&items)
+	return
+}
+
 // 判断用户是否阅读该产业下,某一分类的文章
 func IndustrialUserRecordArticleCount(userId, industrialManagementId, categoryId int) (count int, err error) {
 	o := orm.NewOrm()
@@ -181,7 +295,7 @@ WHERE
 // 获取最新文章
 func GetNewArticleByCategoryId(categoryId int) (item *ArticleDetail, err error) {
 	o := orm.NewOrm()
-	sql := ` SELECT * FROM cygx_article WHERE  category_id = ? ORDER BY publish_date DESC LIMIT 0, 1`
+	sql := ` SELECT * FROM cygx_article WHERE  category_id IN ( SELECT category_id_celue FROM cygx_report_mapping_group WHERE id_cygx = ? ) ORDER BY publish_date DESC LIMIT 0, 1 `
 	err = o.Raw(sql, categoryId).QueryRow(&item)
 	return
 }
@@ -264,6 +378,7 @@ type IsShow struct {
 	YanXuan_Explain        bool      `description:"研选说明"`
 	ActivitySpecialExplain string    `description:"专项调研活动"`
 	SearchTxtList          SearchTxt `description:"搜索栏回显内容说明"`
+	IsBelongRai            bool      `description:"是否属于权益内部人员"`
 }
 
 type SearchTxt struct {

+ 97 - 0
models/report_mapping.go

@@ -4,6 +4,26 @@ import (
 	"github.com/beego/beego/v2/client/orm"
 )
 
+type CygxReportMapping struct {
+	Id                  int    `description:"id"`
+	ChartPermissionId   int    `description:"行业ID"`
+	CategoryId          int    `description:"分类ID"`
+	SubCategoryId       int    `description:"主题"`
+	CategoryName        int    `description:"主题"`
+	ChartPermissionName string `description:"行业名称"`
+	SubCategoryName     int    `description:"主题"`
+	MatchTypeName       string `description:"分类名称"`
+	ReportType          int    `description:"报告类型,2产业报告,1行业报告"`
+	Sort                int    `description:"排序"`
+	IsCustom            int    `description:"是否属于自定义的匹配类型 ,1是,0否"`
+	IsSummary           int    `description:"是否是纪要库,1是,0否"`
+	IsReport            int    `description:"是否是报告,1是,0否"`
+	PermissionType      int    `description:"1主观,2客观"`
+	CategoryIdSet       int    `description:"分类ID手动设置的分类"`
+	PolymerizationId    string `description:"分类聚合ID"`
+	CeLueFieldId        string `description:"策略平台领域ID"`
+}
+
 type ReportMapping struct {
 	CategoryId          int    `description:"分类ID"`
 	CategoryIdSet       int    `description:"分类ID手动设置的分类"`
@@ -74,6 +94,29 @@ ORDER BY
 	return
 }
 
+// 获取策略下面的所有分类
+func GetReportMappingStrategyHomeAllByCygx(chartPermissionId int) (items []*ReportMappingHome, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	re.id AS category_id,
+	re.match_type_name 
+FROM
+	cygx_report_mapping_cygx AS re
+	INNER JOIN cygx_report_mapping_group AS mg ON mg.id_cygx = re.id
+	INNER JOIN cygx_article AS art ON art.category_id = mg.category_id_celue 
+WHERE
+	1 = 1 
+	AND re.chart_permission_id = ? 
+	AND re.report_type = 1 
+GROUP BY
+	re.match_type_name 
+ORDER BY
+	sort DESC,
+	art.publish_date DESC`
+	_, err = o.Raw(sql, chartPermissionId).QueryRows(&items)
+	return
+}
+
 // 行业列表
 func GetTradeAll(ChartPermissionId int) (items []*TradeReportMapping, err error) {
 	o := orm.NewOrm()
@@ -95,6 +138,49 @@ func GetTradeAll(ChartPermissionId int) (items []*TradeReportMapping, err error)
 	return
 }
 
+// 行业列表
+func GetTradeArticleAndProductInterior(ChartPermissionId int) (items []*TradeReportMapping, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			map.sort,
+			map.match_type_name,
+			map.id AS category_id 
+		FROM
+			cygx_report_mapping_cygx AS map
+			INNER JOIN cygx_report_mapping_group AS g ON g.id_cygx = map.id
+			INNER JOIN cygx_report_mapping_celue AS cl ON cl.category_id = g.category_id_celue
+			INNER JOIN cygx_article AS art ON art.category_id = cl.category_id 
+		WHERE
+			1 = 1 
+			AND map.report_type = 1 
+			AND map.is_report = 1 
+			AND art.is_report = 1 
+			AND art.publish_status = 1 
+			AND map.chart_permission_id = ? 
+		GROUP BY
+			match_type_name UNION ALL
+		SELECT
+			map.sort,
+			map.match_type_name,
+			map.id AS category_id 
+		FROM
+			cygx_report_mapping_cygx AS map
+			INNER JOIN cygx_industrial_management AS im ON im.chart_permission_id = map.chart_permission_id
+			INNER JOIN cygx_product_interior AS art ON art.match_type_id = map.id 
+		WHERE
+			1 = 1 
+			AND art.STATUS = 1 
+			AND art.visible_range = 1 
+			AND map.report_type = 1 
+			AND map.chart_permission_id = ? 
+		GROUP BY
+			match_type_name 
+		ORDER BY
+			sort DESC `
+	_, err = o.Raw(sql, ChartPermissionId, ChartPermissionId).QueryRows(&items)
+	return
+}
+
 type IndustrialToArticleCategoryRep struct {
 	CategoryId    int    `description:"分类ID"`
 	MatchTypeName string `description:"匹配类型"`
@@ -277,3 +363,14 @@ func GetReportMappingByPermissionName(chartPermissionName string) (items []*Repo
 	_, err = o.Raw(sql, chartPermissionName).QueryRows(&items)
 	return
 }
+
+// 获取所有的报告分类
+func GetReportMapping() (items []*CygxReportMapping, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+				* 
+			FROM
+				cygx_report_mapping `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 12 - 0
models/report_selection.go

@@ -128,6 +128,18 @@ func GetReportSelectionListPublic(condition, readSql, tbdb string, pars []interf
 	return
 }
 
+// 列表
+func GetReportSelectionListHome(condition, tbdb string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM  ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` ORDER BY  art.publish_date  DESC  LIMIT ?,?`
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
 type CygxReportSelectionLog struct {
 	ArticleSunId           int       `description:"子级报告id"`
 	ArticleId              int       `description:"父级报告Id"`

+ 22 - 18
models/resource_data.go

@@ -18,26 +18,30 @@ type CygxResourceData struct {
 }
 
 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:"专项调研活动"`
+	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:"专项调研活动"`
+	Researchsummary    *CygxReportSelectionRep                 `description:"本周研究汇总"`
+	Minutessummary     *CygxReportSelectionRep                 `description:"上周纪要汇总"`
+	Meetingreviewchapt *CygxMorningMeetingGatherDetailListResp `description:"晨会精华"`
+	ProductInterior    *CygxProductInteriorResp                `description:"产品内测"`
 }
 
-//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+// 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 `
@@ -49,7 +53,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 	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()
@@ -57,14 +61,14 @@ func GetResourceDataCount(condition string, pars []interface{}) (count int, err
 	return
 }
 
-//添加
+// 添加
 func AddCygxResourceData(item *CygxResourceData) (lastId int64, err error) {
 	o := orm.NewOrm()
 	lastId, err = o.Insert(item)
 	return
 }
 
-//删除数据
+// 删除数据
 func DeleteResourceData(sourceId int, source string) (err error) {
 	o := orm.NewOrm()
 	sql := ` DELETE FROM cygx_resource_data WHERE source_id = ? AND source =?  `
@@ -72,7 +76,7 @@ func DeleteResourceData(sourceId int, source string) (err error) {
 	return
 }
 
-//修改数据
+// 修改数据
 func UpdateResourceData(sourceId int, source, publishDate string) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_resource_data SET publish_date=?  WHERE source_id=?  AND source =? `
@@ -80,7 +84,7 @@ func UpdateResourceData(sourceId int, source, publishDate string) (err error) {
 	return
 }
 
-//批量删除
+// 批量删除
 func DeleteResourceDataList(condition string, pars []interface{}) (err error) {
 	if condition == "" {
 		return

+ 1 - 1
models/user.go

@@ -211,7 +211,7 @@ type ApplyTryReq struct {
 	RealName        string `description:"姓名"`
 	CompanyName     string `description:"公司名称"`
 	ApplyMethod     int    `description:"1:已付费客户申请试用,2:非客户申请试用,3:非客户申请试用(ficc下,不需要进行数据校验)"`
-	TryType         string `description:"提交类型,Article:文章、Activity:活动; MicroVideo-微路演视频"`
+	TryType         string `description:"提交类型,Article:文章、Activity:活动、MicroAudio:微路演音频、MicroVideo:微路演视频、Researchsummary:本周研究汇总、Minutessummary:上周纪要汇总、ReportSelection:报告精选、ProductInterior:产品内测"`
 	DetailId        int    `description:"详情ID"`
 }
 

+ 42 - 0
models/xzs_choose_category.go

@@ -16,6 +16,7 @@ type CygxXzsChooseCategory struct {
 	CategoryId  int       `description:"权益文章对应分类,cygx_article"`
 	CreateTime  time.Time `description:"创建时间"`
 	ModifyTime  time.Time `description:"更新时间"`
+	IdCygx      int       `description:"cygx_report_mapping_cygx 表主键ID"`
 }
 
 // 根据手机号获取用户关注的产业
@@ -40,3 +41,44 @@ func RemoveCygxCategoryFllow(mobile string, CategoryId int) (err error) {
 	_, err = o.Raw(sql, mobile, CategoryId).Exec()
 	return
 }
+
+// 根据手机号获取用户关注的产业
+func GetCygxXzsChooseCategoryWhithIdCygxList() (items []*CygxXzsChooseCategory, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_xzs_choose_category WHERE id_cygx = 0`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+type XzsChooseMapResp struct {
+	Id                  int    `description:"id"`
+	CategoryId          int    `description:"权益文章对应分类,cygx_article"`
+	CharPpermissionName string `description:"权限名称"`
+	MatchTypeName       string `description:"分类名称"`
+}
+
+// 根据手机号获取用户关注的产业
+func GetCygxXzsChooseCategoryMapList() (items []*XzsChooseMapResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			r.id,
+			r.chart_permission_name,
+			r.match_type_name,
+			c.category_id 
+		FROM
+			cygx_report_mapping_cygx AS r
+			INNER JOIN cygx_report_mapping_group AS p ON p.id_cygx = r.id
+			INNER JOIN cygx_report_mapping_celue AS c ON c.category_id = p.category_id_celue 
+		WHERE
+			r.chart_permission_id IN (23,100000)`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// 修改数据
+func UpdateCygxXzsChooseCategory(idCygx, id int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_xzs_choose_category SET id_cygx=?  WHERE id=?   `
+	_, err = o.Raw(sql, idCygx, id).Exec()
+	return
+}

+ 45 - 0
routers/commentsRouter.go

@@ -592,6 +592,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ConfigController"],
+        beego.ControllerComments{
+            Method: "AboutUsAdd",
+            Router: `/aboutUs/addHistory`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ConfigController"],
         beego.ControllerComments{
             Method: "DescriptionOfResearch",
@@ -718,6 +727,42 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"],
+        beego.ControllerComments{
+            Method: "GatherDetail",
+            Router: `/gather/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"],
+        beego.ControllerComments{
+            Method: "GatherList",
+            Router: `/gather/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"],
+        beego.ControllerComments{
+            Method: "Detail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"],
+        beego.ControllerComments{
+            Method: "List",
+            Router: `/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportBillboardController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportBillboardController"],
         beego.ControllerComments{
             Method: "FllowList",

+ 10 - 0
routers/router.go

@@ -144,6 +144,16 @@ func init() {
 				&controllers.ActivitySignCoAntroller{},
 			),
 		),
+		web.NSNamespace("/product_interior",
+			web.NSInclude(
+				&controllers.ProductInteriorController{},
+			),
+		),
+		web.NSNamespace("/morning_meeting",
+			web.NSInclude(
+				&controllers.MorningMeetingController{},
+			),
+		),
 	)
 	web.AddNamespace(ns)
 }

+ 35 - 1
services/admin.go

@@ -1,6 +1,9 @@
 package services
 
-import "hongze/hongze_cygx/models"
+import (
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+)
 
 func GetAdminMobileMap() (mapItem map[string]string, err error) {
 	adminList, e := models.GetAdminByRole()
@@ -30,3 +33,34 @@ func GetActivityCcustomerTypeList() (mapItem map[int]string, err error) {
 	mapItem = mapUserType
 	return
 }
+
+// GetRaiAdminMobileMap 获取权益内部人员手机号
+func GetRaiAdminMobileMap() (mapItem map[string]string) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("获取权益内部人员手机号失败 ErrMsg:"+err.Error(), 2)
+
+		}
+	}()
+	adminList, e := models.GetRaiAdmin()
+	if e != nil {
+		err = e
+		return
+	}
+	mapMobile := make(map[string]string)
+	for _, v := range adminList {
+		mapMobile[v.Mobile] = v.Mobile
+	}
+	mapItem = mapMobile
+	return
+}
+
+// 根据手机号判断是否属于权益
+func GetBelongingRai(mobile string) (isBelong bool) {
+	mapItem := GetRaiAdminMobileMap()
+	if mapItem[mobile] != "" {
+		isBelong = true
+	}
+	return
+}

+ 72 - 0
services/article.go

@@ -1843,6 +1843,78 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
 	return
 }
 
+// 处理核心观点的展示规则
+func AnnotationHtml(bodyText string) (annotation string) {
+	if bodyText == "" {
+		return
+	}
+	annotation = bodyText
+	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 ProductInteriorHtml(bodyText string) (annotation string) {
+	if bodyText == "" {
+		return
+	}
+	sliceBody := strings.Split(bodyText, "</p>")
+	annotation, _ = GetReportContentTextSub(sliceBody[0])
+	return
+}
+
 // 解析研选内容中的核心观点
 func YxArticleAnnotation(article *models.HomeArticle) (annotation string) {
 	//如果不规范,就获取内容主体

+ 34 - 0
services/article_history.go

@@ -0,0 +1,34 @@
+package services
+
+import (
+	"fmt"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+)
+
+func GetArticleHistoryByUser(articleIds []int, user *models.WxUserItem) (mapResp map[int]int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("获取用户的阅读数据,信息失败,Err:"+err.Error(), 3)
+		}
+	}()
+	lenIds := len(articleIds)
+	if lenIds == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND article_id IN (` + utils.GetOrmInReplace(lenIds) + `) AND  user_id = ?`
+	pars = append(pars, articleIds, user.UserId)
+	list, err := models.GetCygxArticleHistoryRecordNewpvList(condition, pars)
+	if err != nil {
+		return
+	}
+	mapResp = make(map[int]int, 0)
+	for _, v := range list {
+		mapResp[v.ArticleId]++
+	}
+	return
+}

+ 20 - 15
services/chart.go

@@ -399,7 +399,7 @@ func DeleteCollectionChart(mobile string, chartId int) (err error) {
 func GetChartDetailByChartId(cont context.Context) (err error) {
 	listUpdate, err := models.GetChartCeluePushList()
 	if err != nil && err.Error() != utils.ErrNoRow() {
-		go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表ID:"+err.Error(), 2)
+		go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表1ID:"+err.Error(), 2)
 	}
 	//如果长度为零就不处理
 	if len(listUpdate) == 0 {
@@ -408,18 +408,18 @@ func GetChartDetailByChartId(cont context.Context) (err error) {
 	for _, v := range listUpdate {
 		err = GetChartDetailByApi(v.ChartId)
 		if err != nil {
-			go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表ID:"+strconv.Itoa(v.ChartId)+err.Error(), 2)
+			go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表2ID:"+strconv.Itoa(v.ChartId)+err.Error(), 2)
 		}
 		err = models.UpdateCygxChartCeluePush(v.ChartId)
 		if err != nil {
-			go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表ID:"+strconv.Itoa(v.ChartId)+err.Error(), 2)
+			go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表3ID:"+strconv.Itoa(v.ChartId)+err.Error(), 2)
 		}
 	}
 	return
 }
 
 //func init() {
-//	GetChartDetailByChartId()
+//	GetChartDetailByApi(6159)
 //}
 
 // 同步图表详情
@@ -427,7 +427,7 @@ func GetChartDetailByApi(chartId int) (err error) {
 	defer func() {
 		if err != nil {
 			//fmt.Println(err)
-			go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表ID:"+strconv.Itoa(chartId)+err.Error(), 2)
+			go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表4ID:"+strconv.Itoa(chartId)+err.Error(), 2)
 			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "GetArticleListByApi ,图表ID:"+strconv.Itoa(chartId)+"ErrMsg:"+err.Error(), utils.EmailSendToUsers)
 		}
 	}()
@@ -485,17 +485,17 @@ func GetChartDetailByApi(chartId int) (err error) {
 	}
 
 	//如果没有就新增 有就更新
-	if mapChartid[v.ChartId] == 0 {
+	if mapChartid[chartId] == 0 {
 		_, err := models.AddCygxChart(item)
 		if item.PublishStatus == 1 && v.IsActive {
-			go UpdateResourceData(item.ChartId, "newchart", "add", time.Now().Format(utils.FormatDateTime))
+			//go UpdateResourceData(chartId, "newchart", "add", time.Now().Format(utils.FormatDateTime))
 		}
 		if err != nil {
 			return err
 		}
 	} else {
 		if item.PublishStatus == 0 {
-			chartIdsDelete = append(chartIdsDelete, item.ChartId)
+			chartIdsDelete = append(chartIdsDelete, chartId)
 		}
 		updateParams := make(map[string]interface{})
 		updateParams["Title"] = v.Title
@@ -512,20 +512,20 @@ func GetChartDetailByApi(chartId int) (err error) {
 		updateParams["CtagIdTwo"] = v.CtagTwo.Id
 		updateParams["Cover"] = v.Cover
 		updateParams["Iframe"] = v.Iframe
-		whereParam := map[string]interface{}{"chart_id": v.ChartId}
+		whereParam := map[string]interface{}{"chart_id": chartId}
 		err = models.UpdateByExpr(models.CygxChart{}, whereParam, updateParams)
 		if err != nil {
 			return err
 		}
 		if item.PublishStatus == 0 {
-			go UpdateResourceData(item.ChartId, "newchart", "delete", time.Now().Format(utils.FormatDateTime))
+			//go UpdateResourceData(chartId, "newchart", "delete", time.Now().Format(utils.FormatDateTime))
 		}
 	}
 	//}
 	fmt.Println("删除的", chartIdsDelete)
-	if len(chartIdsDelete) > 0 {
-		go Deletenewchart(chartIdsDelete)
-	}
+	//if len(chartIdsDelete) > 0 {
+	//	go Deletenewchart(chartIdsDelete)
+	//}
 
 	//策略平台图表,记录所有,的显示用户收藏使用
 	{
@@ -548,8 +548,13 @@ func GetChartDetailByApi(chartId int) (err error) {
 		item.Cover = v.Cover
 		item.Iframe = v.Iframe
 
+		//如果是软删除就做取消发布处理
+		if !v.IsActive {
+			item.PublishStatus = 0
+		}
+
 		//如果没有就新增 有就更新
-		if mapAllChartid[v.ChartId] == 0 {
+		if mapAllChartid[chartId] == 0 {
 			_, err := models.AddCygxChartAll(item)
 			if err != nil {
 				return err
@@ -570,7 +575,7 @@ func GetChartDetailByApi(chartId int) (err error) {
 			updateParams["CtagIdTwo"] = v.CtagTwo.Id
 			updateParams["Cover"] = v.Cover
 			updateParams["Iframe"] = v.Iframe
-			whereParam := map[string]interface{}{"chart_id": v.ChartId}
+			whereParam := map[string]interface{}{"chart_id": chartId}
 			err = models.UpdateByExpr(models.CygxChartAll{}, whereParam, updateParams)
 			if err != nil {
 				return err

+ 29 - 0
services/config.go

@@ -4,7 +4,9 @@ import (
 	"errors"
 	"fmt"
 	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
 	"strconv"
+	"time"
 )
 
 // 是否展示限免标签
@@ -79,3 +81,30 @@ func init1231() {
 		go models.AddCygxActivitySpecialTripBill(itemBill)
 	}
 }
+
+// 添加关于我们浏览记录
+func AddCygxAboutUsVideoHistory(user *models.WxUserItem) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
+		}
+	}()
+	historyRecord := new(models.CygxAboutUsVideoHistory)
+	historyRecord.UserId = user.UserId
+	historyRecord.CreateTime = time.Now()
+	historyRecord.Mobile = user.Mobile
+	historyRecord.Email = user.Email
+	historyRecord.CompanyId = user.CompanyId
+	historyRecord.CompanyName = user.CompanyName
+	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	historyRecord.RealName = user.RealName
+	historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
+	if sellerItem != nil {
+		historyRecord.SellerName = sellerItem.RealName
+	}
+	_, err = models.AddCygxAboutUsVideoHistory(historyRecord)
+	return
+}

+ 13 - 0
services/industrial_management.go

@@ -477,6 +477,19 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 		}
 	}
 
+	//产品内测的更新时间线
+	listtProductInterior, err := models.GetNewProductInteriorByIndustrialIds(industrialIdArr)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	for _, v := range listtProductInterior {
+		if mapUPdateTime[v.IndustrialManagementId] != "" {
+			if utils.StrTimeToTime(v.PublishDate).After(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
+				mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
+			}
+		}
+	}
+
 	//mapHistroyArticleId := make(map[int]int)
 
 	//if userId > 0 {

+ 98 - 0
services/init_10.3.go

@@ -0,0 +1,98 @@
+package services
+
+import (
+	"fmt"
+	"hongze/hongze_cygx/models"
+)
+
+//10.3版本上线需要更新的数据
+
+func init1111() {
+	var condition string
+	var pars []interface{}
+	var err error
+	fmt.Print()
+	//处理上周纪要汇总
+	condition = ` AND  visible_range = 1  `
+	listresearchsummary, err := models.GetReportSelectionListHome(condition, "cygx_minutes_summary", pars, 0, 100000)
+	if err != nil {
+		fmt.Println(err)
+	}
+	condition = ` AND source = 'minutessummary'  `
+	err = models.DeleteResourceDataList(condition, pars)
+	if err != nil {
+		fmt.Println(err)
+	}
+	for _, v := range listresearchsummary {
+		go UpdateResourceData(v.ArticleId, "minutessummary", "add", v.PublishDate)
+	}
+
+	fmt.Println(listresearchsummary)
+}
+
+func init2222() {
+	var condition string
+	var pars []interface{}
+	var err error
+	fmt.Print()
+	//处理本周纪要汇总
+	condition = ` AND  visible_range = 1  `
+	listresearchsummary, err := models.GetReportSelectionListHome(condition, "cygx_research_summary", pars, 0, 100000)
+	if err != nil {
+		fmt.Println(err)
+	}
+	condition = ` AND source = 'researchsummary'  `
+	err = models.DeleteResourceDataList(condition, pars)
+	if err != nil {
+		fmt.Println(err)
+	}
+	for _, v := range listresearchsummary {
+		go UpdateResourceData(v.ArticleId, "researchsummary", "add", v.PublishDate)
+	}
+
+	fmt.Println(listresearchsummary)
+}
+
+func init333() {
+	var condition string
+	var pars []interface{}
+	var err error
+	fmt.Print()
+	//处理晨会精华
+	listrMeet, err := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+	if err != nil {
+		fmt.Println(err)
+	}
+	condition = ` AND source = 'meetingreviewchapt'  `
+	err = models.DeleteResourceDataList(condition, pars)
+	if err != nil {
+		fmt.Println(err)
+	}
+	for _, v := range listrMeet {
+		go UpdateResourceData(v.Id, "meetingreviewchapt", "add", v.PublishTime)
+	}
+	fmt.Println(listrMeet)
+}
+
+func init444() {
+	listMap, err := models.GetCygxXzsChooseCategoryMapList()
+	if err != nil {
+		fmt.Println(err)
+	}
+	mapReport := make(map[int]int)
+	for _, v := range listMap {
+		mapReport[v.CategoryId] = v.Id
+	}
+
+	list, err := models.GetCygxXzsChooseCategoryWhithIdCygxList()
+	if err != nil {
+		fmt.Println(err)
+	}
+	for _, v := range list {
+		fmt.Println(mapReport[v.CategoryId])
+		err = models.UpdateCygxXzsChooseCategory(mapReport[v.CategoryId], v.Id)
+		if err != nil {
+			fmt.Println(err)
+		}
+	}
+}

+ 35 - 12
services/micro_roadshow.go

@@ -165,7 +165,7 @@ func GetHomeNewestList(userId, companyId, startSize, pageSize int, condition str
 }
 
 // GetMicroRoadShowPageList 获取微路演列表添加活动视频 更新与8.1版本
-func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter int, keywords, audioIds, videoIds, activityVideoIds string) (respList []*models.MicroRoadShowPageList, total int, err error) {
+func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId int, filter, keywords, audioIds, videoIds, activityVideoIds string) (respList []*models.MicroRoadShowPageList, total int, err error) {
 	var e error
 	// 根据每页数据量获取音视频配比
 	startSize := utils.StartIndex(currentIndex, pageSize)
@@ -250,12 +250,19 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 		videoCondAct += ` AND video_id = 0 `
 		videoCond += ` AND video_id = 0 `
 	}
-	if filter == 1 {
+	if strings.Contains(filter, "1") && !strings.Contains(filter, "2") {
 		audioCond += ` AND a.activity_voice_id = 0 `
-	} else if filter == 2 {
+	} else if !strings.Contains(filter, "1") && strings.Contains(filter, "2") {
 		videoCondAct += ` AND video_id = 0 `
 		videoCond += ` AND video_id = 0 `
 	}
+
+	if strings.Contains(filter, "3") && !strings.Contains(filter, "4") {
+		audioCond += ` AND a.activity_voice_id = 0 `
+		videoCondAct += ` AND video_id = 0 `
+	} else if strings.Contains(filter, "3") && !strings.Contains(filter, "4") {
+		videoCond += ` AND video_id = 0 `
+	}
 	if videoIds != "" {
 		sliceId := strings.Split(videoIds, ",")
 		var idSqlStr string
@@ -267,7 +274,7 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 	}
 	videoCond += ` AND publish_status = 1`
 	//}
-	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, audioId, videoId, activityVideoId, filter)
+	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars)
 	if e != nil {
 		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
 		return
@@ -277,7 +284,7 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 }
 
 // GetMicroRoadShowPageListIkWord  添加IK分词联想词 获取微路演列表添加活动视频 更新与8.1版本
-func CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, filter int, keywordArr []string, audioIds, videoIds, activityVideoIds string) (total int, err error) {
+func CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId int, keywordArr []string, filter, audioIds, videoIds, activityVideoIds string) (total int, err error) {
 	var e error
 	var keywords string
 	if len(keywordArr) > 0 {
@@ -358,13 +365,21 @@ func CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, filter
 		videoCondAct += ` AND video_id = 0 `
 		videoCond += ` AND video_id = 0 `
 	}
-	if filter == 1 {
+
+	if strings.Contains(filter, "1") && !strings.Contains(filter, "2") {
 		audioCond += ` AND a.activity_voice_id = 0 `
-	} else if filter == 2 {
+	} else if !strings.Contains(filter, "1") && strings.Contains(filter, "2") {
 		videoCondAct += ` AND video_id = 0 `
 		videoCond += ` AND video_id = 0 `
 	}
 
+	if strings.Contains(filter, "3") && !strings.Contains(filter, "4") {
+		audioCond += ` AND a.activity_voice_id = 0 `
+		videoCondAct += ` AND video_id = 0 `
+	} else if strings.Contains(filter, "3") && !strings.Contains(filter, "4") {
+		videoCond += ` AND video_id = 0 `
+	}
+
 	if videoIds != "" {
 		sliceId := strings.Split(videoIds, ",")
 		var idSqlStr string
@@ -385,7 +400,7 @@ func CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, filter
 }
 
 // GetMicroRoadShowPageListIkWord  添加IK分词联想词 获取微路演列表添加活动视频 更新与8.1版本
-func GetMicroRoadShowPageListIkWord(startSize, pageSize, audioId, videoId, activityVideoId, filter int, keywordArr []string, audioIds, videoIds, activityVideoIds, keywords string) (respList []*models.MicroRoadShowPageList, err error) {
+func GetMicroRoadShowPageListIkWord(startSize, pageSize, audioId, videoId, activityVideoId int, keywordArr []string, filter, audioIds, videoIds, activityVideoIds, keywords string) (respList []*models.MicroRoadShowPageList, err error) {
 
 	videoList := make([]*models.MicroRoadShowPageList, 0)
 	var e error
@@ -473,10 +488,18 @@ func GetMicroRoadShowPageListIkWord(startSize, pageSize, audioId, videoId, activ
 		videoCondAct += ` AND video_id = 0 `
 		videoCond += ` AND video_id = 0 `
 	}
-	if filter == 1 {
+
+	if strings.Contains(filter, "1") && !strings.Contains(filter, "2") {
+		audioCond += ` AND a.activity_voice_id = 0 `
+	} else if !strings.Contains(filter, "1") && strings.Contains(filter, "2") {
+		videoCondAct += ` AND video_id = 0 `
+		videoCond += ` AND video_id = 0 `
+	}
+
+	if strings.Contains(filter, "3") && !strings.Contains(filter, "4") {
 		audioCond += ` AND a.activity_voice_id = 0 `
-	} else if filter == 2 {
 		videoCondAct += ` AND video_id = 0 `
+	} else if strings.Contains(filter, "3") && !strings.Contains(filter, "4") {
 		videoCond += ` AND video_id = 0 `
 	}
 
@@ -491,7 +514,7 @@ func GetMicroRoadShowPageListIkWord(startSize, pageSize, audioId, videoId, activ
 	}
 	videoCond += ` AND publish_status = 1`
 	//}
-	videoList, e = models.GetMicroRoadShowVideoPageListIkWord(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, audioId, videoId, activityVideoId, filter)
+	videoList, e = models.GetMicroRoadShowVideoPageListIkWord(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars)
 	if e != nil {
 		err = errors.New("获取微路演音视频列表失败分词, Err: " + e.Error())
 		return
@@ -553,7 +576,7 @@ func GetMicroRoadShowMycollect(pageSize, currentIndex int, audioIds, videoIds, a
 	}
 	videoCond += ` AND publish_status = 1`
 
-	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, 0, 0, 0, 0)
+	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars)
 	if e != nil {
 		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
 		return

+ 74 - 0
services/morning_meeting.go

@@ -0,0 +1,74 @@
+package services
+
+import (
+	"context"
+	"fmt"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+//
+//func init() {
+//
+//	for i := 180; i > 0; i-- {
+//		MakeMorningMeetingReviews(i)
+//	}
+//
+//}
+
+func MakeMorningMeetingReviews(cont context.Context) (err error) {
+	//func MakeMorningMeetingReviews(day int) (err error) {
+	//func init12(day int) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("定时生成晨会精华汇总失败,err:"+err.Error(), 2)
+		}
+	}()
+	day := 0
+	hourstr := " 10:30:00 "
+	DayTime := time.Now().AddDate(0, 0, -day)
+	startSize := 0
+	pageSize := 100
+	var condition string
+	var pars []interface{}
+	startDate := DayTime.AddDate(0, 0, -1).Format(utils.FormatDate) + hourstr
+	endDate := DayTime.Format(utils.FormatDate) + hourstr
+
+	condition = ` 	AND publish_time  = ? `
+	pars = append(pars, endDate)
+	total, err := models.GetCygxMorningMeetingGatherCount(condition, pars)
+	if err != nil {
+		return
+	}
+	if total > 0 {
+		return
+	}
+	pars = make([]interface{}, 0)
+	condition = ` 	AND publish_time  BETWEEN ?   AND  ? `
+	pars = append(pars, startDate, endDate)
+
+	list, err := models.GetCygxMorningMeetingReviewsList(condition, pars, startSize, pageSize)
+	if err != nil {
+		return
+	}
+	if len(list) == 0 {
+		return
+	}
+	item := new(models.CygxMorningMeetingGather)
+	for _, v := range list {
+		item.MeetingIds += strconv.Itoa(v.Id) + ","
+	}
+	item.MeetingIds = strings.TrimRight(item.MeetingIds, ",")
+	item.Title = utils.GetTimeDateHourAndDay(DayTime) + "(" + utils.StrDateTimeToWeek(DayTime.Format(utils.FormatDateTime)) + ")" + "|晨会精华"
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+	item.PublishTime = endDate
+	item.Status = 1
+	err = models.AddCygxMorningMeetingGather(item)
+	return
+
+}

+ 3 - 4
services/page_history_record.go

@@ -10,7 +10,7 @@ import (
 	"time"
 )
 
-func AddCygxPageHistoryRecord(user *models.WxUserItem, Ctx *context.Context)  {
+func AddCygxPageHistoryRecord(user *models.WxUserItem, Ctx *context.Context) {
 	item := new(models.CygxPageHistoryRecord)
 	item.UserId = user.UserId
 	item.CreateTime = time.Now()
@@ -24,7 +24,7 @@ func AddCygxPageHistoryRecord(user *models.WxUserItem, Ctx *context.Context)  {
 	if index != -1 {
 		item.Parameter = item.Router[index+1:]
 	}
-	if Ctx.Input.Method() == "POST" {
+	if Ctx.Input.Method() == "POST" && string(Ctx.Input.RequestBody) != "" {
 		item.Parameter = string(Ctx.Input.RequestBody)
 		var pr models.PageRouter
 		err := json.Unmarshal(Ctx.Input.RequestBody, &pr)
@@ -46,11 +46,10 @@ func AddCygxPageHistoryRecord(user *models.WxUserItem, Ctx *context.Context)  {
 		}
 	}
 
-
 	_, err := models.AddCygxPageHistoryRecord(item)
 	if err != nil {
 		fmt.Println(err)
 		utils.FileLog.Info(err.Error())
 		return
 	}
-}
+}

+ 163 - 0
services/product_interior.go

@@ -0,0 +1,163 @@
+package services
+
+import (
+	"fmt"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"regexp"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// GetProductInteriorUrl 处理产品内测中的连接并做跳转处理
+func GetProductInteriorUrl(url string, urlMap map[string]string) (itemResp *models.ProductInteriorUrlResp) {
+	//2:文章详情  https://web.hzinsights.com/material/info/8436
+	//3:活动详情  https://web.hzinsights.com/activity/detail/2701
+	//4:产业详情  https://web.hzinsights.com/indepth/info/20/79
+	item := new(models.ProductInteriorUrlResp)
+	item.Body = url
+	if urlMap[url] == "" {
+		item.Type = 1
+	} else {
+		urlSlice := strings.Split(url, "/")
+		lenurlSlice := len(urlSlice)
+		sourceId, _ := strconv.Atoi(urlSlice[lenurlSlice-1])
+		item.SourceId = sourceId
+		if strings.Contains(url, "material/info") {
+			item.Type = 2
+		} else if strings.Contains(url, "activity/detail") {
+			item.Type = 3
+		} else if strings.Contains(url, "indepth/info") {
+			if lenurlSlice >= 2 {
+				chartPermissionId, _ := strconv.Atoi(urlSlice[lenurlSlice-2])
+				item.ChartPermissionId = chartPermissionId
+			}
+			item.Type = 4
+		}
+	}
+	itemResp = item
+	return
+}
+
+// GetProductInteriorUrl 处理产品内测中的连接并做跳转处理
+func GetProductInteriorUrlBody(body string) (itemResp []*models.ProductInteriorUrlResp) {
+	//2:文章详情  https://web.hzinsights.com/material/info/8436
+	//3:活动详情  https://web.hzinsights.com/activity/detail/2701
+	//4:产业详情  https://web.hzinsights.com/indepth/info/20/79
+	material := "material/info"
+	activity := "activity/detail"
+	indepth := "indepth/info"
+
+	var randStrStart = "start_cygx_{|}"
+	var randStr = "start_cygx_{|}_end_cygx"
+	urlMap := make(map[string]string)
+	var hrefRegexp = regexp.MustCompile(utils.RegularUrl)
+	match := hrefRegexp.FindAllString(body, -1)
+	if match != nil {
+		for _, v := range match {
+			//过滤不相干的超链接
+			if !strings.Contains(v, material) && !strings.Contains(v, activity) && !strings.Contains(v, indepth) {
+				continue
+			}
+			fmt.Println(v)
+			body = strings.Replace(body, fmt.Sprint("href=\"", v, "\""), "", -1)
+			body = strings.Replace(body, fmt.Sprint("<a >"), "", -1)
+			body = strings.Replace(body, fmt.Sprint("</a>"), "", -1)
+			body = strings.Replace(body, v, randStrStart+v+randStr, -1)
+			urlMap[v] = v
+		}
+	}
+	fmt.Println(urlMap)
+	sliceBody := strings.Split(body, randStr)
+	var sliceBodyUrl []string
+	for _, v := range sliceBody {
+		sliceUrl := strings.Split(v, randStrStart)
+		for _, url := range sliceUrl {
+			if url == "" {
+				continue
+			}
+			sliceBodyUrl = append(sliceBodyUrl, url)
+		}
+	}
+
+	for _, url := range sliceBodyUrl {
+		item := new(models.ProductInteriorUrlResp)
+		item.Body = url
+		if urlMap[url] == "" {
+			item.Type = 1
+		} else {
+			urlSlice := strings.Split(url, "/")
+			lenurlSlice := len(urlSlice)
+			sourceId, _ := strconv.Atoi(urlSlice[lenurlSlice-1])
+			item.SourceId = sourceId
+			if strings.Contains(url, material) {
+				item.Type = 2
+			} else if strings.Contains(url, activity) {
+				item.Type = 3
+			} else if strings.Contains(url, indepth) {
+				if lenurlSlice >= 2 {
+					chartPermissionId, _ := strconv.Atoi(urlSlice[lenurlSlice-2])
+					item.ChartPermissionId = chartPermissionId
+				}
+				item.Type = 4
+			}
+		}
+		itemResp = append(itemResp, item)
+	}
+	return
+}
+
+func AddCygxProductInteriorHistory(user *models.WxUserItem, articleId int) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
+		}
+	}()
+	historyRecord := new(models.CygxProductInteriorHistory)
+	historyRecord.UserId = user.UserId
+	historyRecord.ProductInteriorId = articleId
+	historyRecord.CreateTime = time.Now()
+	historyRecord.Mobile = user.Mobile
+	historyRecord.Email = user.Email
+	historyRecord.CompanyId = user.CompanyId
+	historyRecord.CompanyName = user.CompanyName
+	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	historyRecord.RealName = user.RealName
+	if sellerItem != nil {
+		historyRecord.SellerName = sellerItem.RealName
+	}
+	_, err = models.AddCygxProductInteriorHistory(historyRecord)
+	return
+}
+
+// 获取产品内测的阅读数据
+func GetCygxProductInteriorHistoryListMap(productInteriorIs []int, user *models.WxUserItem) (mapPv map[int]int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("获取产品内测的阅读数据,信息失败,Err:"+err.Error(), 3)
+		}
+	}()
+	lenproductInteriorIs := len(productInteriorIs)
+	if lenproductInteriorIs == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND product_interior_id IN (` + utils.GetOrmInReplace(lenproductInteriorIs) + `) AND  user_id = ?`
+	pars = append(pars, productInteriorIs, user.UserId)
+	list, err := models.GetCygxProductInteriorHistoryList(condition, pars)
+	if err != nil {
+		return
+	}
+	mapPv = make(map[int]int, 0)
+	for _, v := range list {
+		mapPv[v.ProductInteriorId]++
+	}
+	return
+}

+ 70 - 0
services/report_mapping.go

@@ -1,8 +1,11 @@
 package services
 
 import (
+	"fmt"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/utils"
+	"strconv"
+	"time"
 )
 
 func GetReportMappingMap() (mapResp map[int]bool, err error) {
@@ -24,3 +27,70 @@ func GetReportMappingMap() (mapResp map[int]bool, err error) {
 	return
 
 }
+
+// 生成查研观向的报告匹配类型
+func init111() {
+	list, err := models.GetReportMapping()
+	if err != nil {
+		fmt.Print(err)
+	}
+	var condition string
+	for _, v := range list {
+		if v.MatchTypeName == "" {
+			continue
+		}
+		item := new(models.CygxReportMappingCygx)
+		item.ChartPermissionId = v.ChartPermissionId
+		item.ChartPermissionName = v.ChartPermissionName
+		item.MatchTypeName = v.MatchTypeName
+		item.ReportType = v.ReportType
+		item.Sort = v.Sort
+		item.IsCustom = v.IsCustom
+		item.IsSummary = v.IsSummary
+		item.IsReport = v.IsReport
+		item.PermissionType = v.PermissionType
+		condition = ` AND match_type_name = '` + v.MatchTypeName + `' AND chart_permission_id =  ` + strconv.Itoa(v.ChartPermissionId)
+		total, err := models.GetCygxReportMappingCygxCount(condition)
+		if err != nil {
+			fmt.Print(err)
+		}
+		if total == 0 {
+			_, err = models.AddCygxReportMappingCygx(item)
+			if err != nil {
+				fmt.Print(err)
+			}
+		}
+	}
+}
+
+// 生成多对多关系表
+func init1232() {
+	list, err := models.GetCygxReportMappingCygx()
+	if err != nil {
+		fmt.Print(err)
+	}
+	var condition string
+	for _, v := range list {
+		if v.MatchTypeName == "" {
+			continue
+		}
+		condition = ` AND match_type_name = '` + v.MatchTypeName + `' AND chart_permission_id =  ` + strconv.Itoa(v.ChartPermissionId)
+		listCelue, err := models.GetCygxReportMappingcelue(condition)
+		if err != nil {
+			fmt.Print(err)
+		}
+		for _, vC := range listCelue {
+			item := new(models.CygxReportMappingGroup)
+			item.IdCygx = v.Id
+			item.CategoryIdCelue = vC.CategoryId
+			item.CreateTime = time.Now()
+			item.ModifyTime = time.Now()
+			fmt.Println(item)
+			_, err = models.AddCygxReportMappingGroup(item)
+			if err != nil {
+				fmt.Print(err)
+			}
+		}
+
+	}
+}

+ 83 - 2
services/resource_data.go

@@ -36,7 +36,11 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 	var activityvideoIds []string
 	var activityvoiceIds []string
 	var activityspecialIds []int
-	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+	var researchsummaryIds []int
+	var minutessummaryIds []int
+	var meetingreviewchaptIds []int
+	var productinteriorIds []int
+	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt "`
 	for _, v := range list {
 		if v.Source == "article" {
 			articleIds = append(articleIds, v.SourceId)
@@ -52,9 +56,17 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			activityvoiceIds = append(activityvoiceIds, strconv.Itoa(v.SourceId))
 		} else if v.Source == "activityspecial" {
 			activityspecialIds = append(activityspecialIds, v.SourceId)
+		} else if v.Source == "researchsummary" {
+			researchsummaryIds = append(researchsummaryIds, v.SourceId)
+		} else if v.Source == "minutessummary" {
+			minutessummaryIds = append(minutessummaryIds, v.SourceId)
+		} else if v.Source == "meetingreviewchapt" {
+			meetingreviewchaptIds = append(meetingreviewchaptIds, v.SourceId)
+		} else if v.Source == "productinterior" {
+			productinteriorIds = append(productinteriorIds, v.SourceId)
 		}
-	}
 
+	}
 	//处理文章
 	if len(articleIds) > 0 {
 		pars = make([]interface{}, 0)
@@ -79,6 +91,75 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 		}
 	}
 
+	//处理晨会精华
+	if len(meetingreviewchaptIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
+		pars = append(pars, meetingreviewchaptIds)
+
+		listrMeet, e := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+		for _, v := range listrMeet {
+			v.Content = AnnotationHtml(v.Content)
+			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
+			mapItems[fmt.Sprint("meetingreviewchapt", v.Id)].Meetingreviewchapt = v
+		}
+	}
+
+	//处理上周纪要汇总
+	if len(minutessummaryIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND article_id IN (` + utils.GetOrmInReplace(len(minutessummaryIds)) + `)`
+		pars = append(pars, minutessummaryIds)
+
+		listresearchsummary, e := models.GetReportSelectionListHome(condition, "cygx_minutes_summary", pars, 0, len(minutessummaryIds))
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+		for _, v := range listresearchsummary {
+			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
+			mapItems[fmt.Sprint("minutessummary", v.ArticleId)].Minutessummary = v
+		}
+	}
+
+	//处理本周纪要汇总
+	if len(researchsummaryIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND article_id IN (` + utils.GetOrmInReplace(len(researchsummaryIds)) + `)`
+		pars = append(pars, researchsummaryIds)
+
+		listresearchsummary, e := models.GetReportSelectionListHome(condition, "cygx_research_summary", pars, 0, len(researchsummaryIds))
+		if e != nil {
+			err = errors.New("GetReportSelectionListHome, Err: " + e.Error())
+			return
+		}
+		for _, v := range listresearchsummary {
+			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
+			mapItems[fmt.Sprint("researchsummary", v.ArticleId)].Researchsummary = v
+		}
+	}
+
+	//处理产品内测
+	if len(productinteriorIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = `  AND art.status = 1 AND art.product_interior_id  IN (` + utils.GetOrmInReplace(len(productinteriorIds)) + `)`
+		pars = append(pars, productinteriorIds)
+		listProductInterior, e := models.GetCygxProductInteriorList(condition, pars, 0, len(productinteriorIds))
+		if e != nil {
+			err = errors.New("GetCygxProductInteriorList, Err: " + e.Error())
+			return
+		}
+		for _, v := range listProductInterior {
+			v.Body = ProductInteriorHtml(v.Body)
+			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
+			mapItems[fmt.Sprint("productinterior", v.ProductInteriorId)].ProductInterior = v
+		}
+	}
+
 	detail, e := models.GetConfigByCode("city_img_url")
 	if e != nil {
 		err = errors.New("GetResourceDataList, Err: " + e.Error())

+ 3 - 0
services/task.go

@@ -105,6 +105,9 @@ func Task() {
 		//sendWxMsgActivitySpecialCancel := task.NewTask("sendWxMsgActivitySpecialCancel", "0 0 8 * * *", SendWxMsgActivitySpecialCancel)
 		//task.AddTask("sendWxMsgActivitySpecialCancel", sendWxMsgActivitySpecialCancel) // 线下活动前4天08:00报名人数不足7人,线上活动前3天08:00报名人数不足10人,活动自动取消发布,并推送模板消息至报名客户及对口销售
 
+		makeMorningMeetingReviews := task.NewTask("makeMorningMeetingReviews", "0 30 10 * * *", MakeMorningMeetingReviews)
+		task.AddTask("makeMorningMeetingReviews", makeMorningMeetingReviews) //每天10::30定时生成晨会精华汇总
+
 	}
 	if utils.RunMode != "release" {
 		getArticleListByApi := task.NewTask("getArticleListByApi", "0 */60 * * * *", GetArticleListByApi) //通过三方接口获取策略平台上的文章

+ 32 - 0
services/user.go

@@ -791,6 +791,38 @@ func GetUserhasPermission(user *models.WxUserItem) (hasPermission int, err error
 	return
 }
 
+// 获取用户有没有开通任意一个行业权限
+func GetUserhasPermissionOne(user *models.WxUserItem) (hasPermission int, err error) {
+	//判断是否已经申请过
+	applyCount, err := models.GetApplyRecordCount(user.UserId)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	if applyCount > 0 {
+		hasPermission = 3
+	} else {
+		hasPermission = 4
+	}
+	//HasPermission int  `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	if user.CompanyId > 1 {
+		companyPermission, errPer := models.GetCompanyPermission(user.CompanyId)
+		if errPer != nil {
+			err = errPer
+			return
+		}
+		if companyPermission == "" {
+			if applyCount > 0 {
+				hasPermission = 3
+			} else {
+				hasPermission = 4
+			}
+		} else {
+			hasPermission = 1
+		}
+	}
+	return
+}
+
 // 每周五发送当前所有的权益用户
 func SendEmailAllUserWithRAI() (err error) {
 	defer func() {

+ 59 - 37
services/yidong.go

@@ -555,7 +555,6 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 	condition += ` AND   activity_time > ` + "'" + startDate + "'"
 	condition += ` AND  activity_time < ` + "'" + endDate + "'"
 	//fmt.Println(startDate)
-
 	artivityListYidong, err := models.GetActivityListByYidong(condition)
 	if err != nil {
 		fmt.Println("GetActivityListByYidong Err:", err.Error())
@@ -627,6 +626,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 		}
 		var mobiles []string
 		var mobileStr string
+		var mobileStrMeet string
 		mapActivityAttendanceDetail := make(map[string]*models.CygxActivityAttendanceDetail)
 		if len(ApifoxModal.Result) > 0 {
 			itemlog := new(models.CygxYidongActivityMeetingApiLog)
@@ -640,6 +640,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 			}
 			var itemsUpdate []*models.CygxActivitySignupDetail
 			needAddAttendanc := make([]*models.CygxActivityAttendanceDetail, 0)
+
 			for _, vresult := range ApifoxModal.Result {
 				if vresult.EndTime != "" {
 					mobiles = append(mobiles, vresult.PersonTelephone)
@@ -662,8 +663,23 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 					mapActivityAttendanceDetail[vresult.PersonTelephone].Duration = utils.GetAttendanceDetailSecondsByYiDong(vresult.Duration)
 					itemsUpdate = append(itemsUpdate, itemDetail)
 				}
+
+				item := new(models.CygxActivityAttendanceDetail)
+				item.ActivityId = v.ActivityId
+				item.Mobile = vresult.PersonTelephone
+				if vresult.Duration != "" {
+					item.FirstMeetingTime = vresult.StartTime
+					item.LastMeetingTime = vresult.EndTime
+					item.Duration = vresult.Duration
+					item.IsMeetingStr = 1
+					mobileStrMeet += "'" + vresult.PersonTelephone + "'" + ","
+
+				}
+				mobileStr += "'" + vresult.PersonTelephone + "'" + ","
+				item.CreateTime = time.Now()
+				needAddAttendanc = append(needAddAttendanc, item)
+
 			}
-			fmt.Println(mobiles)
 			lenmobiles := len(mobiles)
 			if lenmobiles > 0 {
 				var parsYd []interface{}
@@ -680,58 +696,64 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 					fmt.Println("UpdateActivitySignupDetailMultiByYiDong Err:", err.Error())
 					return err
 				}
-				var condition string
-				var pars []interface{}
-				condition = ` AND do_fail_type = 0 AND mobile IN (` + utils.GetOrmInReplace(lenmobiles) + `) AND activity_id = ?`
-				pars = append(pars, mobiles, v.ActivityId)
-				listSignup, e := models.GetActivitySignupList(condition, pars)
-				if e != nil {
-					err = errors.New("GetActivitySignupList, Err: " + e.Error())
-					return err
-				}
-
-				for _, vSignup := range listSignup {
-					item := new(models.CygxActivityAttendanceDetail)
-					item.ActivityId = vSignup.ActivityId
-					item.RealName = vSignup.RealName
-					item.Mobile = vSignup.Mobile
-					item.CompanyName = vSignup.CompanyName
-					if mapActivityAttendanceDetail[vSignup.Mobile] != nil {
-						item.FirstMeetingTime = mapActivityAttendanceDetail[vSignup.Mobile].FirstMeetingTime
-						item.LastMeetingTime = mapActivityAttendanceDetail[vSignup.Mobile].LastMeetingTime
-						item.Duration = mapActivityAttendanceDetail[vSignup.Mobile].Duration
-						item.IsMeetingStr = 1
-						mobileStr += "'" + vSignup.Mobile + "'" + ","
-					}
-					item.CreateTime = time.Now()
-					needAddAttendanc = append(needAddAttendanc, item)
-				}
+				//var condition string
+				//var pars []interface{}
+				//condition = ` AND do_fail_type = 0 AND mobile IN (` + utils.GetOrmInReplace(lenmobiles) + `) AND activity_id = ?`
+				//pars = append(pars, mobiles, v.ActivityId)
+				//listSignup, e := models.GetActivitySignupList(condition, pars)
+				//if e != nil {
+				//	err = errors.New("GetActivitySignupList, Err: " + e.Error())
+				//	return err
+				//}
+
+				//for _, vSignup := range listSignup {
+				//	item := new(models.CygxActivityAttendanceDetail)
+				//	item.ActivityId = vSignup.ActivityId
+				//	item.RealName = vSignup.RealName
+				//	item.Mobile = vSignup.Mobile
+				//	item.CompanyName = vSignup.CompanyName
+				//	if mapActivityAttendanceDetail[vSignup.Mobile] != nil {
+				//		item.FirstMeetingTime = mapActivityAttendanceDetail[vSignup.Mobile].FirstMeetingTime
+				//		item.LastMeetingTime = mapActivityAttendanceDetail[vSignup.Mobile].LastMeetingTime
+				//		item.Duration = mapActivityAttendanceDetail[vSignup.Mobile].Duration
+				//		item.IsMeetingStr = 1
+				//		mobileStr += "'" + vSignup.Mobile + "'" + ","
+				//	}
+				//	item.CreateTime = time.Now()
+				//	needAddAttendanc = append(needAddAttendanc, item)
+				//}
 			}
 
 			mobileStr = strings.TrimRight(mobileStr, ",")
 			if mobileStr == "" {
 				mobileStr = "1"
 			}
+			mobileStrMeet = strings.TrimRight(mobileStrMeet, ",")
+			if mobileStrMeet == "" {
+				mobileStrMeet = "1"
+			}
+
 			listUser, err := models.GetWxUserOutboundMobile(mobileStr)
 			if err != nil {
 				fmt.Println("GetWxUserOutboundMobile Err:", err.Error())
 				return err
 			}
-			for k, v := range needAddAttendanc {
+
+			for kAdd, vAdd := range needAddAttendanc {
 				for _, v2 := range listUser {
-					if v2.OutboundMobile == v.Mobile || v2.Mobile == v.Mobile {
-						if needAddAttendanc[k].CompanyId == 0 {
-							needAddAttendanc[k].CompanyId = v2.CompanyId
-							needAddAttendanc[k].SellerName = v2.SellerName
-							needAddAttendanc[k].CompanyName = v2.CompanyName
-							needAddAttendanc[k].IsMeetingStr = 1
+					if v2.OutboundMobile == vAdd.Mobile || v2.Mobile == vAdd.Mobile {
+						if needAddAttendanc[kAdd].CompanyId <= 1 {
+							needAddAttendanc[kAdd].CompanyId = v2.CompanyId
+							needAddAttendanc[kAdd].SellerName = v2.SellerName
+							needAddAttendanc[kAdd].CompanyName = v2.CompanyName
+							//needAddAttendanc[k].IsMeetingStr = 1
 						}
 					}
 				}
 			}
 			//fmt.Println(mobileStr)
 			//参会记录
-			err = models.AddAttendancDetail(needAddAttendanc, v.ActivityId, mobileStr)
+			err = models.AddAttendancDetail(needAddAttendanc, v.ActivityId, mobileStrMeet)
 			if err != nil {
 				fmt.Println("AddAttendancDetail Err:", err.Error())
 				return err
@@ -742,7 +764,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 				fmt.Println("AddCygxActivityRestrictSignupByAdmin Err:", err.Error())
 				return err
 			}
-
+			fmt.Println(len(needAddAttendanc))
 			go AddctivitySignupDetailByJmcj(needAddAttendanc, v.ActivityId)
 		}
 	}

+ 27 - 0
utils/common.go

@@ -727,6 +727,7 @@ func StrDateTimeToWeek(strTime string) string {
 		"Sunday":    "周日",
 	}
 	var ctime = StrTimeToTime(strTime).Format("2006-01-02")
+	fmt.Println(ctime)
 	startday, _ := time.Parse("2006-01-02", ctime)
 	staweek_int := startday.Weekday().String()
 	return WeekDayMap[staweek_int]
@@ -828,3 +829,29 @@ func StrDateToTime(strTime string) time.Time {
 	resultTime, _ := time.ParseInLocation(timeLayout, strTime, loc)
 	return resultTime
 }
+
+// 获取时间的月跟日
+func GetTimeDateHourAndDay(DayTime time.Time) (dataStr string) {
+	dataSlice := strings.Split(DayTime.Format(FormatDate), "-")
+	for k, v := range dataSlice {
+		if k == 0 {
+			continue
+		}
+		dataStr += v + "."
+	}
+	dataStr = strings.TrimRight(dataStr, ".")
+	return
+}
+
+// 时间格式去掉年
+func GetTimeDateRemoveYear(strTime string) (dataStr string) {
+	slicePublishTime := strings.Split(strTime, "-")
+	for k, v := range slicePublishTime {
+		if k == 0 {
+			continue
+		}
+		dataStr += v + "-"
+	}
+	dataStr = strings.TrimRight(dataStr, "-")
+	return dataStr
+}

+ 9 - 4
utils/constants.go

@@ -27,14 +27,16 @@ const (
 	DefaultHeadimgurl = "https://hzstatic.hzinsights.com/static/temp/20220426202204/20220426/P5qLR2zzfBdKItp3eX2Du1tvq9Ba.jpg"
 	ApiAuthorization  = "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkiLCJwaG9uZV9udW1iZXIiOiIxMjM0NTY3ODkiLCJuYW1lIjoi5YW25LuWIiwiZW50cmFuY2UiOiJwYXNzd3dvcmQiLCJpYXQiOjE2MzQ4NzA1OTQsImV4cCI6MTYzNDg3NDE5NH0.tho2L9jsbDPn8ltEGUVDve_nHsh0Kzf6ZrSz0RcZ0ag"
 	ApiUrl            = "https://vmp.hzinsights.com/v2api/"
+	REGISTER_PLATFORM = 1 // 来源 1小程序,2:网页
 )
 
 // 手机号,电子邮箱正则
 const (
-	RegularMobile             = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(16[0-9])|(19[0-9]))\\d{8}$" //手机号码
-	RegularFixedTelephone     = "^(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{7,14}$"                                              //手机号码
-	RegularFixedTelephoneEasy = "^[0-9\\-]+$"                                                                             //手机号码
-	RegularEmail              = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                             //匹配电子邮箱
+	RegularMobile             = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(16[0-9])|(19[0-9]))\\d{8}$"               //手机号码
+	RegularFixedTelephone     = "^(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{7,14}$"                                                            //手机号码
+	RegularFixedTelephoneEasy = "^[0-9\\-]+$"                                                                                           //手机号码
+	RegularEmail              = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                                           //匹配电子邮箱
+	RegularUrl                = `(http|ftp|https):\/\/([\w\-_]+(?:(?:\.[\w\-_]+)+))([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?` //匹配电子邮箱
 )
 
 // 聚合短信
@@ -165,5 +167,8 @@ const (
 const (
 	ACtIVITY_SPECIAL_EXPLAIN      = "此类调研具体行程尚未确定,待预报名人数满10人后弘则会确定行程并推送给您活动日期,只有在确定行程中再次报名才完成占位。"                        //专项调研说明
 	ACtIVITY_SPECIAL_TRIP_EXPLAIN = "此类调研时间安排已经确定,点击报名后按人次扣除对应机构的服务点数。由于每场活动人数有限,如果不能参加请提前48小时取消,未及时取消导致影响其他客户报名将会维持扣点。" //专项调研说明
+)
 
+const (
+	GAO_YI_ZI_CHAN_COMPANY_ID = 5285 // 高毅资产ID
 )