Files
nCovTrack-Backend/global/global.go
fallen-angle 582807ae10 Commit
2022-01-20 16:49:37 +08:00

37 lines
725 B
Go

package global
import (
"errors"
"fmt"
"nCovTrack-Backend/config"
"net/http"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"gorm.io/gorm"
)
var (
ServerSettings config.ServerConfig
Db *gorm.DB
RootRouter *gin.RouterGroup
Logger *zap.SugaredLogger
HttpClient map[string]*http.Client
)
func GetListenOn() string {
return fmt.Sprintf("%s:%d", ServerSettings.Listen, ServerSettings.Port)
}
func GetHttpClient(key string) (*http.Client, error) {
client := HttpClient[string(key)]
if client == nil {
return nil, errors.New("Not fount the http client: " + key)
}
return client, nil
}
const (
CHINA_NCOV_STATISTIC_URL = "https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5"
)