Browse Source

重置优化

xingzai 3 years ago
parent
commit
e6c62265dd
2 changed files with 13 additions and 37 deletions
  1. 8 33
      controllers/activity.go
  2. 5 4
      models/activity_user_search_content.go

+ 8 - 33
controllers/activity.go

@@ -952,38 +952,22 @@ func (this *ActivityCoAntroller) GetUserSearchContent() {
 		return
 	}
 	uid := user.UserId
-
 	detailSeearch := new(models.CygxActivityUserSearchContent)
 	detailSeearch.IsShowJurisdiction = 0
 	detailSeearch.ChartPermissionids = ""
 	detailSeearch.ActiveState = ""
-
+	resp := new(models.ActivityUserSearchContentList)
 	detail, _ := models.GetUserSearchContentByUid(uid)
 	if detail == nil {
 		detail = detailSeearch
 	}
-	//if err != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "获取信息失败,Err:" + err.Error()
-	//	return
-	//}
 	isShowJurisdiction, _ := this.GetInt("IsShowJurisdiction")
-	//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 {
 		br.Msg = "获取失败"
 		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
-	//		}
-	//	}
-	//}
 	var listChartPermissionid []*models.ActivityChartPermission
 	var errChart error
 	if isShowJurisdiction == 1 {
@@ -1011,15 +995,6 @@ 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
-	//		}
-	//	}
-	//}
-	resp := new(models.ActivityUserSearchContentList)
-
 	if detail.IsShowJurisdiction == 1 {
 		resp.IsShowJurisdiction = true
 	}
@@ -1035,13 +1010,13 @@ func (this *ActivityCoAntroller) GetUserSearchContent() {
 		resp.IsShowJurisdiction = false
 	}
 	activeStateList := []models.ActivityStaus{models.ActivityStaus{Id: 1, StatusName: "未开始", IsChoose: true}, 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
-	//		}
-	//	}
-	//}
+	list2, err := models.GetChartPermissionActivity()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	resp.ListChartPermission2 = list2
 	if activeStateList[1].IsChoose == activeStateList[2].IsChoose == false {
 		activeStateList[0].IsChoose = true
 	}

+ 5 - 4
models/activity_user_search_content.go

@@ -58,10 +58,11 @@ func GetUserSearchContentByUid(uid int) (item *CygxActivityUserSearchContent, er
 }
 
 type ActivityUserSearchContentList struct {
-	IsShowJurisdiction  bool `description:"是否仅展示有权限的,1是,0否"`
-	ListActivityStaus   []ActivityStaus
-	ListChartPermission []*ActivityChartPermission
-	ListActivityType    []*ActivityType
+	IsShowJurisdiction   bool `description:"是否仅展示有权限的,1是,0否"`
+	ListActivityStaus    []ActivityStaus
+	ListChartPermission  []*ActivityChartPermission
+	ListChartPermission2 []*ActivityChartPermission
+	ListActivityType     []*ActivityType
 }
 
 type ActivityStaus struct {