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

@@ -53,15 +53,35 @@ func (m *customNhPromoteBindModel) FindRequirePushUser(ctx context.Context, shar
}
func (m *customNhPromoteBindModel) UpdatePushUser(ctx context.Context, id uint) error {
update := fmt.Sprintf("update %s set `is_push_user` = 1 where `id` = ?", m.table)
_, err := m.conn.ExecCtx(ctx, update, id)
return err
update := fmt.Sprintf("update %s set `is_push_user` = 1 where `id` = ? and `is_push_user` = 0", m.table)
result, err := m.conn.ExecCtx(ctx, update, id)
if err != nil {
return err
}
row, err := result.RowsAffected()
if err != nil {
return err
}
if row == 0 {
return ErrNoRowUpdate
}
return nil
}
func (m *customNhPromoteBindModel) UpdatePushRole(ctx context.Context, id uint) error {
update := fmt.Sprintf("update %s set `is_push_role` = 1 where `id` = ?", m.table)
_, err := m.conn.ExecCtx(ctx, update, id)
return err
update := fmt.Sprintf("update %s set `is_push_role` = 1 where `id` = ? and `is_push_role` = 0", m.table)
result, err := m.conn.ExecCtx(ctx, update, id)
if err != nil {
return err
}
row, err := result.RowsAffected()
if err != nil {
return err
}
if row == 0 {
return ErrNoRowUpdate
}
return nil
}
func (m *customNhPromoteBindModel) UserInviteCount(ctx context.Context, uid uint) (int64, error) {