代码拉取完成,页面将自动刷新
package service
import (
"errors"
"gitee.com/rachel_os/fastsearch/global"
"gitee.com/rachel_os/fastsearch/notice"
)
type Notice struct {
Text string `json:"text"`
ToUser string `json:"to_user"`
ToUserID string `json:"to_user_id"`
}
func NewNotice() *Notice {
return &Notice{}
}
// 消息通知
func (noc *Notice) Notice(w Notice) ([]string, error) {
notice := notice.NewNotice()
notice.Msg.MsgType = "text"
notice.Msg.AgentID = w.ToUserID
notice.Msg.User = w.ToUser
notice.Msg.Text.Content = w.Text
// 微信配置
notice.WxConfig.CorpID = global.CONFIG.Notice.QyWeixin.CorpID
notice.WxConfig.CorpSecret = global.CONFIG.Notice.QyWeixin.CorpSecret
// 钉钉配置
notice.DingConfig.WebhookURL = global.CONFIG.Notice.DingTalk.WebHook
var (
rel []string
)
if !global.CONFIG.Notice.Enable {
return nil, errors.New("未开启消息通知")
}
if global.CONFIG.Notice.DingTalk.Enable {
v, _ := notice.DingTalk()
rel = append(rel, v)
}
if global.CONFIG.Notice.QyWeixin.Enable {
v, _ := notice.Qweixin()
rel = append(rel, v)
}
return rel, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。