Commit
This commit is contained in:
@@ -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"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user