This commit is contained in:
yanweidong 2024-03-01 18:05:16 +08:00
parent 27da26336f
commit 708542ff72
2 changed files with 14 additions and 8 deletions

View File

@ -5,17 +5,25 @@ import (
"fmt"
"os/exec"
"strings"
"time"
"git.apinb.com/bsm-sdk/engine/env"
"git.apinb.com/bsm-sdk/engine/utils"
"git.apinb.com/bsm-sdk/engine/vars"
"github.com/modood/table"
"github.com/spf13/cobra"
"gorm.io/gorm"
)
type JSONData struct {
Msg string `json:"msg"`
Code int `json:"code"`
Data []ActionsReleases `json:"data"`
}
type ActionsReleases struct {
gorm.Model
ID uint `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
Identity string
Origin string
ServiceKey string
@ -46,15 +54,16 @@ var psCmd = &cobra.Command{
}
func psExecute() {
fmt.Println("Blocks Registry:", registryUrl)
pt := make([]PsTable, 0)
body, err := utils.HttpGet(registryUrl)
checkError(err)
var ms []ActionsReleases
var ms JSONData
err = json.Unmarshal(body, &ms)
checkError(err)
for _, v := range ms {
for _, v := range ms.Data {
srvLine := getSrvStatus(v.ServiceKey)
srvLine.ServiceKey = v.ServiceKey
srvLine.Origin = v.Origin
@ -83,10 +92,6 @@ func getSrvStatus(srv string) PsTable {
}
func getPerformance(srv string) string {
}
func getCurrentVersion(srv string) string {
var data map[string]string

View File

@ -14,6 +14,7 @@ var (
func init() {
// get os env.
env.NewEnv()
psCmd.Flags().StringVarP(&registryUrl, "registry", "r", "", "registry url.")