蛋蛋星球-客户端
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.

svc_common.go 785 B

1 month ago
1 month ago
12345678910111213141516171819202122232425262728293031
  1. package svc
  2. import (
  3. "applet/app/db"
  4. "applet/app/utils/cache"
  5. "applet/app/utils/logx"
  6. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  7. "strings"
  8. )
  9. // 简单的recover
  10. func Rev() {
  11. if err := recover(); err != nil {
  12. _ = logx.Error(err)
  13. }
  14. }
  15. func GetOssUrl(img string) string {
  16. redisConn := cache.GetPool().Get()
  17. sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn)
  18. sysCfg := sysCfgDb.SysCfgFindWithDb("file_bucket_scheme", "file_bucket_host")
  19. if strings.Contains(img, "http") == false && img != "" {
  20. img = sysCfg["file_bucket_scheme"] + "://" + sysCfg["file_bucket_host"] + img
  21. }
  22. return img
  23. }
  24. func GetSysCfgStr(key string) string {
  25. redisConn := cache.GetPool().Get()
  26. sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn)
  27. return sysCfgDb.SysCfgGetWithDb(key)
  28. }