|
@@ -316,6 +316,19 @@ public class UserServiceImpl implements IUserService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
+ if(bo.getType()==2){
|
|
|
|
|
+ //判断道具数量是否充足
|
|
|
|
|
+ PlayerItems playerItem = new PlayerItems();
|
|
|
|
|
+ playerItem.setPlayerId(bo.getUserId());
|
|
|
|
|
+ playerItem.setItemId(bo.getItemId().longValue());
|
|
|
|
|
+
|
|
|
|
|
+ PlayerItemsVo playerItemsVos = playerItemsMapper.selectPlayerItems(playerItem);
|
|
|
|
|
+ if (playerItemsVos == null || playerItemsVos.getQuantity() < bo.getQuantity()) {
|
|
|
|
|
+ throw new RuntimeException("道具数量不足");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 3. 记录日志
|
|
// 3. 记录日志
|
|
|
logRewardDistribution(bo);
|
|
logRewardDistribution(bo);
|
|
|
|
|
|
|
@@ -326,6 +339,7 @@ public class UserServiceImpl implements IUserService {
|
|
|
if (updateCount <= 0) {
|
|
if (updateCount <= 0) {
|
|
|
throw new RuntimeException("道具发放失败");
|
|
throw new RuntimeException("道具发放失败");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
redisUtil.publish("channel:item_updates", bo.getUserId());
|
|
redisUtil.publish("channel:item_updates", bo.getUserId());
|
|
|
return Boolean.TRUE;
|
|
return Boolean.TRUE;
|
|
|
|
|
|