package siterpc import ( "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 } if res_data_de == "" { return "", nil } return res_data_de, nil }