43 lines
823 B
Go
43 lines
823 B
Go
package builder
|
|
|
|
import (
|
|
"lone-services/pkg/utils"
|
|
"lone-services/pkg/wecom/message"
|
|
)
|
|
|
|
type TextCardParams struct {
|
|
ToUser string
|
|
Desc string
|
|
Title string
|
|
Content []message.HorizontalContent
|
|
}
|
|
|
|
func TextCard(params TextCardParams) (*message.SendRequest, error) {
|
|
|
|
return &message.SendRequest{
|
|
ToUser: params.ToUser,
|
|
MsgType: "template_card",
|
|
AgentId: utils.GetConfigInt("wecom.notify_agent_id"),
|
|
|
|
TemplateCard: &message.TextNoticeCard{
|
|
CardType: "text_notice",
|
|
|
|
Source: &message.TemplateSource{
|
|
IconURL: utils.GetConfigString("wecom.icon_url"),
|
|
Desc: params.Desc,
|
|
},
|
|
|
|
MainTitle: &message.MainTitle{
|
|
Title: params.Title,
|
|
},
|
|
|
|
HorizontalContentList: params.Content,
|
|
|
|
CardAction: &message.CardAction{
|
|
Type: 1,
|
|
URL: "https://google.com",
|
|
},
|
|
},
|
|
}, nil
|
|
}
|