nft质押任务逻辑
This commit is contained in:
@@ -17,6 +17,7 @@ type (
|
||||
withSession(session sqlx.Session) NhNftHolderModel
|
||||
FindOtherUpdateSeq(ctx context.Context, updateSeq int) ([]*NhNftHolder, error)
|
||||
DeleteOtherUpdateSeq(ctx context.Context, updateSeq int) error
|
||||
FindTokensByAddress(ctx context.Context, address string) ([]string, error)
|
||||
}
|
||||
|
||||
customNhNftHolderModel struct {
|
||||
@@ -24,6 +25,16 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func (m *customNhNftHolderModel) FindTokensByAddress(ctx context.Context, address string) ([]string, error) {
|
||||
query := fmt.Sprintf("select `token_id` from %s where `address` = ?", m.table)
|
||||
var tokens []string
|
||||
err := m.conn.QueryRowsCtx(ctx, &tokens, query, address)
|
||||
if err != nil && !errors.Is(err, sqlx.ErrNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
return tokens, nil
|
||||
}
|
||||
|
||||
func (m *customNhNftHolderModel) DeleteOtherUpdateSeq(ctx context.Context, updateSeq int) error {
|
||||
delSql := fmt.Sprintf("delete from %s where `update_seq` != ?", m.table)
|
||||
_, err := m.conn.ExecCtx(ctx, delSql, updateSeq)
|
||||
|
||||
Reference in New Issue
Block a user