🆕 #3764 【开放平台】添加小程序类目管理 - 获取类目名称信息的接口
This commit is contained in:
@@ -73,6 +73,10 @@ public interface WxOpenMaBasicService {
|
|||||||
* 8.6 修改类目
|
* 8.6 修改类目
|
||||||
*/
|
*/
|
||||||
String OPEN_MODIFY_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/modifycategory";
|
String OPEN_MODIFY_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/modifycategory";
|
||||||
|
/**
|
||||||
|
* 8.7 获取类目名称信息
|
||||||
|
*/
|
||||||
|
String OPEN_GET_ALL_CATEGORY_NAME = "https://api.weixin.qq.com/cgi-bin/wxopen/getallcategorynamelist";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单页path信息
|
* 获取订单页path信息
|
||||||
@@ -222,6 +226,18 @@ public interface WxOpenMaBasicService {
|
|||||||
*/
|
*/
|
||||||
WxOpenResult modifyCategory(WxFastMaCategory category) throws WxErrorException;
|
WxOpenResult modifyCategory(WxFastMaCategory category) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8.7 获取类目名称信息
|
||||||
|
* <pre>
|
||||||
|
* 获取所有类目名称信息,用于给用户展示选择
|
||||||
|
* https://developers.weixin.qq.com/doc/oplatform/openApi/miniprogram-management/category-management/api_getallcategoryname.html
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return 类目名称列表
|
||||||
|
* @throws WxErrorException .
|
||||||
|
*/
|
||||||
|
WxOpenMaCategoryNameListResult getAllCategoryName() throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单页Path信息
|
* 获取订单页Path信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -152,6 +152,12 @@ public class WxOpenFastMaServiceImpl extends WxMaServiceImpl implements WxOpenFa
|
|||||||
return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxOpenMaCategoryNameListResult getAllCategoryName() throws WxErrorException {
|
||||||
|
String response = get(OPEN_GET_ALL_CATEGORY_NAME, "");
|
||||||
|
return WxOpenGsonBuilder.create().fromJson(response, WxOpenMaCategoryNameListResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单页Path信息
|
* 获取订单页Path信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -146,6 +146,12 @@ public class WxOpenMaBasicServiceImpl implements WxOpenMaBasicService {
|
|||||||
return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxOpenMaCategoryNameListResult getAllCategoryName() throws WxErrorException {
|
||||||
|
String response = wxMaService.get(OPEN_GET_ALL_CATEGORY_NAME, "");
|
||||||
|
return WxOpenGsonBuilder.create().fromJson(response, WxOpenMaCategoryNameListResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单页Path信息
|
* 获取订单页Path信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package me.chanjar.weixin.open.bean.result;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取类目名称信息的返回结果.
|
||||||
|
* <p>
|
||||||
|
* 用于获取所有小程序类目的 ID 和名称信息,包括一级类目和二级类目。
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
|
* @see <a href="https://developers.weixin.qq.com/doc/oplatform/openApi/miniprogram-management/category-management/api_getallcategoryname.html">官方文档</a>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class WxOpenMaCategoryNameListResult extends WxOpenResult {
|
||||||
|
private static final long serialVersionUID = 8989721350285449879L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类目名称列表.
|
||||||
|
*/
|
||||||
|
@SerializedName("category_name_list")
|
||||||
|
private List<CategoryName> categoryNameList;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return WxOpenGsonBuilder.create().toJson(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类目名称信息.
|
||||||
|
* <p>
|
||||||
|
* 包含一级类目和二级类目的 ID 和名称。
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class CategoryName implements Serializable {
|
||||||
|
private static final long serialVersionUID = 8989721350285449880L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级类目ID.
|
||||||
|
*/
|
||||||
|
@SerializedName("first_id")
|
||||||
|
private Integer firstId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级类目名称.
|
||||||
|
*/
|
||||||
|
@SerializedName("first_name")
|
||||||
|
private String firstName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级类目ID.
|
||||||
|
*/
|
||||||
|
@SerializedName("second_id")
|
||||||
|
private Integer secondId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级类目名称.
|
||||||
|
*/
|
||||||
|
@SerializedName("second_name")
|
||||||
|
private String secondName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return WxOpenGsonBuilder.create().toJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user