🎨 #2226 【开放平台】第三方平台获取代码模板列表接口增加参数,可过滤标准模板

This commit is contained in:
hywr 2021-07-29 22:22:31 +08:00 committed by GitHub
parent 8511f8f826
commit 00347dc50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 24 deletions

View File

@ -15,6 +15,7 @@ import me.chanjar.weixin.open.bean.minishop.coupon.WxMinishopCouponStock;
import me.chanjar.weixin.open.bean.minishop.goods.*;
import me.chanjar.weixin.open.bean.minishop.limitdiscount.LimitDiscountGoods;
import me.chanjar.weixin.open.bean.result.*;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.List;
@ -169,7 +170,6 @@ public interface WxOpenComponentService {
String MINISHOP_GET_DELIVERY_COMPANY_URL = "https://api.weixin.qq.com/product/delivery/get_company_list";
/**
* Gets wx mp service by appid.
*
@ -456,11 +456,23 @@ public interface WxOpenComponentService {
*
* @return 小程序代码模版列表 templateId
* @throws WxErrorException 获取失败时返回具体错误码请看此接口的注释文档
* @see #getTemplateList(Integer)
*/
@Deprecated
List<WxOpenMaCodeTemplate> getTemplateList() throws WxErrorException;
/**
* 请参考并使用 {@link #addToTemplate(long,int)}.
* 获取代码模版库中的所有小程序代码模版.
* 文档:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/gettemplatelist.html
*
* @param templateType 模板类型,可空,默认全部,填0普通模,1标准模板
* @return 小程序代码模版列表 templateId
* @throws WxErrorException 获取失败时返回具体错误码请看此接口的注释文档
*/
List<WxOpenMaCodeTemplate> getTemplateList(@Nullable Integer templateType) throws WxErrorException;
/**
* 请参考并使用 {@link #addToTemplate(long, int)}.
* 将草稿箱的草稿选为小程序代码模版.
*
* @param draftId 草稿ID本字段可通过获取草稿箱内的所有临时代码草稿接口获得
@ -474,7 +486,7 @@ public interface WxOpenComponentService {
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/addtotemplate.html
* 将草稿添加到代码模板库.
*
* @param draftId 草稿ID本字段可通过获取草稿箱内的所有临时代码草稿接口获得
* @param draftId 草稿ID本字段可通过获取草稿箱内的所有临时代码草稿接口获得
* @param templateType 代码模版类型普通模板:0, 标准模板1
* @throws WxErrorException 操作失败时抛出具体错误码请看此接口的注释文档
* @see #getTemplateDraftList #getTemplateDraftList
@ -573,12 +585,12 @@ public interface WxOpenComponentService {
* https://api.weixin.qq.com/product/register/register_shop?component_access_token=xxxxxxxxx
* 注册小商店账号
*
* @param wxName 微信号必填
* @param idCardName 身份证姓名必填
* @param idCardNumber 身份证号必填
* @param channelId 渠道号服务商后台生成渠道信息选填
* @param apiOpenstoreType 1-整店打包开通小商店2-组件开放开通小程序并且已经完整的嵌入电商功能必填
* @param authPageUrl 授权url选填
* @param wxName 微信号必填
* @param idCardName 身份证姓名必填
* @param idCardNumber 身份证号必填
* @param channelId 渠道号服务商后台生成渠道信息选填
* @param apiOpenstoreType 1-整店打包开通小商店2-组件开放开通小程序并且已经完整的嵌入电商功能必填
* @param authPageUrl 授权url选填
* @return the wx open result
* @throws WxErrorException
*/
@ -588,7 +600,8 @@ public interface WxOpenComponentService {
/**
* https://api.weixin.qq.com/product/register/check_audit_status
* 异步状态查询
* @param wxName 微信号
*
* @param wxName 微信号
* @return
*/
String checkAuditStatus(String wxName) throws WxErrorException;
@ -596,15 +609,15 @@ public interface WxOpenComponentService {
/**
* 已经获取到小商店的appId那么需要通过accesstoken来获取该小商店的状态
*
* @param appId
* @param wxName
* @return
* @throws WxErrorException
*/
String checkAuditStatus(String appId, String wxName) throws WxErrorException;
String checkAuditStatus(String appId, String wxName) throws WxErrorException;
/**
*
* @param appId
* @param subjectType
* @param busiLicense
@ -617,7 +630,6 @@ public interface WxOpenComponentService {
WxOpenResult submitMerchantInfo(String appId, String subjectType, MinishopBusiLicense busiLicense, MinishopOrganizationCodeInfo organizationCodeInfo, MinishopIdcardInfo idcardInfo, MinishopSuperAdministratorInfo superAdministratorInfo, String merchantShoprtName) throws WxErrorException;
/**
*
* @param appId
* @param nameInfo
* @param returnInfo
@ -628,7 +640,6 @@ public interface WxOpenComponentService {
/**
*
* @param height
* @param width
* @param file
@ -640,6 +651,7 @@ public interface WxOpenComponentService {
/**
* 获取小商店的类目详情
*
* @param appId小商店APPID
* @param fCatId父类目ID可先填0获取根部类目
* @return 小商店类目信息列表
@ -649,6 +661,7 @@ public interface WxOpenComponentService {
/**
* 获取小商店品牌信息
*
* @param appId小商店appID
* @return
*/
@ -657,6 +670,7 @@ public interface WxOpenComponentService {
/**
* 获取小商店运费模版信息
*
* @param appId小商店appID
* @return
*/
@ -665,6 +679,7 @@ public interface WxOpenComponentService {
/**
* 获取小商店商品分类信息
*
* @param appId
* @return
*/
@ -673,6 +688,7 @@ public interface WxOpenComponentService {
/**
* 获取小商店的快递公司列表
*
* @param appId
* @return
* @throws WxErrorException
@ -681,18 +697,21 @@ public interface WxOpenComponentService {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//小商店优惠券接口
/**
* 创建小商店优惠券
*
* @param appId小商店的appId
* @param couponInfo 优惠券信息
* @param couponInfo 优惠券信息
* @return couponId: 优惠券ID
* @throws WxErrorException
*/
Integer minishopCreateCoupon(String appId, WxMinishopCoupon couponInfo) throws WxErrorException;
Integer minishopCreateCoupon(String appId, WxMinishopCoupon couponInfo) throws WxErrorException;
/**
* 与小商店对接获取小商店的优惠券信息
*
* @param appId小商店的appId
* @param startCreateTime优惠券创建时间的搜索开始时间
* @param endCreateTime优惠券创建时间的搜索结束时间
@ -707,16 +726,18 @@ public interface WxOpenComponentService {
/**
* 与小商店对接将优惠券发送给某人
*
* @param appid小商店appId
* @param openId优惠券接收人的openId
* @param couponId: 优惠券ID
* @param couponId: 优惠券ID
* @return
*/
WxOpenResult minishopPushCouponToUser(String appid, String openId, Integer couponId) throws WxErrorException;
WxOpenResult minishopPushCouponToUser(String appid, String openId, Integer couponId) throws WxErrorException;
/**
* 与小商店对接更新商城优惠券
*
* @param appId
* @param couponInfo
* @return
@ -727,13 +748,14 @@ public interface WxOpenComponentService {
/**
* 从优惠券创建后status=1可流转到2,4,5, COUPON_STATUS_VALID = 2 ;//生效 COUPON_STATUS_INVALID = 4 ;//已作废 COUPON_STATUS_DEL = 5;//删除
*
* @param appId
* @param couponId
* @param status
* @return
* @throws WxErrorException
*/
WxOpenResult minishopUpdateCouponStatus(String appId, Integer couponId, Integer status) throws WxErrorException;
WxOpenResult minishopUpdateCouponStatus(String appId, Integer couponId, Integer status) throws WxErrorException;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -747,8 +769,10 @@ public interface WxOpenComponentService {
String MINISHOP_LISTING_SPU_URL = "https://api.weixin.qq.com/product/spu/listing";
String MINISHOP_DELISTING_SPU_URL = "https://api.weixin.qq.com/product/spu/delisting";
/**
* 小商店添加商品接口添加商品后只是添加到草稿箱需要通过调用上架商品并通过审核才能在商城中显示
*
* @param appId
* @param spu
* @return
@ -759,17 +783,19 @@ public interface WxOpenComponentService {
/**
* 小商店删除商品接口直接删除不会存在小商店回收站里面
*
* @param appId
* @param productId
* @param outProductId
* @return
* @throws WxErrorException
*/
WxOpenResult minishopGoodsDelSpu(String appId, Long productId, Long outProductId) throws WxErrorException;
WxOpenResult minishopGoodsDelSpu(String appId, Long productId, Long outProductId) throws WxErrorException;
/**
* 小商店更新商品接口不会直接影响上架商品的信息而是存在草稿箱需要调用上架商品接口并通过审核才能在商城中显示
*
* @param appId
* @param spu
* @return
@ -780,6 +806,7 @@ public interface WxOpenComponentService {
/**
* 上架商品
*
* @param appId
* @param productId
* @param outProductId
@ -791,6 +818,7 @@ public interface WxOpenComponentService {
/**
* 下架商品
*
* @param appId
* @param productId
* @param outProductId
@ -816,6 +844,7 @@ public interface WxOpenComponentService {
/**
* 小商店新增sku信息
*
* @param appId
* @param sku
* @return
@ -826,6 +855,7 @@ public interface WxOpenComponentService {
/**
* 小商店批量新增sku信息
*
* @param appId
* @param skuList
* @return
@ -836,6 +866,7 @@ public interface WxOpenComponentService {
/**
* 小商店删除sku消息
*
* @param appId
* @param productId
* @param outProductId
@ -844,11 +875,12 @@ public interface WxOpenComponentService {
* @return
* @throws WxErrorException
*/
WxOpenResult minishopGoodsDelSku(String appId, Long productId, Long outProductId, String outSkuId, Long skuId) throws WxErrorException;
WxOpenResult minishopGoodsDelSku(String appId, Long productId, Long outProductId, String outSkuId, Long skuId) throws WxErrorException;
/**
* 小商店更新sku
*
* @param appId
* @param sku
* @return
@ -859,6 +891,7 @@ public interface WxOpenComponentService {
/**
* 小商店更新sku价格
*
* @param appId
* @param productId
* @param outProductId
@ -874,6 +907,7 @@ public interface WxOpenComponentService {
/**
* 小商店更新sku库存
*
* @param appId
* @param productId
* @param outProductId
@ -884,11 +918,12 @@ public interface WxOpenComponentService {
* @return
* @throws WxErrorException
*/
WxOpenResult minishopGoodsUpdateSkuStock(String appId, Long productId, Long outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException;
WxOpenResult minishopGoodsUpdateSkuStock(String appId, Long productId, Long outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException;
/**
* 小商店通用Post接口
*
* @param appId
* @param url
* @param requestParam
@ -898,7 +933,6 @@ public interface WxOpenComponentService {
String minishopCommonPost(String appId, String url, String requestParam) throws WxErrorException;
//////////////////////////////////////////////////////////////
//商品抢购任务-秒杀活动
String API_MINISHOP_ADD_LIMIT_DISCOUNT_URL = "https://api.weixin.qq.com/product/limiteddiscount/add/";
@ -910,6 +944,7 @@ public interface WxOpenComponentService {
/**
* 添加抢购任务
* 每个商品(SPU)同一时间只能有一个抢购任务 如果当前有抢购任务没有结束无论是否开始都不允许创建第二个抢购任务 可以提前修改抢购任务状态为结束后再创建新的任务 每次创建抢购任务时必须填充该SPU下 所有SKU的抢购信息
*
* @param appId
* @param limitDiscountGoods
* @return
@ -919,6 +954,7 @@ public interface WxOpenComponentService {
/**
* status为0代表 还未结束的抢购任务无论是否开始 status为1代表已经结束的 抢购任务 如果不填status则两种都拉取
*
* @param appId
* @param status
* @return
@ -929,6 +965,7 @@ public interface WxOpenComponentService {
/**
* 修改抢购任务状态
* 用于提前结束抢购任务无论抢购任务是否在执行中都可以关闭 也可以直接删除抢购任务 注意结束后不允许再开启状态不可逆
*
* @param appId
* @param taskId
* @param status

View File

@ -30,6 +30,7 @@ import me.chanjar.weixin.open.bean.minishop.limitdiscount.LimitDiscountSku;
import me.chanjar.weixin.open.bean.result.*;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.math.BigDecimal;
@ -493,7 +494,13 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
@Override
public List<WxOpenMaCodeTemplate> getTemplateList() throws WxErrorException {
String responseContent = get(GET_TEMPLATE_LIST_URL, "access_token");
return getTemplateList(null);
}
@Override
public List<WxOpenMaCodeTemplate> getTemplateList(@Nullable Integer templateType) throws WxErrorException {
String url = GET_TEMPLATE_LIST_URL + (templateType == null ? "" : "?template_type=" + templateType);
String responseContent = get(url, "access_token");
JsonObject response = GsonParser.parse(StringUtils.defaultString(responseContent, "{}"));
boolean hasTemplateList = response.has("template_list");
if (hasTemplateList) {

View File

@ -32,6 +32,13 @@ public class WxOpenMaCodeTemplate implements Serializable {
*/
@SerializedName(value = "userDesc", alternate = "user_desc")
private String userDesc;
/**
* 模板类型 0对应普通模板1对应标准模板
*/
@SerializedName(value = "templateType", alternate = "template_type")
private Integer template_type;
/**
* 开发者上传草稿时间 / 被添加为模版的时间
*/