mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 13:06:54 +08:00
调整移除group相关接口后的代码
This commit is contained in:
parent
1352385328
commit
f2a858db7a
@ -4,7 +4,7 @@ import me.chanjar.weixin.common.bean.WxJsapiSignature;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
import me.chanjar.weixin.mp.bean.WxMpIndustry;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassNews;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassPreviewMessage;
|
||||
@ -88,7 +88,7 @@ public interface WxMpService {
|
||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口
|
||||
* </pre>
|
||||
*
|
||||
* @see #massGroupMessageSend(me.chanjar.weixin.mp.bean.WxMpMassGroupMessage)
|
||||
* @see #massGroupMessageSend(me.chanjar.weixin.mp.bean.WxMpMassTagMessage)
|
||||
* @see #massOpenIdsMessageSend(me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage)
|
||||
*/
|
||||
WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException;
|
||||
@ -99,7 +99,7 @@ public interface WxMpService {
|
||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口
|
||||
* </pre>
|
||||
*
|
||||
* @see #massGroupMessageSend(me.chanjar.weixin.mp.bean.WxMpMassGroupMessage)
|
||||
* @see #massGroupMessageSend(me.chanjar.weixin.mp.bean.WxMpMassTagMessage)
|
||||
* @see #massOpenIdsMessageSend(me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage)
|
||||
*/
|
||||
WxMpMassUploadResult massVideoUpload(WxMpMassVideo video) throws WxErrorException;
|
||||
@ -112,7 +112,7 @@ public interface WxMpService {
|
||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口
|
||||
* </pre>
|
||||
*/
|
||||
WxMpMassSendResult massGroupMessageSend(WxMpMassGroupMessage message) throws WxErrorException;
|
||||
WxMpMassSendResult massGroupMessageSend(WxMpMassTagMessage message) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
@ -1,11 +1,11 @@
|
||||
package me.chanjar.weixin.mp.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户标签管理相关接口
|
||||
* Created by Binary Wang on 2016/9/2.
|
||||
@ -44,7 +44,7 @@ public interface WxMpUserTagService {
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
Boolean tagUpdate(Integer id, String name) throws WxErrorException;
|
||||
Boolean tagUpdate(Long tagId, String name) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -54,7 +54,7 @@ public interface WxMpUserTagService {
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
Boolean tagDelete(Integer id) throws WxErrorException;
|
||||
Boolean tagDelete(Long tagId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -64,7 +64,8 @@ public interface WxMpUserTagService {
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
WxTagListUser tagListUser(Integer tagId, String nextOpenid) throws WxErrorException;
|
||||
WxTagListUser tagListUser(Long tagId, String nextOpenid)
|
||||
throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -74,7 +75,7 @@ public interface WxMpUserTagService {
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
boolean batchTagging(Integer tagId, String[] openids) throws WxErrorException;
|
||||
boolean batchTagging(Long tagId, String[] openids) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -84,7 +85,7 @@ public interface WxMpUserTagService {
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
boolean batchUntagging(Integer tagId, String[] openids) throws WxErrorException;
|
||||
boolean batchUntagging(Long tagId, String[] openids) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -190,7 +190,7 @@ public class WxMpServiceImpl implements WxMpService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpMassSendResult massGroupMessageSend(WxMpMassGroupMessage message) throws WxErrorException {
|
||||
public WxMpMassSendResult massGroupMessageSend(WxMpMassTagMessage message) throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall";
|
||||
String responseContent = execute(new SimplePostRequestExecutor(), url, message.toJson());
|
||||
return WxMpMassSendResult.fromJson(responseContent);
|
||||
|
@ -1,9 +1,16 @@
|
||||
package me.chanjar.weixin.mp.api.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import me.chanjar.weixin.common.bean.result.WxError;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
@ -11,11 +18,6 @@ import me.chanjar.weixin.mp.api.WxMpUserTagService;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -58,7 +60,7 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean tagUpdate(Integer id, String name) throws WxErrorException {
|
||||
public Boolean tagUpdate(Long id, String name) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/update";
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
@ -78,7 +80,7 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean tagDelete(Integer id) throws WxErrorException {
|
||||
public Boolean tagDelete(Long id) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/delete";
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
@ -98,7 +100,8 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxTagListUser tagListUser(Integer tagId, String nextOpenid) throws WxErrorException {
|
||||
public WxTagListUser tagListUser(Long tagId, String nextOpenid)
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/user/tag/get";
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
@ -112,7 +115,8 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean batchTagging(Integer tagId, String[] openids) throws WxErrorException {
|
||||
public boolean batchTagging(Long tagId, String[] openids)
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging";
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
@ -135,7 +139,8 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean batchUntagging(Integer tagId, String[] openids) throws WxErrorException {
|
||||
public boolean batchUntagging(Long tagId, String[] openids)
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging";
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
|
@ -1,52 +0,0 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 微信用户分组
|
||||
* @author chanjarster
|
||||
*
|
||||
*/
|
||||
public class WxMpGroup implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1554709708638735270L;
|
||||
private long id = -1;
|
||||
private String name;
|
||||
private long count;
|
||||
public long getId() {
|
||||
return this.id;
|
||||
}
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public long getCount() {
|
||||
return this.count;
|
||||
}
|
||||
public void setCount(long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public static WxMpGroup fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpGroup.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxMpGroup [id=" + this.id + ", name=" + this.name + ", count=" + this.count + "]";
|
||||
}
|
||||
|
||||
}
|
@ -1,26 +1,23 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
/**
|
||||
* 分组群发的消息
|
||||
* 按标签群发的消息
|
||||
*
|
||||
* @author chanjarster
|
||||
*/
|
||||
public class WxMpMassGroupMessage implements Serializable {
|
||||
public class WxMpMassTagMessage implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6625914040986749286L;
|
||||
private Long groupId;
|
||||
private Long tagId;
|
||||
private String msgtype;
|
||||
private String content;
|
||||
private String mediaId;
|
||||
|
||||
public WxMpMassGroupMessage() {
|
||||
public WxMpMassTagMessage() {
|
||||
super();
|
||||
}
|
||||
|
||||
@ -64,16 +61,16 @@ public class WxMpMassGroupMessage implements Serializable {
|
||||
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
|
||||
}
|
||||
|
||||
public Long getGroupId() {
|
||||
return this.groupId;
|
||||
public Long getTagId() {
|
||||
return this.tagId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果不设置则就意味着发给所有用户
|
||||
* @param groupId
|
||||
* @param tagId
|
||||
*/
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
public void setTagId(Long tagId) {
|
||||
this.tagId = tagId;
|
||||
}
|
||||
|
||||
}
|
@ -19,7 +19,7 @@ public class WxUserTag {
|
||||
/**
|
||||
* id 标签id,由微信分配
|
||||
*/
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* name 标签名,UTF8编码
|
||||
@ -47,11 +47,11 @@ public class WxUserTag {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* KINGSTAR MEDIA SOLUTIONS Co.,LTD. Copyright c 2005-2013. All rights reserved.
|
||||
*
|
||||
* This source code is the property of KINGSTAR MEDIA SOLUTIONS LTD. It is intended
|
||||
* only for the use of KINGSTAR MEDIA application development. Reengineering, reproduction
|
||||
* arose from modification of the original source, or other redistribution of this source
|
||||
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
|
||||
*/
|
||||
package me.chanjar.weixin.mp.util.json;
|
||||
|
||||
import com.google.gson.*;
|
||||
import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.mp.bean.WxMpGroup;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class WxMpGroupGsonAdapter implements JsonSerializer<WxMpGroup>, JsonDeserializer<WxMpGroup> {
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(WxMpGroup group, Type typeOfSrc, JsonSerializationContext context) {
|
||||
JsonObject json = new JsonObject();
|
||||
JsonObject groupJson = new JsonObject();
|
||||
groupJson.addProperty("name", group.getName());
|
||||
groupJson.addProperty("id", group.getId());
|
||||
groupJson.addProperty("count", group.getCount());
|
||||
json.add("group", groupJson);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpGroup deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
WxMpGroup group = new WxMpGroup();
|
||||
JsonObject groupJson = json.getAsJsonObject();
|
||||
if (json.getAsJsonObject().get("group") != null) {
|
||||
groupJson = json.getAsJsonObject().get("group").getAsJsonObject();
|
||||
}
|
||||
if (groupJson.get("name") != null && !groupJson.get("name").isJsonNull()) {
|
||||
group.setName(GsonHelper.getAsString(groupJson.get("name")));
|
||||
}
|
||||
if (groupJson.get("id") != null && !groupJson.get("id").isJsonNull()) {
|
||||
group.setId(GsonHelper.getAsPrimitiveLong(groupJson.get("id")));
|
||||
}
|
||||
if (groupJson.get("count") != null && !groupJson.get("count").isJsonNull()) {
|
||||
group.setCount(GsonHelper.getAsPrimitiveLong(groupJson.get("count")));
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
}
|
@ -2,10 +2,35 @@ package me.chanjar.weixin.mp.util.json;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import me.chanjar.weixin.mp.bean.*;
|
||||
|
||||
import me.chanjar.weixin.mp.bean.WxMpCard;
|
||||
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpIndustry;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassNews;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassPreviewMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassVideo;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMaterialArticleUpdate;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMaterialNews;
|
||||
import me.chanjar.weixin.mp.bean.WxMpTemplateMessage;
|
||||
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate;
|
||||
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary;
|
||||
import me.chanjar.weixin.mp.bean.result.*;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMediaImgUploadResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialCountResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialFileBatchGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialNewsBatchGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialUploadResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialVideoInfoResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
||||
|
||||
public class WxMpGsonBuilder {
|
||||
|
||||
@ -15,9 +40,8 @@ public class WxMpGsonBuilder {
|
||||
INSTANCE.disableHtmlEscaping();
|
||||
INSTANCE.registerTypeAdapter(WxMpCustomMessage.class, new WxMpCustomMessageGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassNews.class, new WxMpMassNewsGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassGroupMessage.class, new WxMpMassGroupMessageGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassTagMessage.class, new WxMpMassTagMessageGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassOpenIdsMessage.class, new WxMpMassOpenIdsMessageGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpGroup.class, new WxMpGroupGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpUser.class, new WxMpUserGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpUserList.class, new WxUserListGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassVideo.class, new WxMpMassVideoAdapter());
|
||||
|
@ -13,22 +13,22 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class WxMpMassGroupMessageGsonAdapter implements JsonSerializer<WxMpMassGroupMessage> {
|
||||
public class WxMpMassTagMessageGsonAdapter implements JsonSerializer<WxMpMassTagMessage> {
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(WxMpMassGroupMessage message, Type typeOfSrc, JsonSerializationContext context) {
|
||||
public JsonElement serialize(WxMpMassTagMessage message, Type typeOfSrc, JsonSerializationContext context) {
|
||||
JsonObject messageJson = new JsonObject();
|
||||
|
||||
JsonObject filter = new JsonObject();
|
||||
if(null == message.getGroupId()) {
|
||||
if(null == message.getTagId()) {
|
||||
filter.addProperty("is_to_all", true);
|
||||
} else {
|
||||
filter.addProperty("is_to_all", false);
|
||||
filter.addProperty("group_id", message.getGroupId());
|
||||
filter.addProperty("group_id", message.getTagId());
|
||||
}
|
||||
messageJson.add("filter", filter);
|
||||
|
@ -14,9 +14,9 @@ import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassNews;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassVideo;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
|
||||
@ -68,11 +68,11 @@ public class WxMpMassMessageAPITest {
|
||||
|
||||
@Test
|
||||
public void testTextMassGroupMessageSend() throws WxErrorException {
|
||||
WxMpMassGroupMessage massMessage = new WxMpMassGroupMessage();
|
||||
WxMpMassTagMessage massMessage = new WxMpMassTagMessage();
|
||||
massMessage.setMsgtype(WxConsts.MASS_MSG_TEXT);
|
||||
massMessage.setContent("测试群发消息\n欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>");
|
||||
massMessage
|
||||
.setGroupId(this.wxService.getGroupService().groupGet().get(0).getId());
|
||||
.setTagId(this.wxService.getUserTagService().tagGet().get(0).getId());
|
||||
|
||||
WxMpMassSendResult massResult = this.wxService
|
||||
.massGroupMessageSend(massMessage);
|
||||
@ -83,11 +83,11 @@ public class WxMpMassMessageAPITest {
|
||||
@Test(dataProvider="massMessages")
|
||||
public void testMediaMassGroupMessageSend(String massMsgType, String mediaId)
|
||||
throws WxErrorException {
|
||||
WxMpMassGroupMessage massMessage = new WxMpMassGroupMessage();
|
||||
WxMpMassTagMessage massMessage = new WxMpMassTagMessage();
|
||||
massMessage.setMsgtype(massMsgType);
|
||||
massMessage.setMediaId(mediaId);
|
||||
massMessage
|
||||
.setGroupId(this.wxService.getGroupService().groupGet().get(0).getId());
|
||||
.setTagId(this.wxService.getUserTagService().tagGet().get(0).getId());
|
||||
|
||||
WxMpMassSendResult massResult = this.wxService
|
||||
.massGroupMessageSend(massMessage);
|
||||
|
@ -1,15 +1,17 @@
|
||||
package me.chanjar.weixin.mp.api.impl;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
|
||||
import java.util.List;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.List;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -22,7 +24,7 @@ public class WxMpUserTagServiceImplTest {
|
||||
@Inject
|
||||
protected WxMpServiceImpl wxService;
|
||||
|
||||
private Integer tagId = 2;
|
||||
private Long tagId = 2L;
|
||||
|
||||
@Test
|
||||
public void testTagCreate() throws Exception {
|
||||
|
Loading…
Reference in New Issue
Block a user