From a5c7eb46b16a7ec25b1abefb91aaf88f1a2761c5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 24 Jul 2024 12:00:24 +0800 Subject: [PATCH] 1 --- server/jccommon/dbutils.go | 21 ++++++++++++++++++++- server/jccommon/go.mod | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/server/jccommon/dbutils.go b/server/jccommon/dbutils.go index fdaf41d5..95fe1a42 100644 --- a/server/jccommon/dbutils.go +++ b/server/jccommon/dbutils.go @@ -1,11 +1,30 @@ package jccommon import ( + "q5" + "f5" ) func AddDbLog(dataSource string, logType string, subType string, params map[string]string) error { - return nil + params["type"] = logType + params["subtype"] = subType + nowTime := f5.GetApp().GetRealSeconds() + if _, ok := params["createtime"]; !ok { + params["createtime"] = q5.ToString(nowTime) + } + if _, ok := params["modifytime"]; !ok { + params["modifytime"] = q5.ToString(nowTime) + } + var resultErr error + f5.GetGoStyleDb().Insert( + dataSource, + "t_log", + [][]string{}, + func (err error, lastInsertId int64, rowsAffected int64) { + resultErr = err + }) + return resultErr } func GetDbParam(dataSource string, name string) (string, error) { diff --git a/server/jccommon/go.mod b/server/jccommon/go.mod index 3af6d5a4..bc34ff5f 100644 --- a/server/jccommon/go.mod +++ b/server/jccommon/go.mod @@ -1 +1,3 @@ -module jccommon \ No newline at end of file +module jccommon + +go 1.20 \ No newline at end of file