sqlite的api,便于内部使用
liuxiaolong
2019-06-22 07868d0343bde1487d0ac03334322c55612a3303
syssetApi.go
@@ -1 +1,37 @@
package dbapi
import (
   "basic.com/pubsub/protomsg.git"
   "encoding/json"
)
type SysSetApi struct {
}
func (api SysSetApi) GetServerInfo() (flag bool,sysconf protomsg.LocalConfig){
   url := BASIC_URL + DATA_URL_PREFIX + "/sysset/getServerInfo"
   client := NewClient()
   body, err := client.DoGetRequest(url, nil, nil)
   if err != nil {
      return false, sysconf
   }
   var res Result
   if err = json.Unmarshal(body, &res); err != nil {
      return false, sysconf
   }
   b, err := json.Marshal(res.Data)
   if err !=nil {
      return false,sysconf
   } else {
      err = json.Unmarshal(b, &sysconf)
      if err !=nil {
         return false,sysconf
      } else {
         return true,sysconf
      }
   }
}