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
🆕 增加开放平台将草稿添加到代码标准模板库的支持
  • Loading branch information
stoneliu-coder committed Jun 30, 2021
commit 1b0fc0b5205a81e3ee29893f666c58c0ba7e05a2
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,27 @@ public interface WxOpenComponentService {
List<WxOpenMaCodeTemplate> getTemplateList() throws WxErrorException;

/**
* 请参考并使用 {@link #addToTemplate(long,int)}.
* 将草稿箱的草稿选为小程序代码模版.
*
* @param draftId 草稿ID,本字段可通过“获取草稿箱内的所有临时代码草稿”接口获得
* @throws WxErrorException 操作失败时抛出,具体错误码请看此接口的注释文档
* @see #getTemplateDraftList #getTemplateDraftList
*/
@Deprecated
void addToTemplate(long draftId) throws WxErrorException;

/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/addtotemplate.html
* 将草稿添加到代码模板库.
*
* @param draftId 草稿ID,本字段可通过“获取草稿箱内的所有临时代码草稿”接口获得
* @param templateType 代码模版类型,【普通模板:0, 标准模板:1】
* @throws WxErrorException 操作失败时抛出,具体错误码请看此接口的注释文档
* @see #getTemplateDraftList #getTemplateDraftList
*/
void addToTemplate(long draftId, int templateType) throws WxErrorException;

/**
* 删除指定小程序代码模版.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,14 @@ public void addToTemplate(long draftId) throws WxErrorException {
post(ADD_TO_TEMPLATE_URL, param.toString(), "access_token");
}

@Override
public void addToTemplate(long draftId,int templateType) throws WxErrorException {
JsonObject param = new JsonObject();
param.addProperty("draft_id", draftId);
param.addProperty("template_type", templateType);
post(ADD_TO_TEMPLATE_URL, param.toString(), "access_token");
}

@Override
public void deleteTemplate(long templateId) throws WxErrorException {
JsonObject param = new JsonObject();
Expand Down