PHP | <?php
require_once '../WdtClient.php';
$c = new WdtClient();
$c->sid = '';
$c->appkey = '';
$c->appsecret = '';
$c->gatewayUrl = 'http://sandbox.wangdian.cn/openapi2/stockin_refund_push.php';
$stockin_refund_info = array (
"refund_no" => "TK1608030001",
"outer_no" => "ghs",
"warehouse_no" => "xy001",
"logistics_code" => "yjwl04",
"detail_list" => array( array(
"spec_no" => "33412",
"stockin_num" => 2,
"batch_no" => "20160601",
"stockin_price" => "0.01"
)
)
);
$c->putApiParam('stockin_refund_info', json_encode($stockin_refund_info, JSON_UNESCAPED_UNICODE));
$json = $c->wdtOpenApi();
var_dump($json);
?> |
JAVA | package com.wangdian.api.refund;
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 StockinRefundPush {
@SuppressWarnings("unchecked")
public static void main(String[] args) {
// TODO Auto-generated method stub
WdtClient client = new WdtClient("", "", "", "");
Map<String, Object> stockin_refund_info = new HashMap<String, Object>();
List<Map<String, Object>> detail_list = new ArrayList<Map<String, Object>>();
Map<String, Object> detail_1 = new HashMap<String, Object>();
detail_1.put("spec_no", "ghs201812070212123");
detail_1.put("stockin_num", 2);
detail_1.put("stockin_price", 0.01);
detail_list.add(detail_1);
stockin_refund_info.put("refund_no", "TK1812110002");
stockin_refund_info.put("outer_no","gjs1121");
stockin_refund_info.put("warehouse_no", "ghs2test");
stockin_refund_info.put("logistics_code", "1213");
stockin_refund_info.put("is_created_batch", 1);
stockin_refund_info.put("detail_list", detail_list);
//通过第三方json解析工具类fastjson将map解析成json
String stockin_refund_info_json = JSON.toJSONString(stockin_refund_info);
//System.out.println(goods_list_json);
Map<String, String> params = new HashMap<String, String>();
params.put("stockin_refund_info", stockin_refund_info_json);
try {
String response = client.execute("stockin_refund_push.php", params);
System.out.println(response);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
C# | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WdtSdk;
namespace StockinRefundPush
{
class StockinRefundPush
{
static void Main(string[] args)
{
WdtClient client = new WdtClient();
client.sid = "";
client.appkey = "";
client.appsecret = "";
client.gatewayUrl = "http://sandbox.wangdian.cn/openapi2/stockin_refund_push.php";
var stockin_refund_info = new
{
refund_no = "TK1901090001",
outer_no = "234567898765432",
warehouse_no = "api_test",
logistics_code = "SMWL001",
logistics_no = "6787654321234",
detail_list = new[]
{
new{
spec_no = "6521478635",
stockin_num = "1",
stockin_price = "11.11",
}
}
};
string json = stockin_refund_info.ToJsonString();
client.putParams("stockin_refund_info", json);
string result = client.wdtOpenapi();
Console.WriteLine(result);
Console.ReadKey();
}
}
} |