|
|
@ -61,3 +61,176 @@ func CreateOrder(dbname, siteid, order_sn string, url ...string) (bool, error) { |
|
|
|
|
|
|
|
return return_res, nil |
|
|
|
} |
|
|
|
|
|
|
|
// 确认收货
|
|
|
|
func ConfirmReceive(dbname, siteid, supplier_order_sn string, url ...string) (bool, error) { |
|
|
|
|
|
|
|
if dbname == "" || siteid == "" || supplier_order_sn == "" { |
|
|
|
return false, errors.New("参数错误") |
|
|
|
} |
|
|
|
|
|
|
|
conn, err := rpc_server_conn(url...) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
data := map[string]string{} |
|
|
|
data["database"] = dbname |
|
|
|
data["site_id"] = siteid |
|
|
|
data["supplier_order_sn"] = supplier_order_sn |
|
|
|
|
|
|
|
req, err := SetReqData(data) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
log.Println("confirmReceive crypter error:", err) |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
res := &Response{} |
|
|
|
|
|
|
|
err = conn.ConfirmReceive(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
log.Println("yytrpc confirmReceive error:", err) |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
res_data_de, err := GetResData(res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
if res_data_de == "" { |
|
|
|
return false, nil |
|
|
|
} |
|
|
|
|
|
|
|
var return_res bool |
|
|
|
err = json.Unmarshal([]byte(res_data_de), &return_res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
return return_res, nil |
|
|
|
} |
|
|
|
|
|
|
|
// 申请售后
|
|
|
|
func ApplyRefund(dbname, siteid, supplier_order_sn, refund_type, refund_reason string, url ...string) (bool, error) { |
|
|
|
|
|
|
|
if dbname == "" || siteid == "" || supplier_order_sn == "" || refund_type == "" || refund_reason == "" { |
|
|
|
return false, errors.New("参数错误") |
|
|
|
} |
|
|
|
|
|
|
|
conn, err := rpc_server_conn(url...) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
data := map[string]string{} |
|
|
|
|
|
|
|
data["database"] = dbname |
|
|
|
data["site_id"] = siteid |
|
|
|
data["supplier_order_sn"] = supplier_order_sn |
|
|
|
data["refund_type"] = refund_type |
|
|
|
data["refund_reason"] = refund_reason |
|
|
|
|
|
|
|
req, err := SetReqData(data) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
log.Println("ApplyRefund crypter error:", err) |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
res := &Response{} |
|
|
|
|
|
|
|
err = conn.ApplyRefund(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
log.Println("yytrpc ApplyRefund error:", err) |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
res_data_de, err := GetResData(res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
if res_data_de == "" { |
|
|
|
return false, nil |
|
|
|
} |
|
|
|
|
|
|
|
var return_res bool |
|
|
|
err = json.Unmarshal([]byte(res_data_de), &return_res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
return return_res, nil |
|
|
|
} |
|
|
|
|
|
|
|
// 撤销售后
|
|
|
|
func CancelRefund(dbname, siteid, supplier_refund_sn, supplier_buyer_id string, url ...string) (bool, error) { |
|
|
|
|
|
|
|
if dbname == "" || siteid == "" || supplier_refund_sn == "" || supplier_buyer_id == "" { |
|
|
|
return false, errors.New("参数错误") |
|
|
|
} |
|
|
|
|
|
|
|
conn, err := rpc_server_conn(url...) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
data := map[string]string{} |
|
|
|
|
|
|
|
data["database"] = dbname |
|
|
|
data["site_id"] = siteid |
|
|
|
data["supplier_refund_sn"] = supplier_refund_sn |
|
|
|
data["supplier_buyer_id"] = supplier_buyer_id |
|
|
|
|
|
|
|
req, err := SetReqData(data) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
log.Println("CancelRefund crypter error:", err) |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
res := &Response{} |
|
|
|
|
|
|
|
err = conn.CancelRefund(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
log.Println("yytrpc CancelRefund error:", err) |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
res_data_de, err := GetResData(res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
if res_data_de == "" { |
|
|
|
return false, nil |
|
|
|
} |
|
|
|
|
|
|
|
var return_res bool |
|
|
|
err = json.Unmarshal([]byte(res_data_de), &return_res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
|
|
|
|
return return_res, nil |
|
|
|
} |