Browse Source

feed: 测试配方下发

Yi 1 year ago
parent
commit
7366f6fc1f
3 changed files with 5 additions and 3 deletions
  1. 0 2
      http/route/ops_api.go
  2. 5 0
      module/backend/feed_service.go
  3. 0 1
      module/backend/statistic_service.go

+ 0 - 2
http/route/ops_api.go

@@ -25,7 +25,6 @@ func OpsAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
 		opsRoute.POST("/pasture/is_show", pasture.IsShowGroupPasture)
 
 		// 牲牧类型
-		// opsRoute.GET("/cattle/category/parent_list", pasture.ParentCattleCategoryList)
 		opsRoute.POST("/cattle/category/add", pasture.AddCattleCategory)
 		opsRoute.POST("/cattle/category/edit", pasture.EditCattleCategory)
 		opsRoute.POST("/cattle/category/is_show", pasture.IsShowCattleCategory)
@@ -33,7 +32,6 @@ func OpsAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
 		opsRoute.POST("/cattle/category/list", pasture.SearchCattleCategory)
 
 		// 饲料类别
-		// opsRoute.GET("/forage/category/parent_list", pasture.ParentForageCategoryList)
 		opsRoute.POST("/forage/category/add", pasture.AddForageCategory)
 		opsRoute.POST("/forage/category/edit", pasture.EditForageCategory)
 		opsRoute.POST("/forage/category/is_show", pasture.IsShowForageCategory)

+ 5 - 0
module/backend/feed_service.go

@@ -359,6 +359,10 @@ func (s *StoreEntry) DistributeFeedFormula(ctx context.Context, req *operationPb
 					body = append(body, v)
 				}
 			}
+			if len(body) <= 0 {
+				return
+			}
+
 			request := &model.DistributeFeedFormulaRequest{
 				PastureId: p.Id,
 				Body:      body,
@@ -371,6 +375,7 @@ func (s *StoreEntry) DistributeFeedFormula(ctx context.Context, req *operationPb
 					muError = multierr.Append(muError, xerr.Custom(response.Msg))
 				}
 			}()
+
 			if err = s.PastureHttpClient(ctx, model.FeedFormulaDistributeUrl, p.Id, request, response); err != nil {
 				muError = multierr.Append(muError, err)
 				zaplog.Error("DistributeFeedFormula", zap.Any("pasture", p), zap.Any("body", distributeData.FeedFormulaList), zap.Any("err", err), zap.Any("response", response))

+ 0 - 1
module/backend/statistic_service.go

@@ -49,7 +49,6 @@ func (s *StoreEntry) PastureHttpClient(ctx context.Context, apiUrl string, pastu
 		return xerr.WithStack(err)
 	}
 	return nil
-
 }
 
 // SearchFormulaEstimateList 配方评估