供应商rpc结构及公共方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
764 B

package supplierrpc
import (
"encoding/json"
"errors"
)
func IsOpen(site_id, dbname, id string, url ...string) (*BoolRet, error) {
if dbname == "" || id == "" {
return nil, errors.New("参数错误")
}
conn, err := rpc_server_conn(url...)
if err != nil {
return nil, err
}
defer conn.Close()
arg := GetParam{site_id, dbname, id}
req, err := SetReqData(arg)
if err != nil {
return nil, err
}
res := &Response{}
err = conn.IsOpen(req, res)
if err != nil {
return nil, err
}
res_data_de, err := GetResData(res)
if err != nil {
return nil, err
}
if res_data_de == "" {
return nil, nil
}
var res_arr BoolRet
err = json.Unmarshal([]byte(res_data_de), &res_arr)
if err != nil {
return nil, err
}
return &res_arr, nil
}