package main // 声明接口类型Notifier type Notifier interface { Send() //注册方法Send() } // 常量定义,qy机器人的webhook地址 const webhookURLVerCode = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7516e5e3-ba65-41e0-b858-3b3ef618fae2" // 结构体定义 type OriginContent struct { from string content string timestamp string } // 调用send()方法 func sendToWechatBot(N Notifier) { N.Send() } // 结构体构造 func NewOrignContent(from, content, timestamp string) OriginContent { return OriginContent{ from, content, timestamp, } } var newObj OriginContent