|
@@ -20,7 +20,11 @@ type SmsController struct {
|
|
|
// @router /send [post]
|
|
|
func (this *SmsController) SmsSend() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
+ var err error
|
|
|
defer func() {
|
|
|
+ if err != nil {
|
|
|
+ utils.FileLog.Info("send msg err: %s", err.Error())
|
|
|
+ }
|
|
|
this.Data["json"] = br
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
@@ -29,8 +33,8 @@ func (this *SmsController) SmsSend() {
|
|
|
body := this.GetString("Body")
|
|
|
name := this.GetString("Name")
|
|
|
date := this.GetString("Date")
|
|
|
- utils.FileLog.Info(" %s; %s; %s; %s; %s", sign, address, body, name, date)
|
|
|
|
|
|
+ utils.FileLog.Info("send msg: %s; %s; %s; %s; %s", sign, address, body, name, date)
|
|
|
count, err := models.GetSmsRecordCount(address, date)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "失败,请联系技术"
|
|
@@ -48,8 +52,12 @@ func (this *SmsController) SmsSend() {
|
|
|
}
|
|
|
cli := dingtalk.InitDingTalk(dingToken, "hongze")
|
|
|
cli.SendTextMessage("content", dingtalk.WithAtAll())
|
|
|
- cli.SendMarkDownMessageBySlice("测试测试", msg)
|
|
|
-
|
|
|
+ err = cli.SendMarkDownMessageBySlice("测试测试", msg)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "失败,请联系技术"
|
|
|
+ br.ErrMsg = "发送钉钉消息失败;Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
record := new(models.SmsRecord)
|
|
|
record.CreateTime = time.Now()
|
|
|
record.Mobile = address
|