Skip to content

Commit 5d95193

Browse files
committed
fix get node info
1 parent 99dcae4 commit 5d95193

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

service/common/bean/bean.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,15 @@ type NodeIp struct {
408408
CursorNum uint32 `bson:"cursor_num"`
409409
Lifetime uint64 `bson:"lifetime"`
410410
Method string `bson:"method"`
411-
412-
IP string `bson:"ip"`
411+
Param struct {
412+
Nodeuuid string `bson:"nodeuuid"`
413+
Seedip string `bson:"seedip"`
413414
Port string `bson:"port"`
414-
NodeId string `bson:"nodeid"`
415+
Slaveiplist string `bson:"slaveiplist"`
416+
Capacity string `bson:"capacity"`
417+
Latitude string `bson:"latitude"`
418+
Longitude string `bson:"longitude"`
419+
} `bson:"param"`
415420

416421
Sender string `bson:"sender"`
417422
SigAlg uint32 `bson:"sig_alg"`

service/dashboard/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/micro/go-micro"
3232
"golang.org/x/net/context"
3333
"gopkg.in/mgo.v2/bson"
34+
"github.com/bottos-project/magiccube/service/common/util"
3435
)
3536

3637
// Dashboard struct
@@ -485,19 +486,19 @@ func (u *Dashboard) GetNodeIp(ctx context.Context, req *dashboard_proto.GetNodeI
485486
var mgo = mgo.Session()
486487
defer mgo.Close()
487488

488-
count, err := mgo.DB(config.DB_NAME).C("pointxy").Find(&bson.M{}).Count()
489-
log.Info(count)
489+
count, err := mgo.DB(config.DB_NAME).C("pre_regnodeinfo").Find(&bson.M{}).Count()
490+
log.Info("count: ",count)
490491
if err != nil {
491492
log.Error(err)
492493
}
493-
mgo.DB(config.DB_NAME).C("pointxy").Find(&bson.M{}).Sort("-_id").Skip(skip).Limit(pageSize).All(&ret)
494+
mgo.DB(config.DB_NAME).C("pre_regnodeinfo").Find(&bson.M{}).Sort("-_id").Skip(skip).Limit(pageSize).All(&ret)
494495

495496
var rows = []*dashboard_proto.NodeIpDataRow{}
496497
for _, v := range ret {
497498
rows = append(rows, &dashboard_proto.NodeIpDataRow{
498-
Ip: v.IP,
499-
Port: v.Port,
500-
NodeId: v.NodeId,
499+
Ip: util.HexIptoDec(v.Param.Seedip),
500+
Port: v.Param.Port,
501+
NodeId: v.Param.Nodeuuid,
501502
})
502503
}
503504

0 commit comments

Comments
 (0)