handler.go 730 字节
package goqueue

import (
	"fmt"
	"github.com/linmadan/egglib-go/utils/json"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/blockChain/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/blockChain/service"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
)

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 {
		return err
	}
	_, err = blockChainService.UpChain(upChainCommand)
	return err
}