数据库中一些简单的防刷机制
update t_userinfo set lastupdatetime = getdate() where userid = @userid and lastupdatetime < dateadd(second,-5,getdate() )
if(@@rowcount = 0 )
begin
set @outmsg = '刷新太频繁'
return
end
条件是距离上次更新必须至少多5秒
where userid = @userid and lastupdatetime < dateadd(second,-5,getdate() )
update t_userinfo set lastupdatetime = getdate() where userid = @userid and lastupdatetime < dateadd(second,-5,getdate() )
if(@@rowcount = 0 )
begin
set @outmsg = '刷新太频繁'
return
end
条件是距离上次更新必须至少多5秒
where userid = @userid and lastupdatetime < dateadd(second,-5,getdate() )