Browse Source

搜索内容记录优化

xingzai 3 years ago
parent
commit
f8e9f02dee
1 changed files with 31 additions and 26 deletions
  1. 31 26
      controllers/activity.go

+ 31 - 26
controllers/activity.go

@@ -528,8 +528,8 @@ func (this *ActivityCoAntroller) GetUserSearchContent() {
 	//	return
 	//}
 	isShowJurisdiction, _ := this.GetInt("IsShowJurisdiction")
-	chartPermissionidsSlice := strings.Split(detail.ChartPermissionids, ",")
-	activityTypeidsSlice := strings.Split(detail.ActivityTypeids, ",")
+	//chartPermissionidsSlice := strings.Split(detail.ChartPermissionids, ",")
+	//activityTypeidsSlice := strings.Split(detail.ActivityTypeids, ",")
 	activeStateSlice := strings.Split(detail.ActiveState, ",") //"活动进行状态 未开始:1、进行中2、已结束3"`
 	listActivityType, errActivityType := models.GetActivityTypeList()
 	if errActivityType != nil {
@@ -537,13 +537,13 @@ func (this *ActivityCoAntroller) GetUserSearchContent() {
 		br.ErrMsg = "获取数据失败,Err:" + errActivityType.Error()
 		return
 	}
-	for _, v := range activityTypeidsSlice {
-		for k2, v2 := range listActivityType {
-			if strconv.Itoa(v2.ActivityTypeId) == v {
-				listActivityType[k2].IsChoose = true
-			}
-		}
-	}
+	//for _, v := range activityTypeidsSlice {
+	//	for k2, v2 := range listActivityType {
+	//		if strconv.Itoa(v2.ActivityTypeId) == v {
+	//			listActivityType[k2].IsChoose = true
+	//		}
+	//	}
+	//}
 	var listChartPermissionid []*models.ActivityChartPermission
 	var errChart error
 	if isShowJurisdiction == 1 {
@@ -571,37 +571,42 @@ func (this *ActivityCoAntroller) GetUserSearchContent() {
 		br.ErrMsg = "获取品种信息失败,Err:" + errChart.Error()
 		return
 	}
-	for _, v := range chartPermissionidsSlice {
-		for k2, v2 := range listChartPermissionid {
-			if strconv.Itoa(v2.ChartPermissionId) == v {
-				listChartPermissionid[k2].IsChoose = true
-			}
-		}
-	}
+	//for _, v := range chartPermissionidsSlice {
+	//	for k2, v2 := range listChartPermissionid {
+	//		if strconv.Itoa(v2.ChartPermissionId) == v {
+	//			listChartPermissionid[k2].IsChoose = true
+	//		}
+	//	}
+	//}
 	resp := new(models.ActivityUserSearchContentList)
-	resp.ListActivityType = listActivityType
-	resp.ListChartPermission = listChartPermissionid
+
 	if detail.IsShowJurisdiction == 1 {
 		resp.IsShowJurisdiction = true
+
 	}
 
 	if isShowJurisdiction == 1 {
 		resp.IsShowJurisdiction = true
+		for k, _ := range listActivityType {
+			listActivityType[k].IsChoose = true
+		}
 	}
 	if isShowJurisdiction == 2 {
 		resp.IsShowJurisdiction = false
 	}
 	activeStateList := []models.ActivityStaus{models.ActivityStaus{Id: 1, StatusName: "未开始"}, models.ActivityStaus{Id: 2, StatusName: "进行中"}, models.ActivityStaus{Id: 3, StatusName: "已结束"}}
-	for _, v := range activeStateSlice {
-		for k2, v2 := range activeStateList {
-			if strconv.Itoa(v2.Id) == v {
-				activeStateList[k2].IsChoose = true
-			}
-		}
-	}
+	//for _, v := range activeStateSlice {
+	//	for k2, v2 := range activeStateList {
+	//		if strconv.Itoa(v2.Id) == v {
+	//			//activeStateList[k2].IsChoose = true
+	//		}
+	//	}
+	//}
 	if activeStateList[1].IsChoose == activeStateList[2].IsChoose == false {
 		activeStateList[0].IsChoose = true
 	}
+	resp.ListActivityType = listActivityType
+	resp.ListChartPermission = listChartPermissionid
 	resp.ListActivityStaus = activeStateList
 	br.Ret = 200
 	br.Success = true
@@ -671,7 +676,7 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 	totalMeeting, errMeeting := models.GetActivityMeetingReminderCount(uid, activityId)
 	if errMeeting != nil {
 		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
+		br.ErrMsg = "获取失败,Err:" + errMeeting.Error()
 		return
 	}
 	if totalMeeting > 0 {