Documentation ¶
Index ¶
- Variables
- func CheckJwtToken(tokenString string) bool
- func CheckJwtTokenExpected(tokenString string) error
- func DateFormat(time time.Time) string
- func Error(r *ghttp.Request)
- func GenJwtToken(claims jwt.MapClaims) (string, error)
- func GenOpenIDToken(openID string) (string, error)
- func GenSecretToken(secret string) (string, error)
- func GenderCode() string
- func GetOpenIDFromToken(tokenString string) (string, error)
- func GetUUID() string
- func Md5(str string) string
- func ParseJwtToken(tokenString string) (*jwt.Token, error)
- func Success(r *ghttp.Request, data interface{})
- func TimeFormat(time time.Time) string
- type AdminResponse
- type AutoInc
- type GetAccessTokenResponse
- type KeyWordData
- type Miniprogram
- type Response
- type SendTemplateResponse
- type TemplateData
- type TemplateMsg
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // TokenClaimEXP 有效期标识 TokenClaimEXP = "exp" // TokenClaimOpenID 用户OpenID标识 TokenClaimOpenID = "openID" // TermOfValidity 有效期7天 TermOfValidity = 24 * 7 )
Functions ¶
func CheckJwtTokenExpected ¶
CheckJwtTokenExpected 检查token是否过期
func GenOpenIDToken ¶
GenOpenIDToken 根据OPenID生成token
func GenSecretToken ¶
GenSecretToken 根据secret生成token
func GenderCode ¶
func GenderCode() string
func GetOpenIDFromToken ¶
GetOpenIDFromToken 从token中拿到openid
func ParseJwtToken ¶
ParseJwtToken 解析token
Types ¶
type AdminResponse ¶
type AdminResponse struct { Code int `json:"code"` Data interface{} `json:"data"` Msg string `json:"msg"` }
后台的Response,为了兼容
type GetAccessTokenResponse ¶
type KeyWordData ¶
type Miniprogram ¶
type SendTemplateResponse ¶
type SendTemplateResponse struct { Errcode int `json:"errcode"` Errmsg string `json:"errmsg"` MsgID string `json:"msgid"` }
func SendTemplate ¶
func SendTemplate(msg *TemplateMsg) (*SendTemplateResponse, error)
SendTemplate 发送模板消息
type TemplateData ¶
type TemplateData struct { First KeyWordData `json:"first,omitempty"` Keyword1 KeyWordData `json:"keyword1,omitempty"` Keyword2 KeyWordData `json:"keyword2,omitempty"` Keyword3 KeyWordData `json:"keyword3,omitempty"` Keyword4 KeyWordData `json:"keyword4,omitempty"` Keyword5 KeyWordData `json:"keyword5,omitempty"` }
type TemplateMsg ¶
type TemplateMsg struct { Touser string `json:"touser"` //接收者的OpenID TemplateID string `json:"template_id"` //模板消息ID FormID string `json:"form_id"` URL string `json:"url"` //点击后跳转链接 Miniprogram Miniprogram `json:"miniprogram"` //点击跳转小程序 Data *TemplateData `json:"data"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.