helper

package
v0.0.0-...-2e70f2e Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildImage

func BuildImage(fontFile string, backgroundFile string, title string, lineString []string, outfile string) (e error)

func IsEmail

func IsEmail(str string) bool

func IsEmpty

func IsEmpty(str string) bool

func IsQQEmail

func IsQQEmail(str string) bool

func IsUrl

func IsUrl(str string) bool

func JsonDecode

func JsonDecode(jsonString string, v interface{}) error

字符串转结构体

func JsonEncode

func JsonEncode(v interface{}) string

任意结构体转json字符串

func JwtBuild

func JwtBuild(_map jwt.MapClaims) (string, error)

func JwtParse

func JwtParse(str string) (jwt.MapClaims, error)

func Md5

func Md5(str string) string

func SendEmail

func SendEmail(to string, title string, body string) error

Types

type Config

type Config struct {
	RunMode          string   `yaml:"run_mode"`           //运行模式release=生产环境 test=测试环境 debug=调试环境
	RedirectTokenUrl string   `yaml:"redirect_token_url"` //登录成功后的回调token地址 ,变量%token%
	HttpHost         string   `yaml:"http_host"`          //服务绑定地址
	HttpPort         int      `yaml:"http_port"`          //服务启动端口
	JwtKey           string   `yaml:"jwt_key"`            //jwt密钥
	NewUser          bool     `yaml:"new_user"`           //是否允许新用户使用
	NoRegisterText   string   `yaml:"noreg_text"`         //关闭注册时候的文字说明
	CurlApi          []string `yaml:"curl_api"`           //远程请求API
	Task             []string `yaml:"task"`               //任务corn触发时间
	NotifyImage      struct {
		DomainUrl      string `yaml:"domain_url"`      //可用变量 {NAME} = SaveName的值
		BackgroundFile string `yaml:"background_file"` //背景绘制图片
		FontFile       string `yaml:"font_file"`
		SaveName       string `yaml:"save_name"` //可用变量 {DATE} = 日期Y-m-d
		SavePath       string `yaml:"save_path"` //可用变量 {NAME} = SaveName的值
	} `yaml:"notify_image"`
	Smtp struct {
		Enable   bool   //是否启用
		Host     string //邮件服务器地址
		Port     int    //邮件服务器端口
		User     string //用户
		Password string //密码
		From     string //别名来源
	}
	QQOauth struct {
		ClientId     string `yaml:"client_id"`
		ClientSecret string `yaml:"client_secret"`
		RedirectUri  string `yaml:"redirect_uri"`
	}
	Mysql struct {
		Host     string
		Port     int
		Name     string
		User     string
		Password string
	}
	Redis struct {
		Host     string
		Port     int
		Password string
		Index    int
	}
	QQBot struct {
		Url               string
		QQ                string
		Key               string
		BindNotifyGroup   []string `yaml:"bind_notify_group"`   //绑定用户成功后通知的群组
		SignNotifyGroup   []string `yaml:"sign_notify_group"`   //签到成功后通知的群组
		ExpireNotifyGroup []string `yaml:"expire_notify_group"` //cookie过期后通知的群组
	}
}

func GetConfig

func GetConfig() *Config

获取配置文件

func LoadConfig

func LoadConfig() *Config

加载配置文件

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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