package wechat // Server wechat type Server struct { AppID string `json:"appid"` AppSecret string `json:"appsecret"` Token string `json:"token"` EncodingAESKey string `json:"encodingaeskey"` } // NewServer new Server func NewServer(appID, appSecret, token, encodingAESKey string) *Server { key := "wechat:server:" + appID if v, ok := cache.Load(key); ok { return v.(*Server) } s := &Server{AppID: appID, AppSecret: appSecret, Token: token, EncodingAESKey: encodingAESKey} cache.Store(key, s) return s } // Echo notify echo GET func (wc Server) Echo(s FormSignature) (data string, err error) { if ok := makeSignature(wc.Token, s.Signature, s.TimeStamp, s.Nonce); ok { data = s.Echostr } return }