站点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.

57 lines
825 B

package siterpc
import (
"encoding/json"
"errors"
)
/**
* 获取code_bank一条可用记录
* 2021/09/09
* linsen
*/
func GetOneCode(site_id, dbname string, url ...string) (string, error) {
if dbname == "" {
return "", errors.New("参数错误")
}
conn, err := rpc_server_conn(url...)
if err != nil {
return "", err
}
defer conn.Close()
arg := SiteConfigItemReqArg{site_id, dbname, ""}
req, err := SetReqData(arg)
if err != nil {
return "", err
}
res := &Response{}
err = conn.GetOneCode(req, res)
if err != nil {
return "", err
}
res_data_de, err := GetResData(res)
if err != nil {
return "", err
}
var bankCode string
err = json.Unmarshal([]byte(res_data_de),&bankCode)
if err != nil {
return "", err
}
if res_data_de == "" {
return "", nil
}
return bankCode, nil
}