config 动态加载进来了的,没法初始化的加载进去,麻烦,直接传递过来
This commit is contained in:
		
							parent
							
								
									65ddbab658
								
							
						
					
					
						commit
						622a368a25
					
				| 
						 | 
				
			
			@ -11,7 +11,7 @@ func Order(ctx context.Context, tag string, request *proto.OrderRequest) (*proto
 | 
			
		|||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	request.Config = srv.Config
 | 
			
		||||
	//request.Config = srv.Config
 | 
			
		||||
	return srv.Impl.Order(ctx, request)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -20,7 +20,6 @@ func Query(ctx context.Context, tag string, request *proto.QueryRequest) (*proto
 | 
			
		|||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	request.Config = srv.Config
 | 
			
		||||
	return srv.Impl.Query(ctx, request)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,6 +28,5 @@ func Notify(ctx context.Context, tag string, request *proto.NotifyRequest) (*pro
 | 
			
		|||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	request.Config = srv.Config
 | 
			
		||||
	return srv.Impl.Notify(ctx, request)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,6 @@
 | 
			
		|||
package manage
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
 | 
			
		||||
	"github.com/go-playground/validator/v10"
 | 
			
		||||
| 
						 | 
				
			
			@ -20,7 +19,7 @@ type Config struct {
 | 
			
		|||
	Timeout     time.Duration // 插件超时时间
 | 
			
		||||
 | 
			
		||||
	// 供应商配置
 | 
			
		||||
	Config json.RawMessage
 | 
			
		||||
	// Config json.RawMessage
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *Config) Validate() error {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,15 +1,14 @@
 | 
			
		|||
package manage
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type PluginInfo struct {
 | 
			
		||||
	Tag     string
 | 
			
		||||
	Impl    shared.PluginService
 | 
			
		||||
	Config  json.RawMessage
 | 
			
		||||
	Tag  string
 | 
			
		||||
	Impl shared.PluginService
 | 
			
		||||
	//Config  json.RawMessage
 | 
			
		||||
	cleanup func()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -34,9 +33,9 @@ func (m *pluginManage) add(c *Config) error {
 | 
			
		|||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	m.plugins[c.Tag] = &PluginInfo{
 | 
			
		||||
		Tag:     c.Tag,
 | 
			
		||||
		Impl:    impl,
 | 
			
		||||
		Config:  c.Config,
 | 
			
		||||
		Tag:  c.Tag,
 | 
			
		||||
		Impl: impl,
 | 
			
		||||
		//Config:  c.Config,
 | 
			
		||||
		cleanup: cleanup,
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue