silenceper / wechat

WeChat SDK for Go (微信SDK:简单、易用)

Home Page:https://silenceper.com/wechat/

Repository from Github https://github.comsilenceper/wechatRepository from Github https://github.comsilenceper/wechat

panic: interface conversion: interface {} is nil, not string [BUG]

poembro opened this issue · comments

描述

如何复现
步骤:
1、

关联日志信息



panic: interface conversion: interface {} is nil, not string

goroutine 214 [running]:
github.com/silenceper/wechat/v2/credential.(*DefaultAccessToken).GetAccessTokenContext(0xc00045d400, {0x10557b8, 0xc000038030})
	/home/gitlab-runner/builds/aryHxQxR/0/shangyecelue/game-lor/vendor/github.com/silenceper/wechat/v2/credential/default_access_token.go:70 +0x4dd
github.com/silenceper/wechat/v2/credential.(*DefaultAccessToken).GetAccessToken(0x7fb69a85def8?)
	/home/gitlab-runner/builds/aryHxQxR/0/shangyecelue/game-lor/vendor/github.com/silenceper/wechat/v2/credential/default_access_token.go:62 +0x27
github.com/silenceper/wechat/v2/miniprogram/subscribe.(*Subscribe).Send(0xc000400b50?, 0xda1980?)
	/home/gitlab-runner/builds/aryHxQxR/0/shangyecelue/game-lor/vendor/github.com/silenceper/wechat/v2/miniprogram/subscribe/subscribe.go:76 +0x30
game-lor/internal/common/service.(*Service).GetSubscribe(0xc00045d450, {0x10557b8?, 0xc000038038?}, 0x40?, {0xf328c5, 0x36})
	/home/gitlab-runner/builds/aryHxQxR/0/shangyecelue/game-lor/internal/common/service/wxService.go:53 +0x418
game-lor/internal/farm/service.(*Service).acreBaseConsumer(0xc000312d50, {0xc000fbd7e0, 0x14})
	/home/gitlab-runner/builds/aryHxQxR/0/shangyecelue/game-lor/internal/farm/service/acreBaseService.go:57 +0x49f
game-lor/internal/farm/service.listHandle({0x1055780, 0xc0007179a0}, {0xf099a7, 0xd}, 0xc0002ae3c0?, 0x0?)
	/home/gitlab-runner/builds/aryHxQxR/0/shangyecelue/game-lor/internal/farm/service/crontabService.go:79 +0x4de
created by game-lor/internal/farm/service.(*Service).CrontabInit
	/home/gitlab-runner/builds/aryHxQxR/0/shangyecelue/game-lor/internal/farm/service/crontabService.go:113 +0x394

使用的版本

  • SDK版本: github.com/silenceper/wechat/v2 v2.1.6-rc.2.0.20231011031010-038037b89dfc

应该是依赖的redis 有问题

#714 参考这个pr 里的说明自己实现一下redis的

@poembro

我想快速解决问题 是不是可以先用 memory 方式

我想快速解决问题 是不是可以先用 memory 方式

直接拷贝上面的代码,自己实现一个redis的缓存注入进去就可以了。

解决了。 感谢!