Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
import me.chanjar.weixin.channel.bean.audit.AuditResponse;
import me.chanjar.weixin.channel.bean.audit.CategoryAuditInfo;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.category.CategoryDetailResult;
import me.chanjar.weixin.channel.bean.category.CategoryQualificationResponse;
import me.chanjar.weixin.channel.bean.category.PassCategoryResponse;
import me.chanjar.weixin.channel.bean.category.ShopCategory;
import me.chanjar.weixin.channel.bean.category.ShopCategoryResponse;
import me.chanjar.weixin.channel.bean.category.*;
import me.chanjar.weixin.common.error.WxErrorException;

/**
Expand Down Expand Up @@ -121,4 +117,16 @@ AuditApplyResponse addCategory(String level1, String level2, String level3, List
* @throws WxErrorException 异常
*/
PassCategoryResponse listPassCategory() throws WxErrorException;

/**
* 获取店铺的类目权限列表
*
* @param isFilterStatus 是否按状态筛选
* @param status 类目状态(当 isFilterStatus 为 true 时有效)
* @return 类目权限列表
*
* @throws WxErrorException 异常
*/
RelationCategoryResponse listRelationCategory(Boolean isFilterStatus, Integer status) throws WxErrorException;

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package me.chanjar.weixin.channel.api.impl;

import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.ADD_CATEGORY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.AVAILABLE_CATEGORY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.CANCEL_CATEGORY_AUDIT_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.GET_CATEGORY_AUDIT_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.GET_CATEGORY_DETAIL_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.LIST_ALL_CATEGORY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.LIST_PASS_CATEGORY_URL;

import java.util.Collections;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -17,17 +9,15 @@
import me.chanjar.weixin.channel.bean.audit.CategoryAuditInfo;
import me.chanjar.weixin.channel.bean.audit.CategoryAuditRequest;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.category.CategoryDetailResult;
import me.chanjar.weixin.channel.bean.category.CategoryQualificationResponse;
import me.chanjar.weixin.channel.bean.category.PassCategoryResponse;
import me.chanjar.weixin.channel.bean.category.ShopCategory;
import me.chanjar.weixin.channel.bean.category.ShopCategoryResponse;
import me.chanjar.weixin.channel.bean.category.*;
import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.channel.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;

import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.*;

/**
* 视频号小店 商品类目相关接口
*
Expand Down Expand Up @@ -135,4 +125,15 @@ public PassCategoryResponse listPassCategory() throws WxErrorException {
return ResponseUtils.decode(resJson, PassCategoryResponse.class);
}

@Override
public RelationCategoryResponse listRelationCategory(Boolean isFilterStatus, Integer status) throws WxErrorException {
RelationCategoryRequest request = new RelationCategoryRequest(
isFilterStatus != null ? isFilterStatus : false,
status != null ? status : 0
);
String reqJson = JsonUtils.encode(request);
String resJson = shopService.post(LIST_RELATION_CATEGORY_URL, reqJson);
return ResponseUtils.decode(resJson, RelationCategoryResponse.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class CategoryDetailResult extends WxChannelBaseResponse {
@JsonProperty("attr")
private Attr attr;

@JsonProperty("product_qua_list")
private List<QualificationInfo> productQuaList;


@Data
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package me.chanjar.weixin.channel.bean.category;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* 店铺类目权限列表项
*
* @author <a href="https://gitee.com/cchengg">chucheng</a>
*/
@Data
@NoArgsConstructor
public class RelationCategoryItem implements Serializable {

/** 类目id */
@JsonProperty("id")
private Long id;

/** 类目状态, 1生效中,2已失效 */
@JsonProperty("status")
private Integer status;

/** 失效原因 */
@JsonProperty("uneffective_reason")
private String uneffectiveReason;

/** 生效时间 */
@JsonProperty("effective_time")
private Long effectiveTime;

/** 失效时间 */
@JsonProperty("uneffective_time")
private Long uneffectiveTime;

/** 类目资质id */
@JsonProperty("qua_id")
private Long quaId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package me.chanjar.weixin.channel.bean.category;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 类目权限列表请求参数
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RelationCategoryRequest implements Serializable {

private static final long serialVersionUID = -8765432109876543210L;

/** 是否按状态筛选 */
@JsonProperty("is_filter_status")
private Boolean isFilterStatus;

/** 类目状态(当 isFilterStatus 为 true 时有效) */
@JsonProperty("status")
private Integer status;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package me.chanjar.weixin.channel.bean.category;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;

/**
* 店铺的类目权限列表响应
*
* @author <a href="https://gitee.com/cchengg">chucheng</a>
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class RelationCategoryResponse extends WxChannelBaseResponse {

private static final long serialVersionUID = -8473920857463918245L;

@JsonProperty("list")
private List<RelationCategoryItem> list;

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public class SkuFastInfo implements Serializable {
@JsonProperty("is_delete")
private Boolean delete;

/** 商品sku编码 */
@JsonProperty("sku_code")
private String skuCode;

/** 更新sku状态 0-默认值;5-上架;11-下架 */
@JsonProperty("status")
private Integer status;


@Data
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public class SkuInfo implements Serializable {
@JsonProperty("sku_id")
private String skuId;

/** sku条形码 */
@JsonProperty("bar_code")
private String barCode;

public SkuInfo() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,28 @@ public class SpuFastInfo implements Serializable {
@JsonProperty("skus")
protected List<SkuFastInfo> skus;

/** 商品编码 */
@JsonProperty("spu_code")
protected String spuCode;

/** 限购信息 */
@JsonProperty("limit_info")
protected LimitInfo limitInfo;

/** 运费信息 */
@JsonProperty("express_info")
protected ExpressInfo expressInfo;

/** 额外服务 */
@JsonProperty("extra_service")
protected ExtraServiceInfo extraService;

/** 发货方式:0-快递发货;1-无需快递,手机号发货;3-无需快递,可选发货账号类型,默认为0,若为无需快递,则无需填写运费模版id */
@JsonProperty("deliver_method")
private Integer deliverMethod;

/** 商品待开售信息 */
@JsonProperty("timing_onsale_info")
private TimingOnSaleInfo timingOnSaleInfo;

}
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,8 @@ public class SpuInfo extends SpuSimpleInfo {
/** 发布模式,0: 普通模式;1: 极简模式 */
@JsonProperty("release_mode")
private Integer releaseMode;

/** 商品待开售信息 */
@JsonProperty("timing_onsale_info")
private TimingOnSaleInfo timingOnSaleInfo;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package me.chanjar.weixin.channel.bean.product;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* 商品待开售信息
*
* @author <a href="https://gitee.com/cchengg">chu</a>
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TimingOnSaleInfo implements Serializable {

/** 状态枚举 0-没有待开售;1-待开售 */
@JsonProperty("status")
private Integer status;

/** 开售时间,秒级时间戳,0为未配置时间 */
@JsonProperty("onsale_time")
private Long onSaleTime;

/** 是否隐藏价格 0-不隐藏;1-隐藏 */
@JsonProperty("is_hide_price")
private Integer isHidePrice;

/** 待开售任务ID,可用于请求立即开售 */
@JsonProperty("task_id")
private Integer taskId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public interface Category {
String CANCEL_CATEGORY_AUDIT_URL = "https://api.weixin.qq.com/channels/ec/category/audit/cancel";
/** 获取账号申请通过的类目和资质信息 */
String LIST_PASS_CATEGORY_URL = "https://api.weixin.qq.com/channels/ec/category/list/get";
/** 获取店铺的类目权限列表 */
String LIST_RELATION_CATEGORY_URL = "https://api.weixin.qq.com/shop/ec/category/get_category_relation_list";
}

/** 主页管理相关接口 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,14 @@ public void testListPassCategory() throws WxErrorException {
assertTrue(response.isSuccess());
System.out.println(response);
}

@Test
public void testListRelationCategory() throws WxErrorException {
WxChannelCategoryService categoryService = channelService.getCategoryService();
me.chanjar.weixin.channel.bean.category.RelationCategoryResponse response =
categoryService.listRelationCategory(true, 1);
assertNotNull(response);
assertTrue(response.isSuccess());
System.out.println(response);
}
}