fix: 矿洞占领取24小时内的

This commit is contained in:
lianghuanjie
2025-01-18 17:57:32 +08:00
parent c457b7e87a
commit 38bb283fa1

View File

@@ -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
}