From 61034a562942e28d1aaea77f2794c40e79e56ccf Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Tue, 15 Jun 2021 11:41:31 +0800 Subject: [PATCH] Update russian_user.py --- models/russian_user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/russian_user.py b/models/russian_user.py index c281f067..7aadf860 100644 --- a/models/russian_user.py +++ b/models/russian_user.py @@ -53,7 +53,7 @@ class RussianUser(db.Model): try: user = await cls.query.where( (cls.user_qq == user_qq) & (cls.group_id == group_id) - ).gino.first() + ).with_for_update().gino.first() if not user: user = await cls.create( user_qq=user_qq, @@ -66,7 +66,7 @@ class RussianUser(db.Model): elif itype == 'lose': await user.update( lose_money=user.lose_money + count, - ).with_for_update().apply() + ).apply() return True except Exception: return False