You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
881 B
36 lines
881 B
package v1
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"pure-admin/model/request"
|
|
"pure-admin/model/response"
|
|
"pure-admin/service"
|
|
"pure-admin/utils"
|
|
)
|
|
|
|
// GetChainInfo
|
|
// @Summary 获取区块链数据
|
|
// @Description
|
|
// @Tags Chain
|
|
// @Param data query request.ChainParams false "data..."
|
|
// @Success 200 {object} []response.ChainResp "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /base/chain [get]
|
|
func GetChainInfo(c *gin.Context) {
|
|
var (
|
|
err error
|
|
params request.ChainParams
|
|
result []response.ChainResp
|
|
)
|
|
_ = c.ShouldBindQuery(¶ms)
|
|
if err := utils.Verify(params, utils.ChainVerify); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
err, result = service.GetChainInfo(params.Hash)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithData(result, c)
|
|
}
|
|
|