PHP | <?php
require_once("../WdtClient.php");
$c = new WdtClient;
$c->sid = '';
$c->appkey = '';
$c->appsecret = '';
$c->gatewayUrl = 'http://sandbox.wangdian.cn/openapi2/purchase_apply_push.php';
$details_list = array (
array (
"spec_no" => "wzycolor",
"num" => 6,
"provider_no" => "zzd001",
"remark" => ""
),
array (
"spec_no" => "jiaozi",
"num" => 6,
"provider_no" => "zzd001",
"remark" => ""
),
array (
"spec_no" => "jiaozi",
"num" => 6,
"provider_no" => "",
"remark" => ""
),
array (
"spec_no" => "wzycolor",
"num" => 6,
"provider_no" => "zsy001",
"remark" => ""
)
);
$c->putApiParam('warehouse_no', 'POS-01');
$c->putApiParam('is_submit', '1');
$c->putApiParam('employee_no', 'syx');
$c->putApiParam('expected_time', '2020-06-22 12:54:00');
$c->putApiParam('remark', 'apitest');
$c->putApiParam('details_list', json_encode($details_list));
$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 PurchaseApplyPush {
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/
List<Map<String, Object>> details_list = new ArrayList<Map<String, Object>>();
Map<String, Object> detail_1 = new HashMap<String, Object>();
detail_1.put("spec_no", "qqq");
detail_1.put("num", "2");
detail_1.put("provider_no", 123123);
details_list.add(detail_1);
String details_list_json = JSON.toJSONString(details_list);
Map<String, String> params = new HashMap<String, String>();
params.put("warehouse_no", "");
params.put("details_list", details_list_json);
try {
String response = client.execute("purchase_apply_push.php", params);
System.out.println(response);
} catch (IOException e) {
e.printStackTrace();
}
}
} |
python
| import WdtClient
import json
t = WdtClient.WdtClient('appkey', 'appsecret', 'sid', 'http://sandbox.wangdian.cn/openapi2/')
details_list = []
details_1 = {}
details_1.update({"spec_no": 'spec_001'})
details_1.update({"num": '10'})
details_1.update({"price": '1'})
details_1.update({"discount": ''})
details_1.update({"detail_remark": '备注'})
details_list.append(details_1)
# del(return_info[0])
jsonArr = json.dumps(details_list, ensure_ascii=False)
params = {}
params.update({"warehouse_no": '123'})
params.update({"employee_no": ''})
params.update({"expected_time": ''})
params.update({"is_submit": '1'})
params.update({"remark": ''})
params.update({"details_list": jsonArr})
response = t.execute("purchase_apply_push.php", params)
print(response) |