Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[score]签到功能获取钱包余额错误 #978

Closed
vatebur opened this issue Sep 26, 2024 · 1 comment
Closed

[score]签到功能获取钱包余额错误 #978

vatebur opened this issue Sep 26, 2024 · 1 comment

Comments

@vatebur
Copy link
Member

vatebur commented Sep 26, 2024

  • 现象:生成的签到图片,钱包余额为零
  • 原因:怀疑是应为调用 wallet.InsertWalletOf 的时候使用了异步执行,锁表了。导致 wallet.GetWalletOf(uid) 因为表被锁了执行异常。
  • 版本: API修改
    可能是因为改提交给api加了锁导致了这个问题。
  • 解决办法:1.直接去掉异步执行 2.是否有必要对API进行修改?

plugin/score/sign_in.go:142

		go func() {
			err = wallet.InsertWalletOf(uid, add)
			if err != nil {
				ctx.SendChain(message.Text("ERROR: ", err))
				return
			}
		}()
		alldata := &scdata{
			drawedfile: drawedFile,
			picfile:    picFile,
			uid:        uid,
			nickname:   ctx.CardOrNickName(uid),
			inc:        add,
			score:      wallet.GetWalletOf(uid),
			level:      level,
			rank:       rank,
		}
vatebur added a commit to vatebur/ZeroBot-Plugin that referenced this issue Sep 26, 2024
vatebur added a commit to vatebur/ZeroBot-Plugin that referenced this issue Sep 26, 2024
@fumiama fumiama closed this as completed Sep 26, 2024
@fumiama
Copy link
Member

fumiama commented Sep 26, 2024

现在的sqlite实现较为原始,后续考虑彻底升级到gorm。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants