|
@@ -32,8 +32,6 @@ func (s *StoreEntry) CreateGroupPasture(ctx context.Context, req *operationPb.Ad
|
|
|
if err := s.PastureAccountDistribution(ctx, groupPasture); err != nil {
|
|
|
s.DB.Model(new(model.GroupPasture)).Where("id = ?", groupPasture.Id).Update("is_delete", operationPb.IsShow_NO)
|
|
|
return xerr.WithStack(err)
|
|
|
- } else {
|
|
|
- s.DB.Model(new(model.GroupPasture)).Where("id = ?", groupPasture.Id).Update("is_distribution", operationPb.IsShow_OK)
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
@@ -43,17 +41,22 @@ func (s *StoreEntry) PastureAccountDistribution(ctx context.Context, groupPastur
|
|
|
if groupPasture.Domain == "" {
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+ pastureId := groupPasture.Id
|
|
|
+ if groupPasture.PastureId > 0 {
|
|
|
+ pastureId = groupPasture.PastureId
|
|
|
+ }
|
|
|
body := &model.AccountDistribution{
|
|
|
Account: groupPasture.Account,
|
|
|
UserName: groupPasture.ManagerUser,
|
|
|
Password: groupPasture.Password,
|
|
|
Phone: groupPasture.ManagerPhone,
|
|
|
- PastureId: int32(groupPasture.Id),
|
|
|
+ PastureId: int32(pastureId),
|
|
|
PastureName: groupPasture.Name,
|
|
|
Address: groupPasture.Address,
|
|
|
}
|
|
|
res := &model.PastureCommonResponse{}
|
|
|
- if _, err := s.PastureHttpClient(ctx, model.PastureAccountDistributionURl, groupPasture.GetPastureId(), body, res); err != nil {
|
|
|
+ if _, err := s.PastureHttpClient(ctx, model.PastureAccountDistributionURl, groupPasture.Id, body, res); err != nil {
|
|
|
zaplog.Error("AccountDistribution", zap.Any("url", model.PastureAccountDistributionURl), zap.Any("err", err), zap.Any("body", body), zap.Any("res", res))
|
|
|
return xerr.WithStack(err)
|
|
|
}
|