block_chain_controller.go 2.7 KB
package controllers

import (
	"github.com/linmadan/egglib-go/web/beego"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/blockChain/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/blockChain/service"
)

type BlockChainController struct {
	beego.BaseController
}

//func (controller *BlockChainController) CreateBlockChain() {
//	blockChainService := service.NewBlockChainService(nil)
//	createBlockChainCommand := &command.CreateBlockChainCommand{}
//	controller.Unmarshal(createBlockChainCommand)
//	data, err := blockChainService.CreateBlockChain(createBlockChainCommand)
//	controller.Response(data, err)
//}
//
//func (controller *BlockChainController) UpdateBlockChain() {
//	blockChainService := service.NewBlockChainService(nil)
//	updateBlockChainCommand := &command.UpdateBlockChainCommand{}
//	controller.Unmarshal(updateBlockChainCommand)
//	blockChainId, _ := controller.GetString(":blockChainId")
//	updateBlockChainCommand.BlockChainId = blockChainId
//	data, err := blockChainService.UpdateBlockChain(updateBlockChainCommand)
//	controller.Response(data, err)
//}
//
//func (controller *BlockChainController) GetBlockChain() {
//	blockChainService := service.NewBlockChainService(nil)
//	getBlockChainQuery := &query.GetBlockChainQuery{}
//	blockChainId, _ := controller.GetString(":blockChainId")
//	getBlockChainQuery.BlockChainId = blockChainId
//	data, err := blockChainService.GetBlockChain(getBlockChainQuery)
//	controller.Response(data, err)
//}
//
//func (controller *BlockChainController) RemoveBlockChain() {
//	blockChainService := service.NewBlockChainService(nil)
//	removeBlockChainCommand := &command.RemoveBlockChainCommand{}
//	controller.Unmarshal(removeBlockChainCommand)
//	blockChainId, _ := controller.GetString(":blockChainId")
//	removeBlockChainCommand.BlockChainId = blockChainId
//	data, err := blockChainService.RemoveBlockChain(removeBlockChainCommand)
//	controller.Response(data, err)
//}

func (controller *BlockChainController) ListBlockChain() {
	blockChainService := service.NewBlockChainService(nil)
	listBlockChainQuery := &query.ListBlockChainQuery{}
	Must(controller.Unmarshal(listBlockChainQuery))
	listBlockChainQuery.OperateInfo = ParseOperateInfo(controller.BaseController)
	data, err := blockChainService.ListBlockChain(listBlockChainQuery)
	controller.Response(data, err)
}

func (controller *BlockChainController) GetBlockChainToken() {
	blockChainService := service.NewBlockChainService(nil)
	listBlockChainQuery := &query.GetBlockChainTokenQuery{}
	Must(controller.Unmarshal(listBlockChainQuery))
	//listBlockChainQuery.OperateInfo = ParseOperateInfo(controller.BaseController)
	data, err := blockChainService.GetBlockChainToken(listBlockChainQuery)
	controller.Response(data, err)
}