Commit e68f9d41 authored by 谢宇轩's avatar 谢宇轩 😅

修改插件使用的数据格式

parent 37a9bead
...@@ -37,20 +37,20 @@ func (p PipeLine) Enter(m Matedate) Matedate { ...@@ -37,20 +37,20 @@ func (p PipeLine) Enter(m Matedate) Matedate {
// 修改插件 // 修改插件
type Edit struct { type Edit struct {
Params map[string]interface{} Params []map[string]string
} }
func (p Edit) Handle(m Matedate) Matedate { func (p Edit) Handle(m Matedate) Matedate {
key := fmt.Sprintf("%s", p.Params["key"]) for _, item := range p.Params {
log.Println(key) currentKey := item["key"]
log.Println(p.Params["value"]) currentParams := item["value"]
m[key] = p.Params["value"] m[currentKey] = currentParams
m["EDIT"] = "ok" }
return m return m
} }
func (p *Edit) setParams(params string) { func (p *Edit) setParams(params string) {
var paramsValue map[string]interface{} var paramsValue []map[string]string
err := json.Unmarshal([]byte(params), &paramsValue) err := json.Unmarshal([]byte(params), &paramsValue)
if err != nil { if err != nil {
log.Printf("Edit Plugin json decode params(%s) err : err: %s", params, err) log.Printf("Edit Plugin json decode params(%s) err : err: %s", params, err)
...@@ -69,14 +69,7 @@ func (p SaveES) Handle(m Matedate) Matedate { ...@@ -69,14 +69,7 @@ func (p SaveES) Handle(m Matedate) Matedate {
} }
func (p *SaveES) setParams(params string) { func (p *SaveES) setParams(params string) {}
var paramsValue map[string]interface{}
err := json.Unmarshal([]byte(params), &paramsValue)
if err != nil {
log.Printf("SaveES Plugin json decode params(%s) err : err: %s", params, err)
}
p.Params = paramsValue
}
// 打印 // 打印
type Dump struct { type Dump struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment