查询商品规格库存

查询商品规格库存

请求URL:

POST https://kf.fw199.com/gateway/dd/freight/template/create

公共参数

参数名称 参数类型 是否必须 示例值 参数描述
appid String 合作伙伴AppId
timestamp String 1657525936 当前Unix时间戳,秒
seller_nick String 38173182 抖店的账号,对应蜂巢授权返回doudianseller字段
sign String

业务参数

参数名称 参数类型 是否必须 示例值 参数描述
+template Struct - 运费模板信息
- template_name String 测试运费模板 模板名称
- product_province Int64 32 发货省份id
- product_city Int64 320100 发货城市id
- calculate_type Int64 1 计价方式: 1.按重量 2.按数量;模板类型为1、2、3时,计价类型传2
- transfer_type Int64 1 快递方式: 1.快递 目前仅支持1
- rule_type Int64 0 模板类型: 0.阶梯计价 1.固定运费 2.卖家包邮 3.货到付款
- fixed_amount Int64 1 固定运费金额(单位:分) 固定运费模板必填 1-9900之间的整数
+columns List - 运费模板规则信息;每种类型模板可创建的规则类型: 阶梯计价模板-默认规则,普通计价规则,包邮规则,限运规则;固定运费模板-包邮规则,限运规则;固定运费模板-包邮规则,限运规则;包邮模板-限运规则;货到付款模板-限运规则
- first_weight Double 0.1 首重(单位:kg) 按重量计价必填 0.1-999.9之间的小数,小数点后一位
- first_weight_price Double 0.01 首重价格(单位:元) 按重量计价必填 0.00-100.00之间的小数,小数点后两位
- first_num Int64 1 首件数量(单位:个) 按数量计价必填 1-999的整数
- first_num_price Double 0.01 首件价格(单位:元)按数量计价必填 0.00-100.00之间的小数,小数点后两位
- add_weight Double 0.1 续重(单位:kg) 按重量计价必填 0.1-999.9之间的小数,小数点后一位
- add_weight_price Double 0.01 续重价格(单位:元) 按重量计价必填 0.00-100.00之间的小数,小数点后两位
- add_num Int64 1 续件(单位:个) 按数量计价必填 1-999的整数
- add_num_price Double 0.01 续件价格(单位:元) 按数量计价必填 0.00-100.00之间的小数,小数点后两位
- is_default Int64 1 是否默认计价方式(1:是;0:不是)
- is_limited Bool false 是否限运规则
- rule_address String {“11”:…} 当前规则生效的地址,非默认规则必填。map<i64, map<i64, map<i64, list>>>的json格式,省->市->区->街道,填至选择到的层级即可,仅限售规则支持四级街道
- is_over_free Bool false 是否包邮规则
- over_weight Double 0.1 满xx重量包邮(单位:kg)0.1-10.0之间的小数,小数点后一位
- over_amount Int64 10 满xx金额包邮(单位:分)10-99900的整数
- over_num Int64 1 满xx件包邮 1-10之间的整数
- min_sku_amount Int64 100 最小金额限制,单位分,不限制填-1
- max_sku_amount Int64 500 最大金额限制,单位分,不限制填-1
-+ province_infos List - 当前规则生效的地址,统一以List结构返回,该结构为嵌套结构。对应的json格式为[{“id”:”32”,”children”:[{“id”:”320500”,”children”:[{“id”:”320508”,”children”:[{“id”:”320508014”},{“id”:”320508004”}]}]}]}] 注意:返回的为最新的四级地址版本(地址存储升级变更的可能,以最新的返回)
- - id Int64 22 地址id,第一级是省份、第二级是城市、第三级是区、第四级是街道
- -+ children List - 下一级地址信息
— id Int64 2222 地址id,第一级是省份、第二级是城市、第三级是区、第四级是街道
—+ children List - 下一级地址信息
—- id Int64 22222 地址id,第一级是省份、第二级是城市、第三级是区、第四级是街道
—-+ children List - 下一级地址信息
—– id Int64 222222 地址id,第一级是省份、第二级是城市、第三级是区、第四级是街道

2. 请求示例代码(Java)

请求示例代码

    @Test
    public void  DDReightTemplateCreate() throws Exception {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put("appid",  Config.AppId);
        Long timestamp = System.currentTimeMillis() / 1000;
        data.put("timestamp", timestamp.toString());
        data.put("seller_nick", Config.DDSellerNick);

        data.put("template", "{\n" +
                "    \"template_name\": \"测试运费模板123\",\n" +
                "    \"product_province\": \"32\",\n" +
                "    \"product_city\": \"320100\",\n" +
                "    \"calculate_type\": \"2\",\n" +
                "    \"transfer_type\": \"1\",\n" +
                "    \"rule_type\": \"1\",\n" +
                "    \"fixed_amount\": \"1\"\n" +
                "  }");
//        data.put("columns", "[\n" +
//                "    {\n" +
//                "      \"first_weight\": \"0.1\",\n" +
//                "      \"first_weight_price\": \"0.01\",\n" +
//                "      \"first_num\": \"1\",\n" +
//                "      \"first_num_price\": \"0.01\",\n" +
//                "      \"add_weight\": \"0.1\",\n" +
//                "      \"add_weight_price\": \"0.01\",\n" +
//                "      \"add_num\": \"1\",\n" +
//                "      \"add_num_price\": \"0.01\",\n" +
//                "      \"is_default\": \"1\",\n" +
//                "      \"is_limited\": \"false\",\n" +
//                "      \"rule_address\": \"{\\\"11\\\":{\\\"110000\\\":{\\\"110114\\\":[110114116,110114007]}}}\",\n" +
//                "      \"is_over_free\": \"false\",\n" +
//                "      \"over_weight\": \"0.1\",\n" +
//                "      \"over_amount\": \"10\",\n" +
//                "      \"over_num\": \"1\",\n" +
//                "      \"min_sku_amount\": \"100\",\n" +
//                "      \"max_sku_amount\": \"500\",\n" +
//                "      \"province_infos\": [\n" +
//                "        {\n" +
//                "          \"id\": \"22\",\n" +
//                "          \"children\": [\n" +
//                "            {\n" +
//                "              \"id\": \"2222\",\n" +
//                "              \"children\": [\n" +
//                "                {\n" +
//                "                  \"id\": \"22222\",\n" +
//                "                  \"children\": [\n" +
//                "                    {\n" +
//                "                      \"id\": \"222222\"\n" +
//                "                    }\n" +
//                "                  ]\n" +
//                "                }\n" +
//                "              ]\n" +
//                "            }\n" +
//                "          ]\n" +
//                "        }\n" +
//                "      ]\n" +
//                "    }\n" +
//                "  ]");

        data.put("sign", Sign(data,Config.AppSecret));
        // 调用服务API
        String resp = doHttpRequest(Config.DDFreightTemplateCreate, data);
        System.out.println(resp);
    }

template 对象:


{
  "template_name": "测试运费模板123",
  "product_province": "32",
  "product_city": "320100",
  "calculate_type": "2",
  "transfer_type": "1",
  "rule_type": "1",
  "fixed_amount": "1"
}

columns 对象:


[
  {
    "first_weight": "0.1",
    "first_weight_price": "0.01",
    "first_num": "1",
    "first_num_price": "0.01",
    "add_weight": "0.1",
    "add_weight_price": "0.01",
    "add_num": "1",
    "add_num_price": "0.01",
    "is_default": "1",
    "is_limited": "false",
    "rule_address": {"11":{"110000":{"110114":[110114116,110114007]}}},
    "is_over_free": "false",
    "over_weight": "0.1",
    "over_amount": "10",
    "over_num": "1",
    "min_sku_amount": "100",
    "max_sku_amount": "500",
    "province_infos": [
      {
        "id": "22",
        "children": [
          {
            "id": "2222",
            "children": [
              {
                "id": "22222",
                "children": [
                  {
                    "id": "222222"
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
]

3. 返回结果如下:


{"code":0,"message":"ok","data":{"template_id":372559970}}

说明: code为0表示成功,非0为失败,message会包含失败原因。返回字段说明见文档
https://op.jinritemai.com/docs/api-docs/16/1661

文档更新时间: 2024-05-22 14:29   作者:JSL