feat: temp upload

This commit is contained in:
fallen-angle
2022-04-13 19:48:10 +08:00
parent 80ca1cd46e
commit fc347a4140
15 changed files with 155 additions and 8 deletions

48
global/config.go Normal file
View File

@@ -0,0 +1,48 @@
package global
type ServerConfig struct {
Listen string `yaml:"listen"`
Port int `yaml:"port"`
Name string `yaml:"name"`
Env string `yaml:"env"`
UrlPrefix string `yaml:"urlPrefix"`
LogPath string `yaml:"logPath"`
MySQL MySQLConfig `yaml:"mysql"`
Redis RedisConfig `yaml:"redis"`
Jwt JwtConfig `yaml:"jwt"`
Email EmailConfig `yaml:"email"`
Bos BosConfig `yaml:"bos"`
}
type MySQLConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Database string `yaml:"database"`
}
type RedisConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Password string `yaml:"password"`
}
type JwtConfig struct {
Secret string `yaml:"secret"`
RenewExpireDays uint `yaml:"renewExpireDays"`
RenewAheadDays uint `yaml:"renewAheadDays"`
}
type EmailConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Account string `yaml:"account"`
Password string `yaml:"password"`
}
type BosConfig struct {
AccessKey string `yaml:"accessKey"`
SecretKey string `yaml:"secretKey"`
Domain string `yaml:"domain"`
}

View File

@@ -3,7 +3,7 @@ package global
import (
"errors"
"fmt"
"nCovTrack-Backend/config"
"github.com/baidubce/bce-sdk-go/services/bos"
"net/http"
"github.com/gin-gonic/gin"
@@ -13,12 +13,13 @@ import (
)
var (
ServerSettings config.ServerConfig
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 {
@@ -37,7 +38,14 @@ const (
CHINA_NCOV_STATISTIC_URL = "https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5"
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 (
ROLE_ID_MAP = map[int]string{
0: "SYSTEM",
}
)