xuhy
2026-02-05 337d48dbcb60bacb9bad2d4a0c3f2c34b132ef73
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.ruoyi.web.controller.yuncang.api.basic;
 
import com.alibaba.fastjson2.JSON;
import com.ruoyi.web.controller.yuncang.utils.WdtClient;
 
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
 
public class ApiGoodsSpecPush {
 
    @SuppressWarnings("unchecked")
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        WdtClient client = new WdtClient("apidevnew2", "hytycw02-test", "c7ae51196", "https://sandbox.wangdian.cn/openapi2/");
        //测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/
        //调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/
 
        Map<String, Object> api_goods_info = new HashMap<String,Object>();
        Map<String, Object>[] goods_list = new Map[1];
 
        goods_list[0] = new HashMap<String,Object>();
        goods_list[0].put("goods_id", "202602051455");
        goods_list[0].put("spec_id","20260205145501");
        goods_list[0].put("goods_no", "QTZL014A");
        goods_list[0].put("spec_no", "QTZL014A");
        goods_list[0].put("goods_name", "真露西柚13度360ml*20瓶箱装");
        goods_list[0].put("status", "1");
        goods_list[0].put("stock_num", "99");
        goods_list[0].put("price", "1");
 
        api_goods_info.put("platform_id", "127");
        api_goods_info.put("shop_no", "hytycw02-test");
        api_goods_info.put("goods_list", goods_list);
         
        //通过第三方json解析工具类fastjson将map解析成json
        String api_goods_info_json = JSON.toJSONString(api_goods_info);
        //System.out.println(goods_list_json);
         
        Map<String, String> params = new HashMap<String, String>(); 
 
        params.put("api_goods_info", api_goods_info_json);
        try {
            String response = client.execute("api_goodsspec_push.php", params);
            System.out.println(response);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
 
}