Merge pull request 'by Robin at 20240302' (#156) from feat-IRONFANS-61-Robin into main

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/156
This commit is contained in:
chenhao 2024-03-02 08:29:46 +08:00
commit fe3e1c35be
2 changed files with 11 additions and 1 deletions

View File

@ -290,7 +290,7 @@ func (s *CronService) SendContactCustomerServicesOfLastMinute(ctx context.Contex
return err.Error()
}
err = dingtalk.SendMsgToAll(msg)
err = dingtalk.SendMsg(msg)
if err != nil {
return err.Error()
}

View File

@ -18,6 +18,16 @@ func NewDingTalkCilent(cfg *configcenter.DingTalkRobotConfig) *dingtalk.Client {
return client
}
func SendMsg(message string) error {
msg := dingtalk.NewTextMessage().SetContent(message)
_, _, err := defaultDingTalkClient.Send(msg)
if err != nil {
logger.Error("SendMsgToAll fail, err: %v", err)
return err
}
return nil
}
func SendMsgToAll(message string) error {
msg := dingtalk.NewTextMessage().SetContent(message).SetAt(nil, true)
_, _, err := defaultDingTalkClient.Send(msg)