123333
This commit is contained in:
@@ -147,20 +147,24 @@ public class RoomService {
|
||||
|
||||
public Long canCallTime(Room room) {
|
||||
try {
|
||||
Long callId = room.getCallUserData().getId();
|
||||
Account account = accountService.getByUserId(callId);
|
||||
Long userId = room.getCallUserData().getId();
|
||||
Account account = accountService.getByUserId(userId);
|
||||
if(account == null){
|
||||
return 0L;
|
||||
}
|
||||
RoomData roomData = room.getRoomData();
|
||||
long blockAmount = roomData.getPayCoin() + roomData.getPayIncome();
|
||||
long totalAmount = account.getCoin()+account.getIncomeCoin() + blockAmount;
|
||||
long totalSecond = (totalAmount / roomData.getCallPrice()) / 60;
|
||||
long totalSecond = (totalAmount / roomData.getCallPrice()) * 60;
|
||||
long useTime = 0;
|
||||
if(roomData.getBeginTime() != null){
|
||||
useTime = DateUtil.currentSeconds() - roomData.getBeginTime();
|
||||
}
|
||||
return totalSecond - useTime;
|
||||
long canCallTime = totalSecond - useTime;
|
||||
if(canCallTime < 0){
|
||||
return 0L;
|
||||
}
|
||||
return canCallTime;
|
||||
}catch (Exception e){
|
||||
log.error("计算可通话时间失败!",e);
|
||||
return 0L;
|
||||
|
||||
Reference in New Issue
Block a user