wangshan 3 mēneši atpakaļ
vecāks
revīzija
5f48e765ee
2 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 3 1
      internal/dao/internal/personnel.go
  2. 1 0
      manifest/config/config.yaml

+ 3 - 1
internal/dao/internal/personnel.go

@@ -134,7 +134,9 @@ func (dao *PersonnelDao) BatchExecInsert(ctx context.Context, in []*model.Person
 	_, err = g.DB().Model(dao.Model()).Data(insertData).Insert()
 	if err != nil {
 		g.Log().Error(ctx, "batch insert false, --err:", err)
-		utils.SendMsgByWXURL(fmt.Sprintf("人员行为统计数据存储异常。\n错误信息:\n%s", err.Error()), g.Config().MustGet(ctx, "webhookURL").Strings())
+		if webhookSwitch := g.Cfg().MustGet(ctx, "webhookSwitch").Bool(); webhookSwitch {
+			utils.SendMsgByWXURL(fmt.Sprintf("人员行为统计数据存储异常。\n错误信息:\n%s", err.Error()), g.Config().MustGet(ctx, "webhookURL").Strings())
+		}
 		return
 	}
 	return

+ 1 - 0
manifest/config/config.yaml

@@ -41,6 +41,7 @@ cacheChanInfo:
   timeAfter: 2000   # 定时保存 毫秒
   timeout: 10000    # 缓存通道满时,超时丢弃
   sCSize: 3         # 数据库并发存储数据
+webhookSwitch: false
 webhookURL: ["https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=24b0ac60-3a02-441f-842e-9cd3f75d1208"]