From ef5283c8da07a3d7d8a589eaae7da51b3795a781 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 31 May 2022 21:16:34 +0800 Subject: [PATCH] update --- pay/init.go | 6 +++++- pay/pay_test.go | 2 +- pay/tmp/zyos_website.logs | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 pay/tmp/zyos_website.logs diff --git a/pay/init.go b/pay/init.go index ae8d935..ece853b 100644 --- a/pay/init.go +++ b/pay/init.go @@ -3,6 +3,7 @@ package pay import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db" "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/md" + "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils/cache" ) var cfg = md.DBCfg{ @@ -17,7 +18,7 @@ var cfg = md.DBCfg{ Path: "", } -func Init(host, name, user, psw string) error { +func Init(host, name, user, psw, redisAddr string) error { cfg.Host = host cfg.Name = name cfg.User = user @@ -30,5 +31,8 @@ func Init(host, name, user, psw string) error { if err := db.InitDB(&cfg); err != nil { return err } + if redisAddr != "" { + cache.NewRedis(redisAddr) + } return nil } diff --git a/pay/pay_test.go b/pay/pay_test.go index 4917fd6..f61b7e6 100644 --- a/pay/pay_test.go +++ b/pay/pay_test.go @@ -6,7 +6,7 @@ import ( ) func TestPay(t *testing.T) { - err := Init("119.23.182.117:3306", "zyos_website", "root", "Fnuo123com@") + err := Init("119.23.182.117:3306", "zyos_website", "root", "Fnuo123com@", "123132") if err != nil { t.Errorf("Reverse == %s", err) } diff --git a/pay/tmp/zyos_website.logs b/pay/tmp/zyos_website.logs new file mode 100644 index 0000000..8370d51 --- /dev/null +++ b/pay/tmp/zyos_website.logs @@ -0,0 +1,2 @@ +[xorm] [info] 2022/05/31 21:15:55.975347 [SQL] SELECT `id`, `channel_id`, `identifier`, `master_id`, `master_nickname`, `third_party_id`, `master_app_name`, `app_id` FROM `pay_channel_master` WHERE (app_id = ?) AND (identifier = ?) LIMIT 1 [35618318 mall] - 26.793ms +[xorm] [info] 2022/05/31 21:16:05.918813 [SQL] SELECT `id`, `channel_id`, `identifier`, `master_id`, `master_nickname`, `third_party_id`, `master_app_name`, `app_id` FROM `pay_channel_master` WHERE (app_id = ?) AND (identifier = ?) LIMIT 1 [35618318 mall] - 26.2782ms