PHP | <?php
require_once("../WdtClient.php");
$c = new WdtClient;
$c->sid = '';
$c->appkey = '';
$c->appsecret = '';
$c->gatewayUrl = 'http://sandbox.wangdian.cn/openapi2/purchase_return_order_push.php';
$purchase_return_info = array (
"return_no" => "CR201610110002",
"outer_no" => "ghsf23",
"post_cost" => "0.01",
"logistics_code" => "TT",
"logistics_no" => "212123434354",
"detail_list" => array (
array (
"spec_no" => "kangxiwen1",
"num" => 2,
"position_no" => "A121",
"price" => "0.01",
)
)
);
$c->putApiParam('purchase_return_info',json_encode($purchase_return_info,JSON_UNESCAPED_UNICODE));
$json = $c->wdtOpenApi();
var_dump($json);
?> |
JAVA | package com.wangdian.api.purchase;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.wangdian.api.WdtClient;
public class PurchaseReturnOrderPush {
public static void main(String[] args) {
// TODO Auto-generated method stub
WdtClient client = new WdtClient("传入sid", "传入appkey", "传入appsecret", "传入url");
//测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/
//调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/
Map<String, Object> purchase_return_info = new HashMap<String, Object>();
List<Map<String, Object>> details_list = new ArrayList<Map<String, Object>>();
Map<String, Object> details_1 = new HashMap<String, Object>();
details_1.put("spec_no", "kangxiwen1");
details_1.put("num", 2);
details_1.put("position_no", "A121");
details_1.put("price", 9.9);
details_list.add(details_1);
purchase_return_info.put("return_no", "CR201610110002");
purchase_return_info.put("outer_no", "ghs123");
purchase_return_info.put("logistics_code", "TTTT");
purchase_return_info.put("detail_list", details_list);
String purchase_return_info_json = JSON.toJSONString(purchase_return_info);
Map<String, String> params = new HashMap<String, String>();
params.put("purchase_return_info", purchase_return_info_json);
try {
String response = client.execute("purchase_return_order_push.php", params);
System.out.println(response);
} catch (IOException e) {
e.printStackTrace();
}
}
} |
C# | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WdtSdk;
namespace PurchaseReturnOrderPush
{
class PurchaseReturnOrderPush
{
static void Main(string[] args)
{
WdtClient client = new WdtClient();
client.sid = "";
client.appkey = "";
client.appsecret = "";
client.gatewayUrl = "http://sandbox.wangdian.cn/openapi2/purchase_return_order_push.php";
var purchase_return_info = new
{
return_no = "CR201901160001",
outer_no = "456789876543",
warehouse_no = "api_test",
logistics_code = "219",
logistics_no = "3456789876543",
post_cost = "0.01",
detail_list = new[]
{
new
{
spec_no ="1001017308AYS2S",
num = "1"
},
new
{
spec_no ="sku002",
num = "1"
}
}
};
string json = purchase_return_info.ToJsonString();
client.putParams("purchase_return_info", json);
string result = client.wdtOpenapi();
Console.WriteLine(result);
Console.ReadKey();
}
}
} |
python | import WdtClient
import json
t = WdtClient.WdtClient('appkey', 'appsecret', 'sid', 'http://sandbox.wangdian.cn/openapi2/')
purchase_return_info = {}
detail_list = []
details_1 = {}
details_1.update({"spec_no": 'spec_001'})
details_1.update({"num": '10'})
details_1.update({"price": '1'})
details_1.update({"position_no": ''})
details_1.update({"batch_no": ''})
details_1.update({"remark": ''})
details_1.update({"is_enable_sn": '0'})
details_1.update({"sn_list": ''})
detail_list.append(details_1)
purchase_return_info.update({"return_no": '001'})
purchase_return_info.update({"outer_no": 'test001'})
purchase_return_info.update({"logistics_code": ''})
purchase_return_info.update({"logistics_no": '0'})
purchase_return_info.update({"post_cost": '0'})
purchase_return_info.update({"remark": ''})
purchase_return_info.update({"is_check": ''})
purchase_return_info.update({"detail_list": detail_list})
# del(purchase_return_info[0])
jsonArr = json.dumps(purchase_return_info, ensure_ascii=False)
params = {}
params.update({"purchase_return_info": jsonArr})
response = t.execute("purchase_return_order_push.php", params)
print(response) |