Browse Source

修改取siteinfo方法

master v0.6.6
guzeng 2 years ago
parent
commit
bcafeaa898
2 changed files with 13 additions and 2 deletions
  1. +10
    -1
      client.siteinfo.go
  2. +3
    -1
      client.siteinfo_test.go

+ 10
- 1
client.siteinfo.go View File

@ -6,6 +6,7 @@ import (
"strconv"
"time"
"git.tetele.net/tgo/conf"
"git.tetele.net/tgo/crypter"
"github.com/golang/protobuf/proto"
@ -30,6 +31,15 @@ type SiteInfoRes struct {
*/
func GetSiteInfoByHost(host string, params ...string) (*SiteInfoRes, error) {
var res_arr SiteInfoRes
if conf.IS_PRIVATE {
res_arr.Dbname = conf.DBNAME
res_arr.SiteId = conf.SITE_ID
res_arr.Domainname = conf.DOMAIN
return &res_arr, nil
}
var url string = ""
var master string = ""
if len(params) > 1 {
@ -75,7 +85,6 @@ func GetSiteInfoByHost(host string, params ...string) (*SiteInfoRes, error) {
if err != nil {
return nil, err
}
var res_arr SiteInfoRes
err = json.Unmarshal([]byte(res_data), &res_arr)


+ 3
- 1
client.siteinfo_test.go View File

@ -2,10 +2,12 @@ package siterpc
import (
"testing"
"git.tetele.net/tgo/conf"
)
func Test_GetSiteInfoByHost(t *testing.T) {
conf.IS_PRIVATE = true
res, err := GetSiteInfoByHost("dev.tetele.net")
t.Log(res)
t.Log(err)


Loading…
Cancel
Save