nft task reward
This commit is contained in:
@@ -15,7 +15,7 @@ type (
|
||||
NhTaskNftStakeModel interface {
|
||||
nhTaskNftStakeModel
|
||||
withSession(session sqlx.Session) NhTaskNftStakeModel
|
||||
StakeNft(ctx context.Context, uid uint, tokens []string) error
|
||||
StakeNft(ctx context.Context, uid uint, roleId uint64, tokens []string) error
|
||||
UnStakeNft(ctx context.Context, uid uint, token string) error
|
||||
FindByUid(ctx context.Context, uid uint) ([]NhTaskNftStake, error)
|
||||
AllStakeNft(ctx context.Context) ([]NhTaskNftStake, error)
|
||||
@@ -52,10 +52,10 @@ func (m *customNhTaskNftStakeModel) UnStakeNft(ctx context.Context, uid uint, to
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *customNhTaskNftStakeModel) StakeNft(ctx context.Context, uid uint, tokens []string) error {
|
||||
insertOrUpdate := fmt.Sprintf("INSERT INTO %s (`uid`, `token_id`, `state`) VALUES (?, ?, 1) ON DUPLICATE KEY UPDATE `state` = 1", m.table)
|
||||
func (m *customNhTaskNftStakeModel) StakeNft(ctx context.Context, uid uint, roleId uint64, tokens []string) error {
|
||||
insertOrUpdate := fmt.Sprintf("INSERT INTO %s (`uid`, `token_id`, `role_id`, `state`) VALUES (?, ?, ?, 1) ON DUPLICATE KEY UPDATE `role_id` = ?, `state` = 1", m.table)
|
||||
for _, token := range tokens {
|
||||
_, err := m.conn.ExecCtx(ctx, insertOrUpdate, uid, token)
|
||||
_, err := m.conn.ExecCtx(ctx, insertOrUpdate, uid, token, roleId, roleId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user