Bladeren bron

Merge branch 'cygx_9.7' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 jaren geleden
bovenliggende
commit
b3583abf92
7 gewijzigde bestanden met toevoegingen van 32 en 23 verwijderingen
  1. 20 18
      controllers/activity.go
  2. 1 0
      controllers/article.go
  3. 6 2
      controllers/industry.go
  4. 1 0
      controllers/report.go
  5. 1 1
      models/activity.go
  6. 1 0
      models/report_mapping.go
  7. 2 2
      services/activity.go

+ 20 - 18
controllers/activity.go

@@ -362,23 +362,23 @@ func (this *ActivityCoAntroller) Detail() {
 		if activityInfo.IsHideAppointment == 0 {
 			activityInfo.IsShowAppointment = services.IsShowAppointment(activityInfo.ActivityTypeId, activityInfo.ChartPermissionName)
 		}
-		if activityInfo.ReportLink != "" {
-			artList := strings.Split(activityInfo.ReportLink, "{|}")
-			if len(artList) > 0 {
-				for _, v := range artList {
-					artitem := new(models.ActivityArticleResp)
-					artitem.ReportLink = v
-					artIdSlice := strings.Split(v, "/")
-					if len(artIdSlice) > 0 {
-						articleId, _ := strconv.Atoi(artIdSlice[len(artIdSlice)-1])
-						artitem.ArticleId = articleId
-					}
-					activityInfo.ArticleList = append(activityInfo.ArticleList, artitem)
-				}
-			}
-		} else {
-			activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
-		}
+		//if activityInfo.ReportLink != "" {
+		//	artList := strings.Split(activityInfo.ReportLink, "{|}")
+		//	if len(artList) > 0 {
+		//		for _, v := range artList {
+		//			artitem := new(models.ActivityArticleResp)
+		//			artitem.ReportLink = v
+		//			artIdSlice := strings.Split(v, "/")
+		//			if len(artIdSlice) > 0 {
+		//				articleId, _ := strconv.Atoi(artIdSlice[len(artIdSlice)-1])
+		//				artitem.ArticleId = articleId
+		//			}
+		//			activityInfo.ArticleList = append(activityInfo.ArticleList, artitem)
+		//		}
+		//	}
+		//} else {
+		//	activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
+		//}
 		activityInfo.ActivityTypeName = strings.Replace(activityInfo.ActivityTypeName, "(C类)", "", -1)
 
 		//处理活动关联的产业
@@ -518,7 +518,9 @@ func (this *ActivityCoAntroller) Detail() {
 				br.ErrMsg = "解析文章关联的报告内容失败:" + activityInfo.ReportLink
 				return
 			}
-			activityInfo.ListArticle = artList
+			activityInfo.ArticleList = artList
+		} else {
+			activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
 		}
 		//处理按钮是否展示问题
 		resp.Detail = services.ActivityButtonShow(activityInfo)

+ 1 - 0
controllers/article.go

@@ -102,6 +102,7 @@ func (this *ArticleController) Detail() {
 				return
 			}
 			for _, v := range industrialList {
+				fmt.Println(v.IndustrialManagementId)
 				if industryUserFollowMap[v.IndustrialManagementId] {
 					detail.IsFollowButton = true
 				}

+ 6 - 2
controllers/industry.go

@@ -32,7 +32,7 @@ func (this *IndustryController) Fllow() {
 	}
 	uid := user.UserId
 	var req models.IndustryFllowArryReq
-
+	resp := new(models.CygxIndustryFllowResp)
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
 	if err != nil {
 		br.Msg = "参数解析异常!"
@@ -42,6 +42,7 @@ func (this *IndustryController) Fllow() {
 	sourceId := req.SourceId
 	source := req.Source
 	doType := req.DoType
+	var status int
 	var condition string
 	var pars []interface{}
 	var industrialIds []int
@@ -86,6 +87,7 @@ func (this *IndustryController) Fllow() {
 	}
 	//批量取关与关注
 	if doType == "add" {
+		status = 1
 		var industryFllowItems []*models.CygxIndustryFllow
 		for _, v := range industrialIds {
 			item := new(models.CygxIndustryFllow)
@@ -103,6 +105,7 @@ func (this *IndustryController) Fllow() {
 		}
 		err = models.AddCygxIndustryFllowMulti(industryFllowItems)
 	} else if doType == "cancel" {
+		status = 2
 		pars = make([]interface{}, 0)
 		condition = ` AND  industrial_management_id IN (` + utils.GetOrmInReplace(lenindustrialIds) + `)`
 		pars = append(pars, industrialIds)
@@ -117,10 +120,11 @@ func (this *IndustryController) Fllow() {
 		br.ErrMsg = "取消关注失败,Err:" + err.Error()
 		return
 	}
+	resp.Status = status
 	//处理是否关注全部赛道字段
 	//go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
 	br.Msg = "操作成功"
 	br.Ret = 200
 	br.Success = true
-	//br.Data = resp
+	br.Data = resp
 }

+ 1 - 0
controllers/report.go

@@ -443,6 +443,7 @@ func (this *ReportController) ArticleCategoryList() {
 			return
 		}
 		resp.IsFollowButton = industryUserFollowMap[industrialManagementId]
+		resp.IsShowFollowButton = true
 	}
 	br.Ret = 200
 	br.Success = true

+ 1 - 1
models/activity.go

@@ -115,6 +115,7 @@ type ActivityRep struct {
 type ActivityArticleResp struct {
 	ReportLink string `description:"报告链接"`
 	ArticleId  int    `description:"报告id(报告链接跳转使用)"`
+	Title      string `description:"报告id(报告链接跳转使用)"`
 }
 
 // 活动详情
@@ -198,7 +199,6 @@ type ActivityDetail struct {
 	IsCollect               bool                       `description:"是否收藏"`
 	IsShowFollowButton      bool                       `description:"是否展示关注取关按钮"`
 	IsFollowButton          bool                       `description:"是否关注"`
-	ListArticle             []*ArticleIdAndTitle       `description:"活动关联的文章"`
 }
 type ListArticleActivity struct {
 	Title   string `description:"文章标题"`

+ 1 - 0
models/report_mapping.go

@@ -106,6 +106,7 @@ type IndustrialToArticleCategoryListRep struct {
 	LayoutTime             string `description:"布局时间"`
 	IndustryName           string `description:"产业名称"`
 	IndustrialManagementId int    `description:"产业D"`
+	IsShowFollowButton     bool   `description:"是否展示关注取关按钮"`
 	IsFollowButton         bool   `description:"是否关注"`
 	IndustryVideo          *MicroVideoSimpleInfo
 	List                   []*IndustrialToArticleCategoryRep

+ 2 - 2
services/activity.go

@@ -1948,7 +1948,7 @@ func ActivityVideoUserRmind(user *models.WxUserItem, activityId, fileType int) (
 }
 
 // 解析活动填写的报告链接
-func GetActivityReportLinkToArticleList(item *models.ActivityDetail) (items []*models.ArticleIdAndTitle, err error) {
+func GetActivityReportLinkToArticleList(item *models.ActivityDetail) (items []*models.ActivityArticleResp, err error) {
 	reportLink := item.ReportLink
 	//处理活动的
 	var articleIds []int
@@ -1983,7 +1983,7 @@ func GetActivityReportLinkToArticleList(item *models.ActivityDetail) (items []*m
 	}
 	if len(listArticle) > 0 {
 		for _, v := range listArticle {
-			artItem := new(models.ArticleIdAndTitle)
+			artItem := new(models.ActivityArticleResp)
 			artItem.ArticleId = v.ArticleId
 			artItem.Title = v.Title
 			items = append(items, artItem)