mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
Merge branch 'feature/data-mask' into 'main'
fix rest service publish See merge request apipark/APIPark!95
This commit is contained in:
@@ -113,7 +113,7 @@ func (m *imlReleaseModule) Create(ctx context.Context, serviceId string, input *
|
||||
return "", errors.New("api or document not found")
|
||||
}
|
||||
|
||||
upstreams, err := m.upstreamService.ListLatestCommit(ctx, serviceId)
|
||||
upstreams, err := m.upstreamService.ListLatestCommit(ctx, cluster.DefaultClusterID, serviceId)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return "", errors.New("api config or document not found")
|
||||
|
||||
@@ -153,7 +153,7 @@ func (m *imlServiceDiff) DiffForLatest(ctx context.Context, serviceId string, ba
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
upstreamCommits, err := m.upstreamService.ListLatestCommit(ctx, serviceId)
|
||||
upstreamCommits, err := m.upstreamService.ListLatestCommit(ctx, cluster.DefaultClusterID, serviceId)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package service
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/APIParkLab/APIPark/service/subscribe"
|
||||
|
||||
service_dto "github.com/APIParkLab/APIPark/module/service/dto"
|
||||
"github.com/eolinker/go-common/auto"
|
||||
|
||||
@@ -16,7 +18,8 @@ import (
|
||||
var _ strategy_filter.IRemoteFilter = (*imlAppFilter)(nil)
|
||||
|
||||
type imlAppFilter struct {
|
||||
service service.IServiceService `autowired:""`
|
||||
service service.IServiceService `autowired:""`
|
||||
subscriberService subscribe.ISubscribeService `autowired:""`
|
||||
}
|
||||
|
||||
func (i *imlAppFilter) Name() string {
|
||||
@@ -94,6 +97,24 @@ func (i *imlAppFilter) RemoteList(ctx context.Context, keyword string, condition
|
||||
if condition == nil {
|
||||
condition = make(map[string]interface{})
|
||||
}
|
||||
if serviceId, ok := condition["service"]; ok {
|
||||
// 查询订阅了该服务的消费者
|
||||
v, ok := serviceId.(string)
|
||||
if ok {
|
||||
subscribers, err := i.subscriberService.Subscribers(ctx, v, subscribe.ApplyStatusSubscribe)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
if len(subscribers) > 0 {
|
||||
appIds := utils.SliceToSlice(subscribers, func(s *subscribe.Subscribe) string {
|
||||
return s.Application
|
||||
})
|
||||
condition["uuid"] = appIds
|
||||
}
|
||||
|
||||
}
|
||||
delete(condition, "service")
|
||||
}
|
||||
condition["as_app"] = true
|
||||
if pageSize == -1 {
|
||||
// 获取全部
|
||||
|
||||
@@ -212,5 +212,5 @@ func updateHandler(e *strategy.Strategy, i *Edit) {
|
||||
if i.IsStop != nil {
|
||||
e.IsStop = *i.IsStop
|
||||
}
|
||||
|
||||
e.UpdateAt = time.Now()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user