加一个字段: updateTime 更新时间

加一个字段: updateTime 更新时间

 

在更新金币前, 先取得此人的记录:

select  金币, updateTime from 表 where userid=@userId

 

更新金币:

update 表 set 金币=金币-1, update=getdate()

where userid=xxx and updateTime=xxx

 

如果返回行数为0 , 

后台记录日志:有并发更新金币的行为发生!

前端提示用户:警告:您的行为有异常

 

posted @ 2020-05-18 14:26  八英里  阅读(773)  评论(0编辑  收藏  举报