|
@@ -748,7 +748,9 @@ func (s *StoreEntry) DistributeFeedFormula(ctx context.Context, req *operationPb
|
|
|
b, _ := json.Marshal(request)
|
|
|
res, _ := json.Marshal(response)
|
|
|
pastureDataLog := model.NewPastureDataLog(int64(p.Id), PastureDataLogType["FeedFormula_Distribute"], model.FeedFormulaDistributeUrl, string(b), string(res))
|
|
|
- s.DB.Create(pastureDataLog)
|
|
|
+ if err = s.DB.Create(pastureDataLog).Error; err != nil {
|
|
|
+ zaplog.Error("DistributeFeedFormula", zap.Any("pastureDataLog", pastureDataLog), zap.Any("err", err))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}(pasture)
|
|
@@ -999,12 +1001,14 @@ func (s *StoreEntry) checkoutDistributeData(ctx context.Context, req *operationP
|
|
|
PastureList: make([]*operationPb.AddPastureRequest, 0),
|
|
|
FeedFormulaList: make([]*operationPb.DistributeFeedRequest, 0),
|
|
|
}
|
|
|
-
|
|
|
- if err := s.DB.Where("id IN ?", req.PastureIds).Where("is_delete = ?", operationPb.IsShow_OK).Find(&result.PastureList).Error; err != nil {
|
|
|
+ newGroupPastureList := make([]*model.GroupPasture, 0)
|
|
|
+ if err := s.DB.Model(new(model.GroupPasture)).Where("id IN ?", req.PastureIds).Where("is_delete = ?", operationPb.IsShow_OK).Find(&newGroupPastureList).Error; err != nil {
|
|
|
return result, xerr.WithStack(err)
|
|
|
}
|
|
|
+ result.PastureList = model.GroupPastureSlice(newGroupPastureList).ToPB()
|
|
|
|
|
|
- if err := s.DB.Where("id IN ?", req.FeedFormulaIds).Find(&result.FeedFormulaList).Error; err != nil {
|
|
|
+ newFeedFormulaList := make([]*model.FeedFormula, 0)
|
|
|
+ if err := s.DB.Model(new(model.FeedFormula)).Where("id IN ?", req.FeedFormulaIds).Find(&newFeedFormulaList).Error; err != nil {
|
|
|
return result, xerr.WithStack(err)
|
|
|
}
|
|
|
|