utils

package
v0.0.0-...-66c88e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 8 Imported by: 11

Documentation

Index

Constants

View Source
const (
	LoadPath         = "./conf/config.yml"
	StaticUploadPath = "static/image/"
	StaticVoicePath  = "static/voice/"
)
View Source
const (
	Success     = 2000 //成功
	Forbidden   = 4003 // 禁止访问
	Failed      = 5000 // 失败
	ServerError = 5003 // 5003服务器异常
)
View Source
const (
	ScoreFoodLook    = 1
	ScoreFoodComment = 5
	ScoreFoodCollect = 20

	ScoreDiseaseLook    = 1
	ScoreDiseaseComment = 5
	ScoreDiseaseCollect = 15

	ScoreUserLogin   = 10
	ScoreUserLook    = 1
	ScoreUserComment = 3
)
View Source
const (
	LimitUserLoginAwardDay   = 1
	LimitUserLookAwardDay    = 50
	LimitUserCommentAwardDay = 30
)
View Source
const (
	DurationUserScore = time.Hour * 24
)
View Source
const (
	RecNum = 3
)

Variables

This section is empty.

Functions

func ENV

func ENV() string

func GetCurTime

func GetCurTime() (t string)

func IsOnlineENV

func IsOnlineENV() bool

func IsStagingENV

func IsStagingENV() bool

func Load

func Load(config interface{}) error

func ScanStruct

func ScanStruct(s interface{}, excludeKey []string) map[string]interface{}

Types

type YamlFile

type YamlFile struct {
	Mysql struct {
		Database string `yaml:"Database"`
	} `yaml:"Mysql"`
	Redis struct {
		Addr     string `yaml:"Addr"`
		Password string `yaml:"Password"`
		DbToken  int    `yaml:"DbToken"`
	} `yaml:"Redis"`
	Wechat struct {
		AppID     string `yaml:"AppID"`
		AppSecret string `yaml:"AppSecret"`
	} `yaml:"Wechat"`
	Ai struct {
		ApiKey    string `yaml:"ApiKey"`
		SecretKey string `yaml:"SecretKey"`
	} `yaml:"Ai"`
}
var (
	ConfigInstance *YamlFile
)

func InitConfig

func InitConfig() (YamlFile, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL