Houjie
2025-07-03 c46e5e406ced41073eced2cd7a825ea8d84a58bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package org.jeecg.modules.qywx.message.vo;
 
import lombok.AllArgsConstructor;
import lombok.Data;
 
import java.util.List;
 
/**
 * 模板卡片消息实体
 */
@Data
public class TemplateCardEntity {
    private Source source;//否    卡片来源样式信息,不需要来源样式可不填写
    private ActionMenu action_menu;//否    卡片右上角更多操作按钮
    private String task_id;//否    任务id,同一个应用任务id不能重复,只能由数字、字母和“_-@”组成,最长128字节,填了action_menu字段的话本字段必填
    private MainTitle main_title;
    private QuoteArea quote_area;//否    引用文献样式
    private EmphasisContent emphasis_content;
    private String sub_title_text;//二级普通文本,建议不超过160个字,(支持id转译)
    private List<HorizontalContent> horizontal_content_list;
    private List<Jump> jump_list;//否    跳转指引样式的列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过3
    private CardAction card_action;//是    整体卡片的点击跳转事件,text_notice必填本字段
    //图文展示型卡票独有的参数
    private CardImage card_image;
    private String card_type = "text_notice";// 模板卡片类型,文本通知型卡片填写 "text_notice"
 
    @Data
    public static class Source {
        private String icon_url;//否    来源图片的url,来源图片的尺寸建议为72*72
        private String desc;//否    来源图片的描述,建议不超过20个字,(支持id转译)
        private String desc_color;//否    来源文字的颜色,目前支持:0(默认) 灰色,1 黑色,2 红色,3 绿色
    }
 
    @Data
    public static class ActionMenu {
        private String desc;//否    更多操作界面的描述
        private List<ActionList> action_list;//是    操作列表,列表长度取值范围为 [1, 3]
 
        @Data
        @AllArgsConstructor
        public static class ActionList {
            private String key;//是    操作key值,用户点击后,会产生回调事件将本参数作为EventKey返回,回调事件会带上该key值,最长支持1024字节,不可重复
            private String text;//是    操作的描述文案
        }
    }
 
    @Data
    public static class MainTitle {
        private String title;//否    一级标题,建议不超过36个字,文本通知型卡片本字段非必填,但不可本字段和sub_title_text都不填,(支持id转译)
        private String desc;//否    标题辅助信息,建议不超过44个字,(支持id转译)
    }
 
    @Data
    private class QuoteArea {
        private int type;//否    引用文献样式区域点击事件,0或不填代表没有点击事件,1 代表跳转url,2 代表跳转小程序
        private String url;//否    点击跳转的url,quote_area.type是1时必填
        private String title;//否    引用文献样式的标题
        private String quote_text;//否    引用文献样式的引用文案
    }
 
    @Data
    private class EmphasisContent {
        private String title;//否    关键数据样式的数据内容,建议不超过14个字
        private String desc;//否    关键数据样式的数据描述内容,建议不超过22个字
    }
 
    @Data
    public static class HorizontalContent {
        private String keyname;//是    二级标题,建议不超过5个字
        private String value;//否    二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过30个字,(支持id转译)
    }
 
    @Data
    @AllArgsConstructor
    public static class Jump {
        private int type;//否    跳转链接类型,0或不填代表不是链接,1 代表跳转url,2 代表跳转小程序
        private String title;//是    跳转链接样式的文案内容,建议不超过18个字
        private String url;//否    跳转链接的url,jump_list.type是1时必填
    }
 
    @Data
    public static class CardAction {
        private int type;//是    跳转事件类型,1 代表跳转url,2 代表打开小程序。text_notice卡片模版中该字段取值范围为[1,2]
        private String url;//否    跳转事件的url,card_action.type是1时必填
        private String appid;//否    跳转事件的小程序的appid,必须是与当前应用关联的小程序,card_action.type是2时必填
        private String pagepath;//否    跳转事件的小程序的pagepath,card_action.type是2时选填
    }
 
    @Data
    public static class CardImage {
        private String url;//是    图片的url
        private String aspect_ratio;//否    图片的宽高比,宽高比要小于2.25,大于1.3,不填该参数默认1.3
    }
}