package global import ( "errors" "fmt" "github.com/baidubce/bce-sdk-go/services/bos" "github.com/gin-gonic/gin" "github.com/go-redis/redis" "go.uber.org/zap" "gorm.io/gorm" "net/http" ) var ( ServerSettings ServerConfig Db *gorm.DB RootRouter *gin.RouterGroup Logger *zap.SugaredLogger HttpClient map[string]*http.Client Redis *redis.Client BosClient *bos.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://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf" CHINA_NCOV_STATISTIC_TREND_URL = "https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=chinaDayList,chinaDayAddList" ENV_NOLOG = "nolog" TOKEN_EXPIRE_DAYS = 15 FACKER_HOST = "http://myhost.fallen-angle.com:5000/" REGISTER_REDIS_KEY = "register_key" CHANGEPWD_REDIS_KEY = "changepwd_key" ) var ( ID_ROLE_MAP = map[int]string{ 0: "SYSTEM", 4: "VOLUNTEER", 8: "WORKER", 12: "ADMIN", } ROLE_ID_MAP = map[string]int{ "SYSTEM": 0, "VOLUNTEER": 4, "WORKER": 8, "ADMIN": 12, } HEALTH_SITUATION_ID_MAP = map[string]int{ "OTHER": 0, "PATIENT": 1, "CONTACT": 2, "SUB_CONTACT": 3, } MEASURE_SITUATION_ID_MAP = map[string]int{ "NO_MEASURE": 0, "NO_RISK": 1, "TREATING": 2, "CENTRALIZED": 3, "HOME": 4, } PCR_RESULT_ID_MAP = map[string]int{ "NONE": 0, "NEGATIVE": 1, "POSITIVE": 2, } KafkaProducerChan = make(chan []byte) )