|
@@ -155,11 +155,16 @@ func (s *StoreEntry) SearchGroupPastureList(ctx context.Context, req *operationP
|
|
}, nil
|
|
}, nil
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) GroupPastureList(ctx context.Context) ([]*model.GroupPasture, error) {
|
|
|
|
|
|
+// DataSyncGroupPastureList 用户数据下发的牧场
|
|
|
|
+func (s *StoreEntry) DataSyncGroupPastureList(ctx context.Context) ([]*model.GroupPasture, error) {
|
|
groupPastureList := make([]*model.GroupPasture, 0)
|
|
groupPastureList := make([]*model.GroupPasture, 0)
|
|
- if err := s.DB.Model(new(model.GroupPasture)).Where("is_delete = ? ", operationPb.IsShow_OK).Find(&groupPastureList).Error; err != nil {
|
|
|
|
|
|
+ if err := s.DB.Model(new(model.GroupPasture)).Where("is_delete = ? ", operationPb.IsShow_OK).
|
|
|
|
+ Where("is_show = ?", operationPb.IsShow_OK).Where("domain != ''").
|
|
|
|
+ Where("is_distribution = ?", operationPb.IsShow_OK).
|
|
|
|
+ Find(&groupPastureList).Error; err != nil {
|
|
return nil, xerr.WithStack(err)
|
|
return nil, xerr.WithStack(err)
|
|
}
|
|
}
|
|
|
|
+ zaplog.Info("GroupPastureList", zap.Any("data", groupPastureList))
|
|
return groupPastureList, nil
|
|
return groupPastureList, nil
|
|
}
|
|
}
|
|
|
|
|
|
@@ -514,7 +519,7 @@ func (s *StoreEntry) SearchForageCategoryList(ctx context.Context, req *operatio
|
|
|
|
|
|
// CategoryDistribution 饲料分类和畜牧分类下发
|
|
// CategoryDistribution 饲料分类和畜牧分类下发
|
|
func (s *StoreEntry) CategoryDistribution(ctx context.Context, url string, req *model.CategoryRequest) error {
|
|
func (s *StoreEntry) CategoryDistribution(ctx context.Context, url string, req *model.CategoryRequest) error {
|
|
- groupList, err := s.GroupPastureList(ctx)
|
|
|
|
|
|
+ groupList, err := s.DataSyncGroupPastureList(ctx)
|
|
if err != nil {
|
|
if err != nil {
|
|
return xerr.WithStack(err)
|
|
return xerr.WithStack(err)
|
|
}
|
|
}
|
|
@@ -549,7 +554,7 @@ func (s *StoreEntry) CategoryDistribution(ctx context.Context, url string, req *
|
|
|
|
|
|
// CategoryDelete 饲料分类和畜牧分类删除
|
|
// CategoryDelete 饲料分类和畜牧分类删除
|
|
func (s *StoreEntry) CategoryDelete(ctx context.Context, url string, req *model.CategoryDeleteRequest) error {
|
|
func (s *StoreEntry) CategoryDelete(ctx context.Context, url string, req *model.CategoryDeleteRequest) error {
|
|
- groupList, err := s.GroupPastureList(ctx)
|
|
|
|
|
|
+ groupList, err := s.DataSyncGroupPastureList(ctx)
|
|
if err != nil {
|
|
if err != nil {
|
|
return xerr.WithStack(err)
|
|
return xerr.WithStack(err)
|
|
}
|
|
}
|
|
@@ -560,7 +565,7 @@ func (s *StoreEntry) CategoryDelete(ctx context.Context, url string, req *model.
|
|
res := &model.PastureCommonResponse{}
|
|
res := &model.PastureCommonResponse{}
|
|
req.PastureId = int32(data.Id)
|
|
req.PastureId = int32(data.Id)
|
|
if err = s.PastureHttpClient(ctx, url, int64(data.Id), req, res); err != nil {
|
|
if err = s.PastureHttpClient(ctx, url, int64(data.Id), req, res); err != nil {
|
|
- zaplog.Error("CategoryDistribution",
|
|
|
|
|
|
+ zaplog.Error("CategoryDelete",
|
|
zap.Any("url", url),
|
|
zap.Any("url", url),
|
|
zap.Any("err", err),
|
|
zap.Any("err", err),
|
|
zap.Any("body", req),
|
|
zap.Any("body", req),
|
|
@@ -569,7 +574,7 @@ func (s *StoreEntry) CategoryDelete(ctx context.Context, url string, req *model.
|
|
}
|
|
}
|
|
|
|
|
|
if res.Code != http.StatusOK {
|
|
if res.Code != http.StatusOK {
|
|
- zaplog.Error("CategoryDistribution-http",
|
|
|
|
|
|
+ zaplog.Error("CategoryDelete-http",
|
|
zap.Any("url", url),
|
|
zap.Any("url", url),
|
|
zap.Any("body", req),
|
|
zap.Any("body", req),
|
|
zap.Any("res", res),
|
|
zap.Any("res", res),
|