This commit is contained in:
fallen-angle
2022-01-20 16:49:37 +08:00
parent 2280679053
commit 582807ae10
13 changed files with 182 additions and 16 deletions

View File

@@ -1,8 +1,10 @@
package global
import (
"errors"
"fmt"
"nCovTrack-Backend/config"
"net/http"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
@@ -14,8 +16,21 @@ var (
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"
)