...
|
...
|
@@ -10,11 +10,11 @@ import ( |
|
|
)
|
|
|
|
|
|
func UpToChainHandler(k, v string) error {
|
|
|
log.Logger.Debug(fmt.Sprintf("%s", v), map[string]interface{}{"handler": "UptoChain"})
|
|
|
blockChainService := service.NewBlockChainService(nil)
|
|
|
upChainCommand := &command.UpChainCommand{}
|
|
|
err := json.UnmarshalFromString(v, upChainCommand)
|
|
|
if err != nil {
|
|
|
log.Logger.Error(err.Error(), map[string]interface{}{"info": "UpToChainHandler 解析json错误", "data": v})
|
|
|
return err
|
|
|
}
|
|
|
_, err = blockChainService.UpChain(upChainCommand)
|
...
|
...
|
@@ -26,9 +26,12 @@ func FilterTopicHandler(topic string, handler func(string, string) error) func(s |
|
|
raw := &RawData{}
|
|
|
err := json.UnmarshalFromString(v, raw)
|
|
|
if err != nil {
|
|
|
log.Logger.Error("【GoQueue】消息解析错误:"+err.Error(), map[string]interface{}{"info": "FilterTopicHandler 解析json错误", "data": v})
|
|
|
return err
|
|
|
}
|
|
|
log.Logger.Debug(fmt.Sprintf("【GoQueue】收到消息 Topic:%s", raw.Topic), map[string]interface{}{"data": v})
|
|
|
if raw.Topic != topic {
|
|
|
log.Logger.Debug(fmt.Sprintf("【GoQueue】 topic not equal get:%v want:%v", raw.Topic, topic), map[string]interface{}{"data": v})
|
|
|
return nil
|
|
|
}
|
|
|
return handler(k, string(raw.Data))
|
...
|
...
|
|