修改抢单逻辑,去掉总金额的逻辑
This commit is contained in:
@@ -605,10 +605,7 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
||||
stoppedByMax = true;
|
||||
break;
|
||||
}
|
||||
if (maxGrabAmount != null && maxGrabAmount > 0 && successTotalAmount >= maxGrabAmount) {
|
||||
stoppedByMaxAmount = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (attemptCount >= maxAttempts) {
|
||||
stoppedByMaxAttempts = true;
|
||||
break;
|
||||
@@ -616,6 +613,10 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
||||
if (goods.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
if(goods.getPrice().intValue() >maxGrabAmount){
|
||||
log.info("跳过货品 {},因为超过最大抢单金额:{}", goods.getId(), goods.getPrice().intValue());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (goodsCoordinator != null && accountId != null
|
||||
&& !goodsCoordinator.tryAcquire(tid, goods.getId(), accountId)) {
|
||||
@@ -663,7 +664,7 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
||||
if (buyResult.success()) {
|
||||
successCount++;
|
||||
successTotalAmount += goods.getTotalMoney().intValue();
|
||||
Thread.sleep(3000);
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
failCount++;
|
||||
if (buyResult.orderAlreadyGrabbed()) {
|
||||
|
||||
Reference in New Issue
Block a user