mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-03 20:27:46 +08:00
🐛 修复图文消息留言管理接口中msgDataId类型与群发消息接口的消息id类型不一致问题
This commit is contained in:
parent
e1ca4e02b7
commit
71ba078768
@ -5,7 +5,7 @@ import me.chanjar.weixin.mp.bean.comment.WxMpCommentListVo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 图文消息留言管理接口.
|
* 图文消息留言管理接口.
|
||||||
* https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1494572718_WzHIY
|
* https://developers.weixin.qq.com/doc/offiaccount/Comments_management/Image_Comments_Management_Interface.html
|
||||||
*
|
*
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
* @date 2019-06-16
|
* @date 2019-06-16
|
||||||
@ -19,7 +19,7 @@ public interface WxMpCommentService {
|
|||||||
* @param index 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
|
* @param index 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
void open(Integer msgDataId, Integer index) throws WxErrorException;
|
void open(String msgDataId, Integer index) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭已群发文章评论.
|
* 关闭已群发文章评论.
|
||||||
@ -29,7 +29,7 @@ public interface WxMpCommentService {
|
|||||||
* @param index 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
|
* @param index 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
void close(Integer msgDataId, Integer index) throws WxErrorException;
|
void close(String msgDataId, Integer index) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看指定文章的评论数据.
|
* 查看指定文章的评论数据.
|
||||||
@ -43,5 +43,5 @@ public interface WxMpCommentService {
|
|||||||
* @return 评论列表数据
|
* @return 评论列表数据
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxMpCommentListVo list(Integer msgDataId, Integer index, int begin, int count, int type) throws WxErrorException;
|
WxMpCommentListVo list(String msgDataId, Integer index, int begin, int count, int type) throws WxErrorException;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class WxMpCommentServiceImpl implements WxMpCommentService {
|
|||||||
private final WxMpService wxMpService;
|
private final WxMpService wxMpService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open(Integer msgDataId, Integer index) throws WxErrorException {
|
public void open(String msgDataId, Integer index) throws WxErrorException {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("msg_data_id", msgDataId);
|
json.addProperty("msg_data_id", msgDataId);
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
@ -29,7 +29,7 @@ public class WxMpCommentServiceImpl implements WxMpCommentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close(Integer msgDataId, Integer index) throws WxErrorException {
|
public void close(String msgDataId, Integer index) throws WxErrorException {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("msg_data_id", msgDataId);
|
json.addProperty("msg_data_id", msgDataId);
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
@ -40,7 +40,7 @@ public class WxMpCommentServiceImpl implements WxMpCommentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxMpCommentListVo list(Integer msgDataId, Integer index, int begin, int count, int type) throws WxErrorException {
|
public WxMpCommentListVo list(String msgDataId, Integer index, int begin, int count, int type) throws WxErrorException {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("msg_data_id", msgDataId);
|
json.addProperty("msg_data_id", msgDataId);
|
||||||
json.addProperty("begin", begin);
|
json.addProperty("begin", begin);
|
||||||
|
@ -31,14 +31,14 @@ public class WxMpCommentServiceImplTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOpen() throws WxErrorException {
|
public void testOpen() throws WxErrorException {
|
||||||
this.wxService.getCommentService().open(1, null);
|
this.wxService.getCommentService().open("1", null);
|
||||||
this.wxService.getCommentService().open(1, 0);
|
this.wxService.getCommentService().open("1", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClose() throws WxErrorException {
|
public void testClose() throws WxErrorException {
|
||||||
this.wxService.getCommentService().close(1000000001, null);
|
this.wxService.getCommentService().close("1000000001", null);
|
||||||
this.wxService.getCommentService().close(1, 0);
|
this.wxService.getCommentService().close("1", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -66,7 +66,7 @@ public class WxMpCommentServiceImplTest {
|
|||||||
WxMpCommentService commentService = new WxMpCommentServiceImpl(wxService);
|
WxMpCommentService commentService = new WxMpCommentServiceImpl(wxService);
|
||||||
doReturn(expectedResponse).when(wxService).post(anyString(), anyString());
|
doReturn(expectedResponse).when(wxService).post(anyString(), anyString());
|
||||||
|
|
||||||
final WxMpCommentListVo commentListVo = commentService.list(1, 1, 1, 1, 1);
|
final WxMpCommentListVo commentListVo = commentService.list("1", 1, 1, 1, 1);
|
||||||
assertThat(commentListVo).isNotNull();
|
assertThat(commentListVo).isNotNull();
|
||||||
System.out.println(commentListVo);
|
System.out.println(commentListVo);
|
||||||
assertThat(commentListVo.getTotal()).isEqualTo(1);
|
assertThat(commentListVo.getTotal()).isEqualTo(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user