Skip to content

🆕 增加开放平台将草稿添加到代码标准模板库的支持 #2185

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 1 commit into from
Jul 1, 2021
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
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