@@ -3,6 +3,7 @@ package pay | |||||
import ( | import ( | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db" | "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/md" | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils/cache" | |||||
) | ) | ||||
var cfg = md.DBCfg{ | var cfg = md.DBCfg{ | ||||
@@ -17,7 +18,7 @@ var cfg = md.DBCfg{ | |||||
Path: "", | Path: "", | ||||
} | } | ||||
func Init(host, name, user, psw string) error { | |||||
func Init(host, name, user, psw, redisAddr string) error { | |||||
cfg.Host = host | cfg.Host = host | ||||
cfg.Name = name | cfg.Name = name | ||||
cfg.User = user | cfg.User = user | ||||
@@ -30,5 +31,8 @@ func Init(host, name, user, psw string) error { | |||||
if err := db.InitDB(&cfg); err != nil { | if err := db.InitDB(&cfg); err != nil { | ||||
return err | return err | ||||
} | } | ||||
if redisAddr != "" { | |||||
cache.NewRedis(redisAddr) | |||||
} | |||||
return nil | return nil | ||||
} | } |
@@ -6,7 +6,7 @@ import ( | |||||
) | ) | ||||
func TestPay(t *testing.T) { | 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 { | if err != nil { | ||||
t.Errorf("Reverse == %s", err) | t.Errorf("Reverse == %s", err) | ||||
} | } | ||||
@@ -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 |