Skip to content

Commit

Permalink
🎨 #2272 【企业微信】发送新客户欢迎语接口增加对file文件消息的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Aug 23, 2021
1 parent b65783b commit 28156fc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package me.chanjar.weixin.cp.bean.external.msg;

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

import java.io.Serializable;

/**
* @author chutian0124
*/
@Data
public class Attachment implements Serializable {
private static final long serialVersionUID = -8078748379570640198L;

Expand All @@ -15,62 +20,35 @@ public class Attachment implements Serializable {

private Link link;

private MiniProgram miniprogram;
@SerializedName("miniprogram")
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;
}
private File file;

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;
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;
}

public void setFile(File file ) {
this.file = file;
this.msgType = WxCpConsts.WelcomeMsgType.FILE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package me.chanjar.weixin.cp.bean.external.msg;

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

import java.io.Serializable;

/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2021-08-23
*/
@Data
public class File implements Serializable {
private static final long serialVersionUID = 2794189478198329090L;

@SerializedName("media_id")
private String mediaId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,10 @@ public static class WelcomeMsgType {
* 小程序消息.
*/
public static final String MINIPROGRAM = "miniprogram";

/**
* 文件消息.
*/
public static final String FILE = "file";
}
}

0 comments on commit 28156fc

Please sign in to comment.