From 38bb283fa137729b2e95bdd4aeee103c85f27cd9 Mon Sep 17 00:00:00 2001 From: lianghuanjie Date: Sat, 18 Jan 2025 17:57:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=9F=BF=E6=B4=9E=E5=8D=A0=E9=A2=86?= =?UTF-8?q?=E5=8F=9624=E5=B0=8F=E6=97=B6=E5=86=85=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/model/nh_game_pit_model.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/model/nh_game_pit_model.go b/internal/model/nh_game_pit_model.go index efae8e1..850f7a6 100755 --- a/internal/model/nh_game_pit_model.go +++ b/internal/model/nh_game_pit_model.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/zeromicro/go-zero/core/stores/sqlx" + "time" ) var _ NhGamePitModel = (*customNhGamePitModel)(nil) @@ -23,9 +24,11 @@ type ( ) func (m *customNhGamePitModel) UserExist(ctx context.Context, uid uint) bool { - query := fmt.Sprintf("SELECT `id` FROM %s WHERE `uid` = ? LIMIT 1", m.table) + + query := fmt.Sprintf("SELECT `id` FROM %s WHERE `uid` = ? AND `created_at` > ? LIMIT 1", m.table) var id int - err := m.conn.QueryRowCtx(ctx, &id, query, uid) + t := time.Now().Add(-time.Hour * 24) + err := m.conn.QueryRowCtx(ctx, &id, query, uid, t) if err != nil { return false }