🆕 #2185 【开放平台】增加将草稿添加到代码标准模板库的接口

This commit is contained in:
TomLiu 2021-07-01 16:47:48 +08:00 committed by GitHub
parent 577b756912
commit fedab8f28a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -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;
/**
* 删除指定小程序代码模版.
*

View File

@ -484,6 +484,14 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
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();