package bhomedbapi
|
|
import (
|
jsoniter "github.com/json-iterator/go"
|
)
|
|
type LicenseApi struct {
|
}
|
|
func (api LicenseApi) GetRegisterCode(paramBody map[string]interface{}) (bool, interface{}) {
|
url := DATA_URL_PREFIX + "/license/getRegisterCode"
|
netNode := getNetNode(url2Topic(Topic_System_Service, url))
|
client := NewClient(WithNodes(netNode))
|
|
body, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
|
if err != nil {
|
return false, nil
|
}
|
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
var res Result
|
if err = json.Unmarshal(body, &res); err != nil {
|
return false, nil
|
}
|
|
return res.Success, res.Data
|
}
|
|
func (api LicenseApi) Save(paramBody map[string]interface{}) (bool, interface{}) {
|
url := DATA_URL_PREFIX + "/license/save"
|
netNode := getNetNode(url2Topic(Topic_System_Service, url))
|
client := NewClient(WithNodes(netNode))
|
body, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
|
if err != nil {
|
return false, nil
|
}
|
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
var res Result
|
if err = json.Unmarshal(body, &res); err != nil {
|
return false, nil
|
}
|
|
return res.Success, res.Data
|
}
|
|
func (api LicenseApi) Show() (int, bool, interface{}) {
|
url := DATA_URL_PREFIX + "/license/show"
|
netNode := getNetNode(url2Topic(Topic_System_Service, url))
|
client := NewClient(WithNodes(netNode))
|
body, err := client.DoGetRequest(url, nil, nil)
|
if err != nil {
|
return 500, false, nil
|
}
|
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
var res Result
|
if err = json.Unmarshal(body, &res); err != nil {
|
return 500, false, nil
|
}
|
return res.Code, res.Success, res.Data
|
}
|