-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 【企业微信】添加AttachmentBuilder,可以更方便的创建新客户欢迎语的附件信息
- Loading branch information
Showing
9 changed files
with
95 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/AttachmentBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package me.chanjar.weixin.cp.bean.external.msg; | ||
|
||
import lombok.Builder; | ||
|
||
/** | ||
* @author codecrab | ||
*/ | ||
public class AttachmentBuilder { | ||
|
||
@Builder(builderClassName = "ImageBuilder", builderMethodName = "imageBuilder") | ||
private static Attachment image(String mediaId, String picUrl) { | ||
Image image = new Image().setMediaId(mediaId).setPicUrl(picUrl); | ||
return new Attachment().setImage(image); | ||
} | ||
|
||
@Builder(builderClassName = "VideoBuilder", builderMethodName = "videoBuilder") | ||
private static Attachment video(String mediaId) { | ||
Video video = new Video().setMediaId(mediaId); | ||
return new Attachment().setVideo(video); | ||
} | ||
|
||
@Builder(builderClassName = "FileBuilder", builderMethodName = "fileBuilder") | ||
private static Attachment file(String mediaId) { | ||
File file = new File().setMediaId(mediaId); | ||
return new Attachment().setFile(file); | ||
} | ||
|
||
@Builder(builderClassName = "LinkBuilder", builderMethodName = "linkBuilder") | ||
private static Attachment link(String title, String url, String picUrl, String desc) { | ||
Link link = new Link().setTitle(title).setPicUrl(picUrl).setUrl(url).setDesc(desc); | ||
return new Attachment().setLink(link); | ||
} | ||
|
||
@Builder(builderClassName = "MiniProgramBuilder", builderMethodName = "miniProgramBuilder") | ||
private static Attachment miniProgram(String title, String picMediaId, String appId, String page) { | ||
MiniProgram miniProgram = new MiniProgram().setTitle(title).setPicMediaId(picMediaId).setAppid(appId).setPage(page); | ||
return new Attachment().setMiniProgram(miniProgram); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Location.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters