nft持有查询定时任务

This commit is contained in:
lianghuanjie
2024-12-23 19:59:48 +08:00
parent bbbc750af2
commit a22f73df20
18 changed files with 544 additions and 53 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"nova_task/internal/pkg/aptos"
)
var _ NhWalletModel = (*customNhWalletModel)(nil)
@@ -14,7 +15,7 @@ type (
NhWalletModel interface {
nhWalletModel
withSession(session sqlx.Session) NhWalletModel
FindWalletByAddress(ctx context.Context, address ...string) (uint, error)
FindWalletByAddress(ctx context.Context, address string) (uint, error)
}
customNhWalletModel struct {
@@ -22,10 +23,10 @@ type (
}
)
func (m *customNhWalletModel) FindWalletByAddress(ctx context.Context, address ...string) (uint, error) {
query := fmt.Sprintf("select `uid` from %s where `address` in ? limit 1", m.table)
func (m *customNhWalletModel) FindWalletByAddress(ctx context.Context, address string) (uint, error) {
query := fmt.Sprintf("select `uid` from %s where `address` = ? or `address` = ? limit 1", m.table)
var uid uint
err := m.conn.QueryRowCtx(ctx, &uid, query, address)
err := m.conn.QueryRowCtx(ctx, &uid, query, address, aptos.StrPadAptosAddress(address))
return uid, err
}