支付模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 regels
763 B

  1. package pay
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db"
  4. "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/md"
  5. "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils/cache"
  6. )
  7. var cfg = md.DBCfg{
  8. Host: "",
  9. Name: "",
  10. User: "",
  11. Psw: "",
  12. ShowLog: false,
  13. MaxLifetime: 0,
  14. MaxOpenConns: 0,
  15. MaxIdleConns: 0,
  16. Path: "",
  17. }
  18. func Init(host, name, user, psw, redisAddr string) error {
  19. cfg.Host = host
  20. cfg.Name = name
  21. cfg.User = user
  22. cfg.Psw = psw
  23. cfg.ShowLog = true
  24. cfg.MaxLifetime = 30
  25. cfg.MaxOpenConns = 100
  26. cfg.MaxIdleConns = 100
  27. cfg.Path = "./tmp/%s.logs"
  28. if err := db.InitDB(&cfg); err != nil {
  29. return err
  30. }
  31. if redisAddr != "" {
  32. cache.NewRedis(redisAddr)
  33. }
  34. return nil
  35. }