增加软质押手动结算测试接口
This commit is contained in:
@@ -16,7 +16,7 @@ type (
|
||||
NhTaskNftStakeModel interface {
|
||||
nhTaskNftStakeModel
|
||||
withSession(session sqlx.Session) NhTaskNftStakeModel
|
||||
StakeNft(ctx context.Context, uid uint, roleId uint64, tokenId string) error
|
||||
StakeNft(ctx context.Context, uid uint, roleId uint64, tokenId string, tarotType int8) error
|
||||
UnStakeNft(ctx context.Context, uid uint, token string, isTransferOut bool) error
|
||||
FindByUid(ctx context.Context, uid uint) ([]NhTaskNftStake, error)
|
||||
AllStakeNft(ctx context.Context) ([]NhTaskNftStake, error)
|
||||
@@ -49,7 +49,7 @@ func (m *customNhTaskNftStakeModel) FindByUid(ctx context.Context, uid uint) ([]
|
||||
}
|
||||
|
||||
func (m *customNhTaskNftStakeModel) UnStakeNft(ctx context.Context, uid uint, token string, isTransferOut bool) error {
|
||||
update := fmt.Sprintf("UPDATE %s SET `state` = 0 WHERE `uid` = ? AND `token_id` = ?", m.table)
|
||||
update := fmt.Sprintf("UPDATE %s SET `state` = 0 WHERE `token_id` = ?", m.table)
|
||||
result, err := m.conn.ExecCtx(ctx, update, uid, token)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -74,9 +74,9 @@ func (m *customNhTaskNftStakeModel) UnStakeNft(ctx context.Context, uid uint, to
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *customNhTaskNftStakeModel) StakeNft(ctx context.Context, uid uint, roleId uint64, tokenId 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)
|
||||
_, err := m.conn.ExecCtx(ctx, insertOrUpdate, uid, tokenId, roleId, roleId)
|
||||
func (m *customNhTaskNftStakeModel) StakeNft(ctx context.Context, uid uint, roleId uint64, tokenId string, tarotType int8) error {
|
||||
insertOrUpdate := fmt.Sprintf("INSERT INTO %s (`uid`, `token_id`, `role_id`, `type`, `state`) VALUES (?, ?, ?, ?, 1) ON DUPLICATE KEY UPDATE `uid` = ?, `role_id` = ?, `state` = 1", m.table)
|
||||
_, err := m.conn.ExecCtx(ctx, insertOrUpdate, uid, tokenId, roleId, tarotType, uid, roleId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user