libs

package
v0.0.0-...-ec88339 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitCOS

func InitCOS(c utils.COSConfig)

InitCOS 初始化对象存储

func InitEmail

func InitEmail(c utils.EmailConfig)

InitEmail 初始化邮件服务

func InitWeChat

func InitWeChat(c utils.WechatConfig)

InitWeChat 初始化微信服务

Types

type COSService

type COSService struct {
	Client *cos.Client
	URL    string
}

COSService 对象存储服务

func GetCOS

func GetCOS() *COSService

GetCOS 获取对象存储实例

func (*COSService) DeleteFile

func (s *COSService) DeleteFile(name string) error

DeleteFile 删除文件

func (*COSService) SaveBase64File

func (s *COSService) SaveBase64File(name, base string) (url string, err error)

SaveBase64File 保存 Base64 文件

func (*COSService) SaveByteFile

func (s *COSService) SaveByteFile(name string, data []byte) (url string, err error)

SaveByteFile 保存二进制文件数据

func (*COSService) SaveFile

func (s *COSService) SaveFile(name string, file multipart.File) (url string, err error)

SaveFile 保存文件

func (*COSService) SaveURLFile

func (s *COSService) SaveURLFile(name string, fileURL string) (url string, err error)

SaveURLFile 保存链接文件数据

type EmailService

type EmailService struct {
	Dialer *gomail.Dialer
	From   string
}

EmailService 邮件服务

func GetEmail

func GetEmail() *EmailService

GetEmail 获取全局邮件服务实例

func (*EmailService) SendAuthEmail

func (s *EmailService) SendAuthEmail(id primitive.ObjectID, to, code string) error

SendAuthEmail 发送认证邮件

type OAuthService

type OAuthService struct {
	API      *violet.Violet
	Callback string
}

OAuthService Violet 授权服务

func GetOAuth

func GetOAuth() *OAuthService

GetOAuth 获取授权服务

func InitViolet

func InitViolet(c utils.VioletConfig) *OAuthService

InitViolet 初始化授权服务

type WeChatError

type WeChatError struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

WeChatError 微信错误码

type WeChatMakeImageReq

type WeChatMakeImageReq struct {
	Scene string `json:"scene"`
}

WeChatMakeImageReq 生成微信小程序码请求

type WeChatService

type WeChatService struct {
	AppID        string
	AppSecret    string
	AppToken     string
	TokenExpires int64
}

WeChatService 微信小程序服务

func GetWeChat

func GetWeChat() *WeChatService

GetWeChat 获取微信服务

func (*WeChatService) GetOpenID

func (s *WeChatService) GetOpenID(code string) (string, error)

GetOpenID 获取用户 OpenID

func (*WeChatService) MakeImage

func (s *WeChatService) MakeImage(data string) (string, error)

MakeImage 生成小程序码

type WeChatSessionRes

type WeChatSessionRes struct {
	WeChatError
	OpenID     string `json:"openid"`
	SessionKey string `json:"session_key"`
	UnionID    string `json:"unionid"`
}

WeChatSessionRes 微信登陆数据

type WeChatTokenRes

type WeChatTokenRes struct {
	WeChatError
	AccessToken string `json:"access_token"`
	Expires     int64  `json:"expires_in"`
}

WeChatTokenRes 微信 Token 数据

Jump to

Keyboard shortcuts

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