Yi 1 жил өмнө
parent
commit
ddb394fdf2

+ 1 - 1
module/backend/pasture_service.go

@@ -62,7 +62,7 @@ func (s *StoreEntry) PastureAccountDistribution(ctx context.Context, groupPastur
 		return xerr.WithStack(err)
 	}
 
-	if res.Code != http.StatusOK {
+	if res.Code == http.StatusOK {
 		if err := s.DB.Model(new(model.GroupPasture)).Where("id = ?", groupPasture.Id).Update("is_distribution", operationPb.IsShow_OK).Error; err != nil {
 			zaplog.Error("AccountDistribution-Update", zap.Any("url", model.PastureAccountDistributionURl), zap.Any("err", err), zap.Any("body", body), zap.Any("res", res))
 			return xerr.Customf("%s", res.Msg)

+ 8 - 0
module/backend/pasture_sync_service.go

@@ -148,6 +148,10 @@ func (s *StoreEntry) FeedFormulaSyncData(ctx context.Context, req *operationPb.F
 			if err = s.FeedFormulaInsert(ctx, groupPasture, response.Data.List); err != nil {
 				return xerr.WithStack(err)
 			}
+			if total <= (pageSize * page) {
+				break
+			}
+			page++
 		}
 
 	}
@@ -289,6 +293,10 @@ func (s *StoreEntry) FeedFormulaDetailListSyncData(ctx context.Context, req *ope
 			if response.Data.Total > 0 && response.Data.List != nil {
 				total = int(math.Ceil(float64(response.Data.Total) / float64(pageSize)))
 			}
+			if total <= (page * pageSize) {
+				break
+			}
+			page++
 			if err = s.FeedFormulaDetailInsert(ctx, groupPasture, response.Data.List); err != nil {
 				return xerr.WithStack(err)
 			}