@@ -7,12 +7,13 @@ type Message struct {
7
7
}
8
8
9
9
type ComponentMessage struct {
10
- Type string `json:"type"`
11
- Content interface {} `json:"content"`
12
- Duration int `json:"duration"`
13
- Icon string `json:"icon"`
14
- Data interface {} `json:"data"`
15
- Url string `json:"url"`
10
+ Component string `json:"component"`
11
+ Type string `json:"type"`
12
+ Content interface {} `json:"content"`
13
+ Duration int `json:"duration"`
14
+ Icon string `json:"icon"`
15
+ Data interface {} `json:"data"`
16
+ Url string `json:"url"`
16
17
}
17
18
18
19
type CodeMap struct {
@@ -120,9 +121,10 @@ func ComponentSuccess(params ...interface{}) *ComponentMessage {
120
121
}
121
122
122
123
return & ComponentMessage {
123
- Type : "success" ,
124
- Content : content ,
125
- Data : data ,
124
+ Component : "message" ,
125
+ Type : "success" ,
126
+ Content : content ,
127
+ Data : data ,
126
128
}
127
129
}
128
130
@@ -141,9 +143,10 @@ func ComponentError(params ...interface{}) *ComponentMessage {
141
143
}
142
144
143
145
return & ComponentMessage {
144
- Type : "error" ,
145
- Content : content ,
146
- Data : data ,
146
+ Component : "message" ,
147
+ Type : "error" ,
148
+ Content : content ,
149
+ Data : data ,
147
150
}
148
151
}
149
152
@@ -164,9 +167,10 @@ func ComponentErrorByCode(params ...interface{}) *ComponentMessage {
164
167
content = GetMsgByCode (code )
165
168
166
169
return & ComponentMessage {
167
- Type : "error" ,
168
- Content : content ,
169
- Data : data ,
170
+ Component : "message" ,
171
+ Type : "error" ,
172
+ Content : content ,
173
+ Data : data ,
170
174
}
171
175
}
172
176
@@ -191,8 +195,9 @@ func ComponentRedirectTo(params ...interface{}) *ComponentMessage {
191
195
}
192
196
193
197
return & ComponentMessage {
194
- Type : msgType ,
195
- Content : content ,
196
- Url : url ,
198
+ Component : "message" ,
199
+ Type : msgType ,
200
+ Content : content ,
201
+ Url : url ,
197
202
}
198
203
}
0 commit comments