mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 07:23:01 +08:00
增加删除标签的接口
This commit is contained in:
parent
ede249643c
commit
f13dcaa1fc
@ -45,4 +45,14 @@ public interface WxMpUserTagService {
|
|||||||
*/
|
*/
|
||||||
Boolean tagUpdate(Integer id, String name) throws WxErrorException;
|
Boolean tagUpdate(Integer id, String name) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 删除标签
|
||||||
|
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
|
||||||
|
* 接口url格式: https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=ACCESS_TOKEN
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Boolean tagDelete(Integer id) throws WxErrorException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,4 +72,24 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
|
|||||||
|
|
||||||
throw new WxErrorException(wxError);
|
throw new WxErrorException(wxError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean tagDelete(Integer id) throws WxErrorException {
|
||||||
|
String url = API_URL_PREFIX + "/delete";
|
||||||
|
|
||||||
|
JsonObject json = new JsonObject();
|
||||||
|
JsonObject tagJson = new JsonObject();
|
||||||
|
tagJson.addProperty("id", id);
|
||||||
|
json.add("tag", tagJson);
|
||||||
|
|
||||||
|
String responseContent = this.wxMpService.post(url, json.toString());
|
||||||
|
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(),
|
||||||
|
responseContent);
|
||||||
|
WxError wxError = WxError.fromJson(responseContent);
|
||||||
|
if (wxError.getErrorCode() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new WxErrorException(wxError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,4 +48,11 @@ public class WxMpUserTagServiceImplTest {
|
|||||||
Assert.assertTrue(res);
|
Assert.assertTrue(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = { "testTagCreate" })
|
||||||
|
public void testTagDelete() throws Exception {
|
||||||
|
Boolean res = this.wxService.getUserTagService().tagDelete(this.tagId);
|
||||||
|
System.out.println(res);
|
||||||
|
Assert.assertTrue(res);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user