公众号
发布者:admin 发表于:443天前 阅读数:742 评论:0

开发前必读:微信公众官方文档

获取微信公众号操作对象

wc := wechat.NewWechat()
//设置全局cache,也可以单独为每个操作实例设置
redisOpts := &cache.RedisOpts{
    Host:       "127.0.0.1:6379",
}
redisCache := cache.NewRedis(redisOpts)
wc.SetCache(redisCache)
cfg := &offConfig.Config{
    AppID:     "xxx",
    AppSecret: "xxx",
    Token:     "xxx",
    //EncodingAESKey: "xxxx",
    //Cache: redisCache, //也可以单独设置
}
officialAccount := wc.GetOfficialAccount(cfg)
//TODO 使用 `officialAccount` 操作公众号相关接口