Browse Source

增多一个获取系统配置方法

master v0.2.0
guzeng 3 years ago
parent
commit
f4e9c3f370
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      client.go

+ 15
- 0
client.go View File

@ -23,6 +23,7 @@ type SiteConfigItemReqArg struct {
type SiteConfigItemRes struct {
Type string
Value string
Exist bool
}
/**
@ -32,6 +33,20 @@ type SiteConfigItemRes struct {
* GZ
*/
func GetConfigItem(site_id, dbname, key string, url ...string) (*SiteConfigItemRes, error) {
ret, err := getconfig(site_id, dbname, key, url...)
if err != nil {
return ret, err
}
if ret.Exist == false {
return ret, errors.New("no data")
}
return ret, err
}
func GetConfig(site_id, dbname, key string, url ...string) (*SiteConfigItemRes, error) {
return getconfig(site_id, dbname, key, url...)
}
func getconfig(site_id, dbname, key string, url ...string) (*SiteConfigItemRes, error) {
var site_rpc_url string = "127.0.0.1:7971"
if len(url) > 0 && url[0] != "" {


Loading…
Cancel
Save