Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1561 from weichang-bianjie/hotfix/v0.11.2.0803
Browse files Browse the repository at this point in the history
R4R:close lcd api call in config api
  • Loading branch information
kaifei Hu authored Sep 14, 2020
2 parents b44a4e3 + 0eda6ca commit b7450c9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
20 changes: 12 additions & 8 deletions backend/orm/document/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ const (
)

type Config struct {
NetworkName string `bson:"network_name"`
Env string `bson:"env"`
Host string `bson:"host"`
ChainId string `bson:"chain_id"`
ShowFaucet int `bson:"show_faucet"`
EnvLcd string `bson:"env_lcd"`
UmengId int64 `bson:"umeng_id"`
NetworkName string `bson:"network_name"`
Env string `bson:"env"`
Host string `bson:"host"`
ChainId string `bson:"chain_id"`
ShowFaucet int `bson:"show_faucet"`
EnvLcd string `bson:"env_lcd"`
UmengId int64 `bson:"umeng_id"`
NodeVersion string `bson:"node_version"`
TendermintVersion string `bson:"tendermint_version"`
}

func (c Config) String() string {
Expand All @@ -35,7 +37,9 @@ func (c Config) String() string {
ShowFaucet :%v
EnvLcd :%v
UmengId :%v
`, c.NetworkName, c.Env, c.Host, c.ChainId, c.ShowFaucet, c.EnvLcd, c.UmengId)
NodeVersion :%v
TendermintVersion :%v
`, c.NetworkName, c.Env, c.Host, c.ChainId, c.ShowFaucet, c.EnvLcd, c.UmengId, c.NodeVersion, c.TendermintVersion)
}

func (a Config) Name() string {
Expand Down
27 changes: 14 additions & 13 deletions backend/rest/controller/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/irisnet/explorer/backend/types"
"github.com/irisnet/explorer/backend/vo"
"github.com/irisnet/explorer/backend/orm/document"
"github.com/irisnet/explorer/backend/lcd"
)

func RegisterTextSearch(r *mux.Router) error {
Expand Down Expand Up @@ -81,19 +80,21 @@ func registerQueryEnvConfig(r *mux.Router) error {
getconfig := func(dconfigs []document.Config) (ret []vo.ConfigVo) {
for _, val := range dconfigs {
item := vo.ConfigVo{
NetworkName: val.NetworkName,
Env: val.Env,
Host: val.Host,
ChainId: val.ChainId,
ShowFaucet: val.ShowFaucet,
UmengId: val.UmengId,
}
if nodeinfo, err := lcd.NodeInfo(val.EnvLcd); err == nil {
item.TendermintVersion = nodeinfo.Version
}
if version, err := lcd.NodeVersion(val.EnvLcd); err == nil {
item.NodeVersion = version
NetworkName: val.NetworkName,
Env: val.Env,
Host: val.Host,
ChainId: val.ChainId,
ShowFaucet: val.ShowFaucet,
UmengId: val.UmengId,
NodeVersion: val.NodeVersion,
TendermintVersion: val.TendermintVersion,
}
//if nodeinfo, err := lcd.NodeInfo(val.EnvLcd); err == nil {
// item.TendermintVersion = nodeinfo.Version
//}
//if version, err := lcd.NodeVersion(val.EnvLcd); err == nil {
// item.NodeVersion = version
//}
ret = append(ret, item)
}
return ret
Expand Down

0 comments on commit b7450c9

Please sign in to comment.