|
|
@ -1,15 +1,15 @@ |
|
|
|
package siterpc |
|
|
|
|
|
|
|
// import (
|
|
|
|
// "encoding/json"
|
|
|
|
// "errors"
|
|
|
|
// "strconv"
|
|
|
|
// "time"
|
|
|
|
import ( |
|
|
|
"encoding/json" |
|
|
|
"log" |
|
|
|
"strconv" |
|
|
|
"time" |
|
|
|
|
|
|
|
// "git.tetele.net/tgo/crypter"
|
|
|
|
"git.tetele.net/tgo/crypter" |
|
|
|
|
|
|
|
// "github.com/golang/protobuf/proto"
|
|
|
|
// )
|
|
|
|
"github.com/golang/protobuf/proto" |
|
|
|
) |
|
|
|
|
|
|
|
type SiteInfoReq struct { |
|
|
|
Master string |
|
|
@ -17,9 +17,9 @@ type SiteInfoReq struct { |
|
|
|
} |
|
|
|
|
|
|
|
type SiteInfoRes struct { |
|
|
|
SiteId string |
|
|
|
Dbname string |
|
|
|
Domainname string |
|
|
|
SiteId string `json:"site_id"` |
|
|
|
Dbname string `json:"database"` |
|
|
|
Domainname string `json:"domainname"` |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -27,8 +27,8 @@ type SiteInfoRes struct { |
|
|
|
* 请求及回均加密验签 |
|
|
|
* 2021/06/24 |
|
|
|
* GZ |
|
|
|
|
|
|
|
func GetSiteInfoByHost(host string, url ...string) (*SiteInfoRes, error) { |
|
|
|
*/ |
|
|
|
func GetSiteInfoByHost(master, host string, url ...string) (*SiteInfoRes, error) { |
|
|
|
|
|
|
|
conn, err := rpc_server_conn(url...) |
|
|
|
if err != nil { |
|
|
@ -36,7 +36,7 @@ func GetSiteInfoByHost(host string, url ...string) (*SiteInfoRes, error) { |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
arg := SiteInfoReq{host} |
|
|
|
arg := SiteInfoReq{master, host} |
|
|
|
|
|
|
|
data_json, err := json.Marshal(arg) |
|
|
|
if err != nil { |
|
|
@ -60,8 +60,13 @@ func GetSiteInfoByHost(host string, url ...string) (*SiteInfoRes, error) { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
res_data := GetOrgData(res) |
|
|
|
res_data, err := GetOrgData(res) |
|
|
|
|
|
|
|
log.Println(res_data, err) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
var res_arr SiteInfoRes |
|
|
|
|
|
|
|
err = json.Unmarshal([]byte(res_data), &res_arr) |
|
|
@ -71,4 +76,3 @@ func GetSiteInfoByHost(host string, url ...string) (*SiteInfoRes, error) { |
|
|
|
} |
|
|
|
return &res_arr, nil |
|
|
|
} |
|
|
|
*/ |