Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
bf1def0
升级XStream版本,20201.3.13日XStream官方发布安全更新,修复了共计11个高危和严重漏洞
Mar 23, 2021
2bc7eba
Merge pull request #1 from Wechat-Group/develop
chutian0124 Mar 23, 2021
9004b08
Merge pull request #2141 from Wechat-Group/develop
binarywang Jun 2, 2021
2b1c2b7
Merge pull request #2 from Wechat-Group/develop
chutian0124 Jun 18, 2021
05520cb
企业微信欢迎语不支持视频类型的欢迎语 #2155
Jun 21, 2021
dc3f855
企业微信客户联系接口缺少 #2150
Jun 21, 2021
f23271e
企业微信服务商模式缺少外部联系人openid转换 #2147
Jun 22, 2021
3e18ba0
Merge pull request #3 from Wechat-Group/develop
chutian0124 Jun 22, 2021
3d3ad01
企业微信客户联系接口缺少 #2150
Jun 22, 2021
296b5ef
Merge remote-tracking branch 'origin/develop' into develop
Jun 22, 2021
6e6dab9
Merge remote-tracking branch 'upstream/develop' into develop
Jun 22, 2021
11ee52f
互联企业的消息推送接口返回字段类型和官网api不一致 #2148
Jun 22, 2021
bf266b8
互联企业的消息推送接口返回字段类型和官网api不一致 #2148
Jun 23, 2021
37959e0
微信分账服务类增加v3接口 #2120
Jun 25, 2021
8bd189d
Merge remote-tracking branch 'upstream/release' into develop
Jun 28, 2021
56f79c0
服务商模式下进件增加小微商户类型的支持 #2114
Jun 28, 2021
ee0e20a
Merge pull request #4 from Wechat-Group/develop
chutian0124 Jun 28, 2021
92320d4
[企业微信]查询电子发票企业微信官方文档更新接口 #2178
Jun 29, 2021
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
Prev Previous commit
Next Next commit
企业微信欢迎语不支持视频类型的欢迎语 #2155
同时修改欢迎语结构不正确的问题
  • Loading branch information
pengg committed Jun 21, 2021
commit 05520cbcbebe27df4fca9ba5d4673725195d7e9a
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

import com.google.gson.annotations.SerializedName;
import lombok.*;
import me.chanjar.weixin.cp.bean.external.msg.Image;
import me.chanjar.weixin.cp.bean.external.msg.Link;
import me.chanjar.weixin.cp.bean.external.msg.MiniProgram;
import me.chanjar.weixin.cp.bean.external.msg.Text;
import me.chanjar.weixin.cp.bean.external.msg.*;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.io.Serializable;
import java.util.List;

/**
* 新客户欢迎语.
Expand All @@ -28,11 +26,7 @@ public class WxCpWelcomeMsg implements Serializable {

private Text text;

private Image image;

private Link link;

private MiniProgram miniprogram;
private List<Attachment> attachments;

public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package me.chanjar.weixin.cp.bean.external.msg;

import com.google.gson.annotations.SerializedName;
import me.chanjar.weixin.cp.constant.WxCpConsts;

import java.io.Serializable;

public class Attachment implements Serializable {
private static final long serialVersionUID = -8078748379570640198L;

@SerializedName("msgtype")
private String msgType;

private Image image;

private Link link;

private MiniProgram miniprogram;

private Video video;

@Override
public String toString() {
return "Attachment{" +
"msgType='" + msgType + '\'' +
", image=" + image +
", link=" + link +
", miniprogram=" + miniprogram +
", video=" + video +
'}';
}

private String getMsgType() {
return msgType;
}

private void setMsgType(String msgType) {
this.msgType = msgType;
}

public Image getImage() {
return image;
}

public void setImage(Image image) {
this.image = image;
this.msgType = WxCpConsts.WelcomeMsgType.IMAGE;
}

public Link getLink() {
return link;
}

public void setLink(Link link) {
this.link = link;
this.msgType = WxCpConsts.WelcomeMsgType.LINK;
}

public MiniProgram getMiniprogram() {
return miniprogram;
}

public void setMiniprogram(MiniProgram miniprogram) {
this.miniprogram = miniprogram;
this.msgType = WxCpConsts.WelcomeMsgType.MINIPROGRAM;
}

public Video getVideo() {
return video;
}

public void setVideo(Video video) {
this.video = video;
this.msgType = WxCpConsts.WelcomeMsgType.VIDEO;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package me.chanjar.weixin.cp.bean.external.msg;

import com.google.gson.annotations.SerializedName;
import lombok.Data;

import java.io.Serializable;

/**
* 视频消息
*
* @author pg
* @date 2021-6-21
*/
@Data
public class Video implements Serializable {
private static final long serialVersionUID = -6048642921382867138L;
@SerializedName("media_id")
private String mediaId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,24 @@ public static class WorkBenchType {
* */
public static final String WEBVIEW = "webview";
}

@UtilityClass
public static class WelcomeMsgType {
/**
* 图片消息.
*/
public static final String IMAGE = "image";
/**
* 图文消息.
*/
public static final String LINK = "link";
/**
* 视频消息.
*/
public static final String VIDEO = "video";
/**
* 小程序消息.
*/
public static final String MINIPROGRAM = "miniprogram";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.bean.external.*;
import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
import me.chanjar.weixin.cp.bean.external.msg.Attachment;
import me.chanjar.weixin.cp.bean.external.msg.Image;
import me.chanjar.weixin.cp.bean.external.msg.Video;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -214,8 +217,22 @@ public void testAddMsgTemplate() {

@Test
public void testSendWelcomeMsg() throws WxErrorException {
Image image = new Image();
image.setMediaId("123123");
Attachment attachment = new Attachment();
attachment.setImage(image);

Video video = new Video();
video.setMediaId("video_media_id");
Attachment attachment2 = new Attachment();
attachment2.setVideo(video);

List<Attachment> attachments = new ArrayList<>();
attachments.add(attachment);
attachments.add(attachment2);
this.wxCpService.getExternalContactService().sendWelcomeMsg(WxCpWelcomeMsg.builder()
.welcomeCode("abc")
.attachments(attachments)
.build());
}

Expand Down