From 962c5b36b666573ab7fa574b98b665544d598919 Mon Sep 17 00:00:00 2001 From: eson Date: Tue, 15 Dec 2020 16:58:38 +0800 Subject: [PATCH] sql version => test the case of online --- collect.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/collect.go b/collect.go index e095584..e4b6d6b 100644 --- a/collect.go +++ b/collect.go @@ -59,13 +59,15 @@ func collectCopyCountLiveAnchors(cxt *WorkerContext) { } c.CountMap = string(data) - err = T.CountLiveAnchors.Create(c).Error + insertsql := fmt.Sprintf("insert ignore into %s(uid, is_counted, count_map, create_at) values(?,?,?,?)", Tables.CountLiveAnchors) + _, err = db.Exec(insertsql, c.UID, c.IsCounted, c.CountMap, c.CreateAt) + if err != nil { + switch merr := err.(*mysql.MySQLError); merr.Number { + case 1062: - switch merr := err.(*mysql.MySQLError); merr.Number { - case 1062: - - default: - log.Println(merr) + default: + log.Println(merr) + } } } }