|
@@ -142,115 +142,112 @@ public class AppGameBettingController extends BaseController{
|
|
|
if(count > 0){
|
|
|
return HttpRet.fail("游戏已开奖,无法下单。");
|
|
|
}
|
|
|
- AppUser appUser = null;
|
|
|
- synchronized (this){
|
|
|
|
|
|
- appUser = appUserService.selectAppUserByUserid(gameBetting.getUserId());
|
|
|
+ AppUser appUser = appUserService.selectAppUserByUserid(gameBetting.getUserId());
|
|
|
|
|
|
- if(appUser == null){
|
|
|
- return HttpRet.fail("用户不存在。");
|
|
|
- }
|
|
|
+ if(appUser == null){
|
|
|
+ return HttpRet.fail("用户不存在。");
|
|
|
+ }
|
|
|
|
|
|
- if(gameBetting.getBettingType() == 0){
|
|
|
+ if(gameBetting.getBettingType() == 0){
|
|
|
|
|
|
-
|
|
|
- if(gameBetting.getBettingAmount() > appUser.getDiamondCoin()){
|
|
|
- return HttpRet.fail("余额不足,投注失败。");
|
|
|
- }
|
|
|
+
|
|
|
+ if(gameBetting.getBettingAmount() > appUser.getDiamondCoin()){
|
|
|
+ return HttpRet.fail("余额不足,投注失败。");
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- appUser.setDiamondCoin(appUser.getDiamondCoin() - gameBetting.getBettingAmount());
|
|
|
- appUser.setDiamondCoinTotal(appUser.getDiamondCoinTotal() - gameBetting.getBettingAmount());
|
|
|
- appUser.setDiamondCoinCash(appUser.getDiamondCoinCash() - gameBetting.getBettingAmount());
|
|
|
- }else{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
|
|
|
-
|
|
|
- if(gameBetting.getBettingAmount() > appUser.getCoin()){
|
|
|
- return HttpRet.fail("金币不足,投注失败。");
|
|
|
- }
|
|
|
+
|
|
|
+ if(gameBetting.getBettingAmount() > appUser.getCoin()){
|
|
|
+ return HttpRet.fail("金币不足,投注失败。");
|
|
|
+ }
|
|
|
|
|
|
- appUser.setCoin(appUser.getCoin() - gameBetting.getBettingAmount());
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- if(gameBetting.getBettingAmount() > (appUser.getCoin() - appUser.getCoinCash())){
|
|
|
- appUser.setCoinCash(gameBetting.getBettingAmount() - (appUser.getCoin() - appUser.getCoinCash()));
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- appUserService.updateAppUser(appUser);
|
|
|
+
|
|
|
|
|
|
- redisCache.deleteObject("U:UserInfo:" + appUser.getUserid());
|
|
|
+
|
|
|
|
|
|
- gameBetting.setGameDate(appGame.getGameDate());
|
|
|
- gameBetting.setIsLive(0);
|
|
|
- if(gameBetting.getLiveRoomId() != null && gameBetting.getLiveUserId() != null){
|
|
|
- gameBetting.setIsLive(1);
|
|
|
- }
|
|
|
+ gameBetting.setGameDate(appGame.getGameDate());
|
|
|
+ gameBetting.setIsLive(0);
|
|
|
+ if(gameBetting.getLiveRoomId() != null && gameBetting.getLiveUserId() != null){
|
|
|
+ gameBetting.setIsLive(1);
|
|
|
+ }
|
|
|
|
|
|
- gameBetting.setCreateTime(new Date());
|
|
|
-
|
|
|
- appGameBettingService.save(gameBetting);
|
|
|
+ gameBetting.setCreateTime(new Date());
|
|
|
+
|
|
|
+ appGameBettingService.save(gameBetting);
|
|
|
|
|
|
-
|
|
|
- if(gameBetting.getBettingType() == 0){
|
|
|
- appAgentGameBettingTask.agentGameBettingTask(gameBetting);
|
|
|
- }
|
|
|
+
|
|
|
+ if(gameBetting.getBettingType() == 0){
|
|
|
+ appAgentGameBettingTask.agentGameBettingTask(gameBetting);
|
|
|
+ }
|
|
|
|
|
|
- FinTranRecord finTranRecord = new FinTranRecord();
|
|
|
+ FinTranRecord finTranRecord = new FinTranRecord();
|
|
|
|
|
|
- finTranRecord.setAfterCoin(appUser.getCoin());
|
|
|
- finTranRecord.setAfterDiamondCoin(appUser.getDiamondCoin());
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- if(gameBetting.getBettingType() == 0){
|
|
|
- finTranRecord.setCurrencyType(4);
|
|
|
- finTranRecord.setDiamondCoinChange(gameBetting.getBettingAmount());
|
|
|
- finTranRecord.setCoinChange(0.00);
|
|
|
- }else{
|
|
|
- finTranRecord.setCurrencyType(2);
|
|
|
- finTranRecord.setCoinChange(gameBetting.getBettingAmount());
|
|
|
- finTranRecord.setDiamondCoinChange(0.00);
|
|
|
- }
|
|
|
+ if(gameBetting.getBettingType() == 0){
|
|
|
+ finTranRecord.setCurrencyType(4);
|
|
|
+ finTranRecord.setDiamondCoinChange(gameBetting.getBettingAmount());
|
|
|
+ finTranRecord.setCoinChange(0.00);
|
|
|
+ }else{
|
|
|
+ finTranRecord.setCurrencyType(2);
|
|
|
+ finTranRecord.setCoinChange(gameBetting.getBettingAmount());
|
|
|
+ finTranRecord.setDiamondCoinChange(0.00);
|
|
|
+ }
|
|
|
|
|
|
- finTranRecord.setAfterMoney(0.00);
|
|
|
- finTranRecord.setMoneyChange(0.00);
|
|
|
+ finTranRecord.setAfterMoney(0.00);
|
|
|
+ finTranRecord.setMoneyChange(0.00);
|
|
|
|
|
|
- finTranRecord.setAfterTicket(0.00);
|
|
|
- finTranRecord.setTicketChange(0.00);
|
|
|
+ finTranRecord.setAfterTicket(0.00);
|
|
|
+ finTranRecord.setTicketChange(0.00);
|
|
|
|
|
|
- finTranRecord.setToUid(appUser.getUserid());
|
|
|
- finTranRecord.setUid(appUser.getUserid());
|
|
|
+ finTranRecord.setToUid(appUser.getUserid());
|
|
|
+ finTranRecord.setUid(appUser.getUserid());
|
|
|
|
|
|
- finTranRecord.setSceneId1(0L);
|
|
|
- finTranRecord.setSceneId2(null);
|
|
|
- finTranRecord.setSceneType(0L);
|
|
|
+ finTranRecord.setSceneId1(0L);
|
|
|
+ finTranRecord.setSceneId2(null);
|
|
|
+ finTranRecord.setSceneType(0L);
|
|
|
|
|
|
- finTranRecord.setTranGroupId(gameBetting.getId());
|
|
|
- finTranRecord.setTranType1(FinTranType1.U_Outcome_Balance.getType());
|
|
|
- finTranRecord.setTranType2(FinTranType2.CONSUM_GAME.getType());
|
|
|
- finTranRecord.setTranType3(FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType());
|
|
|
+ finTranRecord.setTranGroupId(gameBetting.getId());
|
|
|
+ finTranRecord.setTranType1(FinTranType1.U_Outcome_Balance.getType());
|
|
|
+ finTranRecord.setTranType2(FinTranType2.CONSUM_GAME.getType());
|
|
|
+ finTranRecord.setTranType3(FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType());
|
|
|
|
|
|
- finTranRecord.setRemarks("游戏下注");
|
|
|
+ finTranRecord.setRemarks("游戏下注");
|
|
|
|
|
|
- finTranRecord.setConsumptionCoin(gameBetting.getBettingAmount());
|
|
|
- finTranRecord.setConsumptionMoney(0.00);
|
|
|
- finTranRecord.setCommissionRelatedUid(0L);
|
|
|
- finTranRecord.setAgentId(appUser.getAgentId());
|
|
|
+ finTranRecord.setConsumptionCoin(gameBetting.getBettingAmount());
|
|
|
+ finTranRecord.setConsumptionMoney(0.00);
|
|
|
+ finTranRecord.setCommissionRelatedUid(0L);
|
|
|
+ finTranRecord.setAgentId(appUser.getAgentId());
|
|
|
|
|
|
- finTranRecord.setCreateTime(new Date());
|
|
|
+ finTranRecord.setCreateTime(new Date());
|
|
|
|
|
|
- finTranRecord.setFromUid(appUser.getUserid());
|
|
|
- finTranRecord.setGoodsId(0L);
|
|
|
- finTranRecord.setGuildId(0L);
|
|
|
- finTranRecord.setManagerCoId(0L);
|
|
|
- finTranRecord.setManagerId(0L);
|
|
|
+ finTranRecord.setFromUid(appUser.getUserid());
|
|
|
+ finTranRecord.setGoodsId(0L);
|
|
|
+ finTranRecord.setGuildId(0L);
|
|
|
+ finTranRecord.setManagerCoId(0L);
|
|
|
+ finTranRecord.setManagerId(0L);
|
|
|
|
|
|
- finTranRecord.setPerc(0.00);
|
|
|
- finTranRecord.setProId(0L);
|
|
|
- finTranRecord.setProCount(0L);
|
|
|
+ finTranRecord.setPerc(0.00);
|
|
|
+ finTranRecord.setProId(0L);
|
|
|
+ finTranRecord.setProCount(0L);
|
|
|
|
|
|
- finTranRecord.setOrderId(gameBetting.getId());
|
|
|
- finTranRecordService.insertFinTranRecord(finTranRecord);
|
|
|
- }
|
|
|
+ finTranRecord.setOrderId(gameBetting.getId());
|
|
|
+ finTranRecordService.insertFinTranRecord(finTranRecord);
|
|
|
|
|
|
return HttpRet.success("下注成功", appUser.getDiamondCoin());
|
|
|
}
|