|
|
@@ -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 |
|
|
|
} |