加一个字段: updateTime 更新时间

 

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

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

 

更新金币:

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

where userid=xxx and updateTime=xxx

 

如果返回行数为0 , 

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

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

 

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2021-07-20
  • 2022-03-10
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-04-03
  • 2021-06-09
  • 2021-11-20
相关资源
相似解决方案