8000 :art: #2226 【开放平台】第三方平台获取代码模板列表接口增加参数,可过滤标准模板 · binarywang/WxJava@00347dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 00347dc

Browse files
authored
🎨 #2226 【开放平台】第三方平台获取代码模板列表接口增加参数,可过滤标准模板
1 parent 8511f8f commit 00347dc

File tree

3 files changed

+75
-24
lines changed

3 files changed

+75
-24
lines changed

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import me.chanjar.weixin.open.bean.minishop.goods.*;
1616
import me.chanjar.weixin.open.bean.minishop.limitdiscount.LimitDiscountGoods;
1717
import me.chanjar.weixin.open.bean.result.*;
18+
import org.jetbrains.annotations.Nullable;
1819

1920
import java.io.File;
2021
import java.util.List;
@@ -169,7 +170,6 @@ public interface WxOpenComponentService {
169170
String MINISHOP_GET_DELIVERY_COMPANY_URL = "https://api.weixin.qq.com/product/delivery/get_company_list";
170171

171172

172-
173173
/**
174174
* Gets wx mp service by appid.
175175
*
@@ -456,11 +456,23 @@ public interface WxOpenComponentService {
456456
*
457457
* @return 小程序代码模版列表 (templateId)
458458
* @throws WxErrorException 获取失败时返回,具体错误码请看此接口的注释文档
459+
* @see #getTemplateList(Integer)
459460
*/
461+
@Deprecated
460462
List<WxOpenMaCodeTemplate> getTemplateList() throws WxErrorException;
461463

462464
/**
463-
* 请参考并使用 {@link #addToTemplate(long,int)}.
< EDBE /code>
465+
* 获取代码模版库中的所有小程序代码模版.
466+
* 文档:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/gettemplatelist.html
467+
*
468+
* @param templateType 模板类型,可空,默认全部,填0普通模,1标准模板
469+
* @return 小程序代码模版列表 (templateId)
470+
* @throws WxErrorException 获取失败时返回,具体错误码请看此接口的注释文档
471+
*/
472+
List<WxOpenMaCodeTemplate> getTemplateList(@Nullable Integer templateType) throws WxErrorException;
473+
474+
/**
475+
* 请参考并使用 {@link #addToTemplate(long, int)}.
464476
* 将草稿箱的草稿选为小程序代码模版.
465477
*
466478
* @param draftId 草稿ID,本字段可通过“获取草稿箱内的所有临时代码草稿”接口获得
@@ -474,7 +486,7 @@ public interface WxOpenComponentService {
474486
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/addtotemplate.html
475487
* 将草稿添加到代码模板库.
476488
*
477-
* @param draftId 草稿ID,本字段可通过“获取草稿箱内的所有临时代码草稿”接口获得
489+
* @param draftId 草稿ID,本字段可通过“获取草稿箱内的所有临时代码草稿”接口获得
478490
* @param templateType 代码模版类型,【普通模板:0, 标准模板:1】
479491
* @throws WxErrorException 操作失败时抛出,具体错误码请看此接口的注释文档
480492
* @see #getTemplateDraftList #getTemplateDraftList
@@ -573,12 +585,12 @@ public interface WxOpenComponentService {
573585
* https://api.weixin.qq.com/product/register/register_shop?component_access_token=xxxxxxxxx
574586
* 注册小商店账号
575587
*
576-
* @param wxName 微信号(必填)
577-
* @param idCardName 身份证姓名(必填)
578-
* @param idCardNumber 身份证号(必填)
579-
* @param channelId 渠道号,服务商后台生成渠道信息。(选填)
580-
* @param apiOpenstoreType 1-整店打包(开通小商店),2-组件开放(开通小程序,并且已经完整的嵌入电商功能)(必填)
581-
* @param authPageUrl 授权url(选填)
588+
* @param wxName 微信号(必填)
589+
* @param idCardName 身份证姓名(必填)
590+
* @param idCardNumber 身份证号(必填)
591+
* @param channelId 渠道号,服务商后台生成渠道信息。(选填)
592+
* @param apiOpenstoreType 1-整店打包(开通小商店),2-组件开放(开通小程序,并且已经完整的嵌入电商功能)(必填)
593+
* @param authPageUrl 授权url(选填)
582594
* @return the wx open result
583595
* @throws WxErrorException
584596
*/
@@ -588,23 +600,24 @@ public interface WxOpenComponentService {
588600
/**
589601
* https://api.weixin.qq.com/product/register/check_audit_status
590602
* 异步状态查询
591-
* @param wxName 微信号
603+
*
604+
* @param wxName 微信号
592605
* @return
593606
*/
594607
String checkAuditStatus(String wxName) throws WxErrorException;
595608

596609

597610
/**
598611
* 已经获取到小商店的appId,那么需要通过accesstoken来获取该小商店的状态
612+
*
599613
* @param appId
600614
* @param wxName
601615
* @return
602616
* @throws WxErrorException
603617
*/
604-
String checkAuditStatus(String appId, String wxName) throws WxErrorException;
618+
String checkAuditStatus(String appId, String wxName) throws WxErrorException;
605619

606620
/**
607-
*
608621
* @param appId
609622
* @param subjectType
610623
* @param busiLicense
@@ -617,7 +630,6 @@ public interface WxOpenComponentService {
617630
WxOpenResult submitMerchantInfo(String appId, String subjectType, MinishopBusiLicense busiLicense, MinishopOrganizationCodeInfo organizationCodeInfo, MinishopIdcardInfo idcardInfo, MinishopSuperAdministratorInfo superAdministratorInfo, String merchantShoprtName) throws WxErrorException;
618631

619632
/**
620-
*
621633
* @param appId
622634
* @param nameInfo
623635
* @param returnInfo
@@ -628,7 +640,6 @@ public interface WxOpenComponentService {
628640

629641

630642
/**
631-
*
632643
* @param height
633644
* @param width
634645
* @param file
@@ -640,6 +651,7 @@ public interface WxOpenComponentService {
640651

641652
/**
642653
* 获取小商店的类目详情
654+
*
643655
* @param appId:小商店APPID
644656
* @param fCatId:父类目ID,可先填0获取根部类目
645657
* @return 小商店类目信息列表
@@ -649,6 +661,7 @@ public interface WxOpenComponentService {
649661

650662
/**
651663
* 获取小商店品牌信息
664+
*
652665
* @param appId:小商店appID
653666
* @return
654667
*/
@@ -657,6 +670,7 @@ public interface WxOpenComponentService {
657670

658671
/**
659672
* 获取小商店运费模版信息
673+
*
660674
* @param appId:小商店appID
661675
* @return
662676
*/
@@ -665,6 +679,7 @@ public interface WxOpenComponentService {
665679

666680
/**
667681
* 获取小商店商品分类信息
682+
*
668683
* @param appId
669684
* @return
670685
*/
@@ -673,6 +688,7 @@ public interface WxOpenComponentService {
673688

674689
/**
675690
* 获取小商店的快递公司列表
691+
*
676692
* @param appId
677693
* @return
678694
* @throws WxErrorException
@@ -681,18 +697,21 @@ public interface WxOpenComponentService {
681697

682698
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
683699
//小商店优惠券接口
700+
684701
/**
685702
* 创建小商店优惠券
703+
*
686704
* @param appId:小商店的appId
687-
* @param couponInfo: 优惠券信息
705+
* @param couponInfo: 优惠券信息
688706
* @return couponId: 优惠券ID
689707
* @throws WxErrorException
690708
*/
691-
Integer minishopCreateCoupon(String appId, WxMinishopCoupon couponInfo) throws WxErrorException;
709+
Integer minishopCreateCoupon(String appId, WxMinishopCoupon couponInfo) throws WxErrorException;
692710

693711

694712
/**
695713
* 与小商店对接,获取小商店的优惠券信息
714+
*
696715
* @param appId:小商店的appId
697716
* @param startCreateTime:优惠券创建时间的搜索开始时间
698717
* @param endCreateTime:优惠券创建时间的搜索结束时间
@@ -707,16 +726,18 @@ public interface WxOpenComponentService {
707726

708727
/**
709728
* 与小商店对接,将优惠券发送给某人
729+
*
710730
* @param appid:小商店appId
711731
* @param openId:优惠券接收人的openId
712-
* @param couponId: 优惠券ID
732+
* @param couponId: 优惠券ID
713733
* @return
714734
*/
715-
WxOpenResult minishopPushCouponToUser(String appid, String openId, Integer couponId) throws WxErrorException;
735+
WxOpenResult minishopPushCouponToUser(String appid, String openId, Integer couponId) throws WxErrorException;
716736

717737

718738
/**
719739
* 与小商店对接,更新商城优惠券
740+
*
720741
* @param appId
721742
* @param couponInfo
722743
* @return
@@ -727,13 +748,14 @@ public interface WxOpenComponentService {
727748

728749
/**
729750
* 从优惠券创建后status=1,可流转到2,4,5, COUPON_STATUS_VALID = 2 ;//生效 COUPON_STATUS_INVALID = 4 ;//已作废 COUPON_STATUS_DEL = 5;//删除
751+
*
730752
* @param appId
731753
* @param couponId
732754
* @param status
733755
* @return
734756
* @throws WxErrorException
735757
*/
736-
WxOpenResult minishopUpdateCouponStatus(String appId, Integer couponId, Integer status) throws WxErrorException;
758+
WxOpenResult minishopUpdateCouponStatus(String appId, Integer couponId, Integer status) throws WxErrorException;
737759

738760

739761
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -747,8 +769,10 @@ public interface WxOpenComponentService {
747769
String MINISHOP_LISTING_SPU_URL = "https://api.weixin.qq.com/product/spu/listing";
748770

749771
String MINISHOP_DELISTING_SPU_URL = "https://api.weixin.qq.com/product/spu/delisting";
772+
750773
/**
751774
* 小商店添加商品接口,添加商品后只是添加到草稿箱,需要通过调用上架商品,并通过审核才能在商城中显示。
775+
*
752776
* @param appId
753777
* @param spu
754778
* @return
@@ -759,17 +783,19 @@ public interface WxOpenComponentService {
759783

760784
/**
761785
* 小商店删除商品接口,直接删除,不会存在小商店回收站里面。
786+
*
762787
* @param appId
763788
* @param productId
764789
* @param outProductId
765790
* @return
766791
* @throws WxErrorException
767792
*/
768-
WxOpenResult minishopGoodsDelSpu(String appId, Long productId, Long outProductId) throws WxErrorException;
793+
WxOpenResult minishopGoodsDelSpu(String appId, Long productId, Long outProductId) throws WxErrorException;
769794

770795

771796
/**
772797
* 小商店更新商品接口,不会直接影响上架商品的信息,而是存在草稿箱,需要调用上架商品接口,并通过审核才能在商城中显示。
798+
*
773799
* @param appId
774800
* @param spu
775801
* @return
@@ -780,6 +806,7 @@ public interface WxOpenComponentService {
780806

781807
/**
782808
* 上架商品。
809+
*
783810
* @param appId
784811
* @param productId
785812
* @param outProductId
@@ -791,6 +818,7 @@ public interface WxOpenComponentService {
791818

792819
/**
793820
* 下架商品
821+
*
794822
* @param appId
795823
* @param productId
796824
* @param outProductId
@@ -816,6 +844,7 @@ public interface WxOpenComponentService {
816844

817845
/**
818846
* 小商店新增sku信息
847+
*
819848
* @param appId
820849
* @param sku
821850
* @return
@@ -826,6 +855,7 @@ public interface WxOpenComponentService {
826855

827856
/**
828857
* 小商店批量新增sku信息
858+
*
829859
* @param appId
830860
* @param skuList
831861
* @return
@@ -836,6 +866,7 @@ public interface WxOpenComponentService {
836866

837867
/**
838868
* 小商店删除sku消息
869+
*
839870
* @param appId
840871
* @param productId
841872
* @param outProductId
@@ -844,11 +875,12 @@ public interface WxOpenComponentService {
844875
* @return
845876
* @throws WxErrorException
846877
*/
847-
WxOpenResult minishopGoodsDelSku(String appId, Long productId, Long outProductId, String outSkuId, Long skuId) throws WxErrorException;
878+
WxOpenResult minishopGoodsDelSku(String appId, Long productId, Long outProductId, String outSkuId, Long skuId) throws WxErrorException;
848879

849880

850881
/**
851882
* 小商店更新sku
883+
*
852884
* @param appId
853885
* @param sku
854886
* @return
@@ -859,6 +891,7 @@ public interface WxOpenComponentService {
859891

860892
/**
861893
* 小商店更新sku价格
894+
*
862895
* @param appId
863896
* @param productId
864897
* @param outProductId
@@ -874,6 +907,7 @@ public interface WxOpenComponentService {
874907

875908
/**
876909
* 小商店更新sku库存
910+
*
877911
* @param appId
878912
* @param productId
879913
* @param outProductId
@@ -884,11 +918,12 @@ public interface WxOpenComponentService {
884918
* @return
885919
* @throws WxErrorException
886920
*/
887-
WxOpenResult minishopGoodsUpdateSkuStock(String appId, Long productId, Long outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException;
921+
WxOpenResult minishopGoodsUpdateSkuStock(String appId, Long productId, Long outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException;
888922

889923

890924
/**
891925
* 小商店通用Post接口
926+
*
892927
* @param appId
893928
* @param url
894929
* @param requestParam
@@ -898,7 +933,6 @@ public interface WxOpenComponentService {
898933
String minishopCommonPost(String appId, String url, String requestParam) throws WxErrorException;
899934

900935

901-
902936
//////////////////////////////////////////////////////////////
903937
//商品抢购任务-秒杀活动
904938
String API_MINISHOP_ADD_LIMIT_DISCOUNT_URL = "https://api.weixin.qq.com/product/limiteddiscount/add/";
@@ -910,6 +944,7 @@ public interface WxOpenComponentService {
910944
/**
911945
* 添加抢购任务
912946
* 每个商品(SPU)同一时间只能有一个抢购任务。 如果当前有抢购任务没有结束,无论是否开始,都不允许创建第二个抢购任务 可以提前修改抢购任务状态为结束后,再创建新的任务。 每次创建抢购任务时,必须填充该SPU下 所有SKU的抢购信息
947+
*
913948
* @param appId
914949
* @param limitDiscountGoods
915950
* @return
@@ -919,6 +954,7 @@ public interface WxOpenComponentService {
919954

920955
/**
921956
* status为0代表 还未结束的抢购任务,无论是否开始 status为1代表已经结束的 抢购任务 如果不填status,则两种都拉取
957+
*
922958
* @param appId
923959
* @param status
924960
* @return
@@ -929,6 +965,7 @@ public interface WxOpenComponentService {
929965
/**
930966
* 修改抢购任务状态
931967
* 用于提前结束抢购任务,无论抢购任务是否在执行中,都可以关闭。 也可以直接删除抢购任务 注意:结束后不允许再开启,状态不可逆
968+
*
932969
* @param appId
933970
* @param taskId
934971
* @param status

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import me.chanjar.weixin.open.bean.result.*;
3131
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
3232
import org.apache.commons.lang3.StringUtils;
33+
import org.jetbrains.annotations.Nullable;
3334

3435
import java.io.File;
3536
import java.math.BigDecimal;
@@ -493,7 +494,13 @@ public List<WxOpenMaCodeTemplate> getTemplateDraftList() throws WxErrorException
493494

494495
@Override
495496
public List<WxOpenMaCodeTemplate> getTemplateList() throws WxErrorException {
496-
String responseContent = get(GET_TEMPLATE_LIST_URL, "access_token");
497+
return getTemplateList(null);
498+
}
499+
500+
@Override
501+
public List<WxOpenMaCodeTemplate> getTemplateList(@Nullable Integer templateType) throws WxErrorException {
502+
String url = GET_TEMPLATE_LIST_URL + (templateType == null ? "" : "?template_type=" + templateType);
503+
String responseContent = get(url, "access_token");
497504
JsonObject response = GsonParser.parse(StringUtils.defaultString(responseContent, "{}"));
498505
boolean hasTemplateList = response.has("template_list");
499506
if (hasTemplateList) {

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/WxOpenMaCodeTemplate.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ public class WxOpenMaCodeTemplate implements Serializable {
3232
*/
3333
@SerializedName(value = "userDesc", alternate = "user_desc")
3434
private String userDesc;
35+
36+
/**
37+
* 模板类型 0对应普通模板,1对应标准模板
38+
*/
39+
@SerializedName(value = "templateType", alternate = "template_type")
40+
private Integer template_type;
41+
3542
/**
3643
* 开发者上传草稿时间 / 被添加为模版的时间
3744
*/

0 commit comments

Comments
 (0)
0