Skip to content

Commit

Permalink
fix: Optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
paterleng committed Sep 13, 2024
1 parent cd7f625 commit f06e55d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 19 deletions.
2 changes: 0 additions & 2 deletions api/dingdingapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ func SendMessage(data model.SendMsg) error {
"title": "任务",
"text": data.Content,
"btns": data.ActionBtns,
//"singleTitle": "问题详情",
//"singleURL": data.Url,
}
}

Expand Down
Binary file modified bug-notify
Binary file not shown.
1 change: 1 addition & 0 deletions bug-notify.log
Original file line number Diff line number Diff line change
Expand Up @@ -642,3 +642,4 @@
{"level":"INFO","time":"2024-09-13T09:49:44.424+0800","caller":"handle/notify-handle.go:122","msg":"更新事件,状态没有变化,不做处理"}
{"level":"INFO","time":"2024-09-13T09:55:45.906+0800","caller":"init-tool/logger.go:36","msg":"init logger success"}
{"level":"INFO","time":"2024-09-13T09:55:58.758+0800","caller":"init-tool/logger.go:36","msg":"init logger success"}
{"level":"INFO","time":"2024-09-13T10:03:39.134+0800","caller":"init-tool/logger.go:36","msg":"init logger success"}
10 changes: 5 additions & 5 deletions handle/notify-handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ func (h *MyEventHandler) OnRow(e *canal.RowsEvent) error {
return nil
}

func (h *MyEventHandler) String() string {
return "MyEventHandler"
}

func NotifyHandle() {
c, err := init_tool.GoMysqlConn()
if err != nil {
Expand Down Expand Up @@ -107,7 +103,11 @@ func NotifyHandle() {
Name: pos.Name,
Pos: pos.Pos,
}
c.RunFrom(p)
err = c.RunFrom(p)
if err != nil {
zap.L().Error("启动失败", zap.Error(err))
return
}
}

func InsertHandle(newdata *model.DataChanges) {
Expand Down
11 changes: 0 additions & 11 deletions handle/timeing.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ var P = []int{NOTPROCESSEDID, PROCESSINGID}
func TimeingTasks() {
c := cron.New()
c.AddFunc("0 21 * * *", func() {
//c.AddFunc("0 21 * * *", func() {
a, err := dao.GetStatusNumByID(P)
if err != nil {
zap.L().Error("获取status_id为2的数量失败:", zap.Error(err))
//fmt.Println("sssss \n")
return
}
maps := map[int]map[int]int{}
Expand Down Expand Up @@ -62,21 +60,12 @@ func TimeingTasks() {
nowTime := time.Now().Format("2006-01-02")

content = fmt.Sprintf(content, nowTime, maps[1][2], maps[1][3], maps[2][2], maps[2][3], maps[3][2], maps[3][3])
//content := "## 事务状态统计 \n"
//content = content + "**重要未处理**:" + strconv.Itoa(int(a[0][0]))
//content = content + "**重要处理中**:" + strconv.Itoa(int(a[0][1]))
//content = content + "\n \n**中等未处理**:" + strconv.Itoa(int(a[1][0]))
//content = content + "**中等处理中**:" + strconv.Itoa(int(a[1][1]))
//content = content + "\n \n**普通未处理**:" + strconv.Itoa(int(a[2][0]))
//content = content + "**普通处理中**:" + strconv.Itoa(int(a[2][1]))
//content = content + "\n \n @所有人"

data := model.SendMsg{
Content: content,
IsAtAll: true,
MsgType: "markdown",
}
//fmt.Println(data.MsgType)
api.SendMessage(data)
})
c.Start()
Expand Down
2 changes: 1 addition & 1 deletion pos.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Name":"binlog.000022","Pos":252563}
{"Name":"binlog.000022","Pos":253812}

0 comments on commit f06e55d

Please sign in to comment.