2.0订单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.

55 lines
847 B

package orderrpcv2
import (
"encoding/json"
"errors"
)
func Cancel(site_id, dbname string, order_id string, url ...string) (*OrderCancelRes, error) {
if dbname == "" || order_id == "" {
return nil, errors.New("参数错误")
}
conn, err := rpc_server_conn(url...)
if err != nil {
return nil, err
}
defer conn.Close()
data := make(map[string]string)
data["dbname"] = dbname
data["site_id"] = site_id
req, err := SetReqData(data)
if err != nil {
return nil, err
}
res := &Response{}
err = conn.Cancel(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 OrderCancelRes
err = json.Unmarshal([]byte(res_data_de), &res_arr)
if err != nil {
return nil, err
}
return &res_arr, nil
}