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