8000 【视频号】更新视频号小店/微信小店类目、订单、商品、主页管理相关接口,补充starter文档 by lixize · Pull Request #3426 · binarywang/WxJava · GitHub
[go: up one dir, main page]

Skip to content

【视频号】更新视频号小店/微信小店类目、订单、商品、主页管理相关接口,补充starter文档 #3426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
🎨 【视频号】更新类目API相关接口,支持新旧类目树
  • Loading branch information
lixize committed Nov 29, 2024
commit 847ef04cbc57e72eaf3da1f74ffd860b0edba9fc
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
import java.util.List;
import me.chanjar.weixin.channel.bean.audit.AuditApplyResponse;
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.common.error.WxErrorException;

/**
* 视频号小店 商品类目相关接口
*
* @author <a href="https://github.com/lixize">Zeyes</a>
* @see <a href="https://developers.weixin.qq.com/doc/store/API/category/new_old_diff.html">新旧类目树差异</a>
*/
public interface WxChannelCategoryService {

Expand All @@ -30,12 +33,27 @@ public interface WxChannelCategoryService {
/**
* 获取商品类目列表(全量) 有频率限制
*
* @param parentId 类目父id
* @param fCatId 类目父id
* @return 类目列表
*
* @throws WxErrorException 异常
* @deprecated 接口返回更新,请使用 {@link #listAvailableCategories(String)}
*/
List<ShopCategory> listAvailableCategory(String parentId) throws WxErrorException;
@Deprecated
List<ShopCategory> listAvailableCategory(String fCatId) throws WxErrorException;

/**
* 获取可用的子类目详情
*
* 1.f_cat_id 为旧类目树中的非叶子类目,仅设置 cat_list 字段。
* 2.f_cat_id 为新类目树中的非叶子类目,仅设置 cat_list_v2 字段。
* 3.f_cat_id 为0,同时设置 cat_list 和 cat_list_v2 字段
*
* @param fCatId 父类目ID,可先填0获取根部类目
* @return 类目列表
* @throws WxErrorException 异常
*/
ShopCategoryResponse listAvailableCategories(String fCatId) throws WxErrorException;

/**
* 获取类目信息
Expand All @@ -58,10 +76,23 @@ public interface WxChannelCategoryService {
*
* @throws WxErrorException 异常
* @see WxChannelBasicService#uploadQualificationFile(File)
* @deprecated 请使用 {@link #addCategory(CategoryAuditInfo)}
*/
@Deprecated
AuditApplyResponse addCategory(String level1, String level2, String level3, List<String> certificate)
throws WxErrorException;

/**
* 上传类目资质
*
* @param info 类目资质信息
* @return 审核id
*
* @throws WxErrorException 异常
* @see WxChannelBasicService#uploadQualificationFile(File)
*/
AuditApplyResponse addCategory(CategoryAuditInfo info) throws WxErrorException;

/**
* 取消类目提审
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ public List<ShopCategory> listAvailableCategory(String parentId) throws WxErrorE
return response.getCategories();
}

@Override
public ShopCategoryResponse listAvailableCategories(String fCatId) throws WxErrorException {
String reqJson = "{\"f_cat_id\": " + fCatId + "}";
String resJson = (String) shopService.executeWithoutLog(SimplePostRequestExecutor.create(shopService),
AVAILABLE_CATEGORY_URL, reqJson);
return ResponseUtils.decode(resJson, ShopCategoryResponse.class);
}

@Override
public CategoryDetailResult getCategoryDetail(String id) throws WxErrorException {
Long catId = null;
Expand All @@ -89,7 +97,11 @@ public AuditApplyResponse addCategory(String level1, String level2, String level
Long l1 = Long.parseLong(level1);
Long l2 = Long.parseLong(level2);
Long l3 = Long.parseLong(level3);
CategoryAuditInfo categoryInfo = new CategoryAuditInfo(l1, l2, l3, certificate);
CategoryAuditInfo categoryInfo = new CategoryAuditInfo();
categoryInfo.setLevel1(l1);
categoryInfo.setLevel2(l2);
categoryInfo.setLevel3(l3);
categoryInfo.setCertificates(certificate);
reqJson = JsonUtils.encode(new CategoryAuditRequest(categoryInfo));
} catch (Throwable e) {
log.error("微信请求异常", e);
Expand All @@ -98,6 +110,13 @@ public AuditApplyResponse addCategory(String level1, String level2, String level
return ResponseUtils.decode(resJson, AuditApplyResponse.class);
}

@Override
public AuditApplyResponse addCategory(CategoryAuditInfo info) throws WxErrorException {
String reqJson = JsonUtils.encode(new CategoryAuditRequest(info));
String resJson = shopService.post(ADD_CATEGORY_URL, reqJson);
return ResponseUtils.decode(resJson, AuditApplyResponse.class);
}

@Override
public WxChannelBaseResponse cancelCategoryAudit(String auditId) throws WxErrorException {
String resJson = shopService.post(CANCEL_CATEGORY_AUDIT_URL, "{\"audit_id\": \"" + auditId + "\"}");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.chanjar.weixin.channel.bean.audit;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;
Expand All @@ -15,6 +16,7 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CategoryAuditInfo implements Serializable {

private static final long serialVersionUID = -8792967130645424788L;
Expand All @@ -31,7 +33,47 @@ public class CategoryAuditInfo implements Serializable {
@JsonProperty("level3")
private Long level3;

/** 资质材料,图片url,图片类型,最多不超过10张 */
/** 新类目树类目ID */
@JsonProperty("cats_v2")
private List<CatsV2> catsV2;

/** 资质材料,图片fileid,图片类型,最多不超过10张 */
@JsonProp 6293 erty("certificate")
private List<String> certificates;

/** 报备函,图片fileid,图片类型,最多不超过10张 */
@JsonProperty("baobeihan")
private List<String> baobeihan;

/** 经营证明,图片fileid,图片类型,最多不超过10张 */
@JsonProperty("jingyingzhengming")
private List<String> jingyingzhengming;

/** 带货口碑,图片fileid,图片类型,最多不超过10张 */
@JsonProperty("daihuokoubei")
private List<String> daihuokoubei;

/** 入住资质,图片fileid,图片类型,最多不超过10张 */
@JsonProperty("ruzhuzhizhi")
private List<String> ruzhuzhizhi;

/** 经营流水,图片fileid,图片类型,最多不超过10张 */
@JsonProperty("jingyingliushui")
private List<String> jingyingliushui;

/** 补充材料,图片fileid,图片类型,最多不超过10张 */
@JsonProperty("buchongcailiao")
private List<String> buchongcailiao;

/** 经营平台,仅支持taobao,jd,douyin,kuaishou,pdd,other这些取值 */
@JsonProperty("jingyingpingtai")
private String jingyingpingtai;

/** 账号名称 */
@JsonProperty("zhanghaomingcheng")
private String zhanghaomingcheng;

/** 品牌列表,获取类目信息中的attr.is_limit_brand为true时必传 */
@JsonProperty("brand_list")
private List<CategoryBrand> brandList;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package me.chanjar.weixin.channel.bean.audit;

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 CategoryBrand implements Serializable {
private static final long serialVersionUID = -5437441266080209907L;

/** 品牌ID,是店铺申请且已审核通过的品牌ID */
@JsonProperty("brand_id")
private String brand_id;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package me.chanjar.weixin.channel.bean.audit;

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

/**
* 新类目树类目ID
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CatsV2 implements Serializable {
private static final long serialVersionUID = -2484092110142035589L;

/** 新类目树类目ID */
@JsonProperty("cat_id")
private String catId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,34 @@ public static class Attr implements Serializable {
/** 佣金信息 */
@JsonProperty("transactionfee_info")
private FeeInfo feeInfo;

/** 折扣规则 */
@JsonProperty("coupon_rule")
private CouponRule couponRule;

/** 价格下限,单位分,商品售价不可低于此价格 */
@JsonProperty("floor_price")
private Long floorPrice;

/** 收货时间选项 */
@JsonProperty("confirm_receipt_days")
private List<String> confirmReceiptDays;

/** 是否品牌定向准入,即该类目一定要有品牌 */
@JsonProperty("is_limit_brand")
private Boolean limitBrand;

/** 商品编辑要求 */
@JsonProperty("product_requirement")
private ProductRequirement productRequirement;

/** 尺码表 */
@JsonProperty("size_chart")
private SizeChart sizeChart;

/** 资质信息 */
@JsonProperty("product_qua_list")
private List<QualificationInfo> productQuaList;
}

@Data
Expand All @@ -93,19 +121,41 @@ public static class ProductAttr implements Serializable {
@JsonProperty("name")
private String name;

/** 类目必填项类型,string为自定义,select_one为多选一 */
/** 属性类型,string为自定义,select_one为多选一,该参数短期保留,用于兼容。将来废弃,使用type_v2替代 */
@JsonProperty("type")
private String type;

/** 类目必填项值 */
/**
* 属性类型v2,共7种类型
* string:文本
* select_one:单选,选项列表在value中
* select_many:多选,选项列表在value中
* integer:整数,数字必须为整数
* decimal4:小数(4 位精度),小数部分最多 4 位
* integer_unit:整数 + 单位,单位的选项列表在value中
* decimal4_unit:小数(4 位精度) + 单位,单位的选项列表在value中
*/
@JsonProperty("type_v2")
private String typeV2;

/**
* 可选项列表,当type为:select_one/select_many时,为选项列表
* 当type为:integer_unit/decimal4_unit时,为单位的列表
*/
@JsonProperty("value")
private String value;

/** 是否类目必填项 */
@JsonProperty("is_required")
private Boolean required;

/** 输入提示,请填写提示语 */
@JsonProperty("hint")
private String hint;

/** 允许添加选项,当type为select_one/select_many时,标识是否允许添加新选项(value中不存在的选项) */
@JsonProperty("append_allowed")
private Boolean appendAllowed;
}

@Data
Expand All @@ -123,8 +173,78 @@ public static class FeeInfo implements Serializable {
/** 佣金激励类型,0:无激励措施,1:新店佣金减免 */
@JsonProperty("incentive_type")
private Integer incentiveType;
}

@Data
@NoArgsConstructor
public static class CouponRule implements Serializable {

/** 最高的折扣比例,百分比, 0表示无限制 */
@JsonProperty("discount_ratio_limit")
private Integer supportCoupon;

/** 最高的折扣金额,单位分,0表示无限制 */
@JsonProperty("discount_limit")
private Integer couponType;
}

@Data
@NoArgsConstructor
public static class ProductRequirement implements Serializable {
/** 商品标题的编辑要求 */
@JsonProperty("product_title_requirement")
private String productTitleRequirement;

/** 商品主图的编辑要求 */
@JsonProperty("product_img_requirement")
private String productImgRequirement;

/** 商品描述的编辑要求 */
@JsonProperty("product_desc_requirement")
private String productDescRequirement;
}

@Data
@NoArgsConstructor
public static class SizeChart implements Serializable {

/** 是否支持尺码表 */
@JsonProperty("is_support")
private Boolean support;

/** 尺码配置要求列表 */
@JsonProperty("item_list")
private List<SizeChartItem> itemList;
}

@Data
@NoArgsConstructor
public static class SizeChartItem implements Serializable {
/** 尺码属性名称 */
@JsonProperty("name")
private String name;

/** 尺码属性值的单位 */
@JsonProperty("unit")
private String unit;

/** 尺码属性值的类型,1:字符型,2:整数型,3:小数型 */
@JsonProperty("type")
private String type;

/** 尺码属性值的填写格式,1:单值填写,2:区间值填写,3:支持单值或区间值 */
@JsonProperty("format")
private String format;

/** 尺码属性值的限制 */
@JsonProperty("limit")
private String limit;

/** 是否必填 */
@JsonProperty("is_required")
private Boolean required;
}

}


Expand Down
Loading
0