소스 검색

我的收藏没有绑定联系方式的时候添加分页字段

xingzai 2 년 전
부모
커밋
05011e857c
1개의 변경된 파일15개의 추가작업 그리고 12개의 파일을 삭제
  1. 15 12
      controllers/chart.go

+ 15 - 12
controllers/chart.go

@@ -62,8 +62,20 @@ func (this *ChartController) Collection() {
 	}
 	mobile := user.Mobile
 	uid := user.UserId
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
 	resp := new(models.HomeChartListItem)
 	if mobile == "" {
+		page := paging.GetPaging(currentIndex, pageSize, 0)
+		resp.Paging = page
 		br.Ret = 200
 		br.Success = true
 		br.Msg = "获取成功"
@@ -73,16 +85,7 @@ func (this *ChartController) Collection() {
 	} else {
 		resp.IsBindingMobile = true
 	}
-	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)
+
 	//list, err, total := services.GetChartCollectionByApi(mobile, pageSize, (currentIndex-1)*pageSize)
 	//if err != nil {
 	//	br.Msg = "获取图表分类失败!"
@@ -177,8 +180,8 @@ func (this *ChartController) Detail() {
 		return
 	}
 	detail.IsCollection = GetIsCollectionChart
-	if detail.CollectionNum > 0 {
-		detail.IsCollection = true
+	if detail.IsCollection {
+		err = models.RemoveChartCollect(user.UserId, chartId)
 	}
 	br.Ret = 200
 	br.Success = true