|
@@ -2,6 +2,7 @@ package com.game.business.controller;
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import com.game.business.domain.*;
|
|
|
+import com.game.business.task.AppAgentGameBettingTask;
|
|
|
import com.game.business.vo.AppGameBettingCountVO;
|
|
|
import com.game.business.vo.AppGameBettingDetailsCountVO;
|
|
|
import com.game.business.service.*;
|
|
@@ -50,6 +51,9 @@ public class AppGameBettingController extends BaseController{
|
|
|
@Autowired
|
|
|
private IAppGameItemService appGameItemService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AppAgentGameBettingTask appAgentGameBettingTask;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
@@ -123,14 +127,27 @@ public class AppGameBettingController extends BaseController{
|
|
|
return HttpRet.fail("用户不存在。");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if(gameBetting.getBettingAmount() > appUser.getDiamondCoin()){
|
|
|
- return HttpRet.fail("余额不足,投注失败。");
|
|
|
+ if(gameBetting.getBettingType() == 0){
|
|
|
+
|
|
|
+
|
|
|
+ if(gameBetting.getBettingAmount() > appUser.getDiamondCoin()){
|
|
|
+ return HttpRet.fail("余额不足,投注失败。");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ appUser.setDiamondCoin(appUser.getDiamondCoin() - gameBetting.getBettingAmount());
|
|
|
+ appUser.setDiamondCoinTotal(appUser.getDiamondCoinTotal() - gameBetting.getBettingAmount());
|
|
|
+ }else{
|
|
|
+
|
|
|
+
|
|
|
+ if(gameBetting.getBettingAmount() > appUser.getCoin()){
|
|
|
+ return HttpRet.fail("金币不足,投注失败。");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ appUser.setCoin(appUser.getCoin() - gameBetting.getBettingAmount());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- appUser.setDiamondCoin(appUser.getDiamondCoin() - gameBetting.getBettingAmount());
|
|
|
- appUser.setDiamondCoinTotal(appUser.getDiamondCoinTotal() - gameBetting.getBettingAmount());
|
|
|
appUserService.updateAppUser(appUser);
|
|
|
|
|
|
redisCache.deleteObject("U:UserInfo:" + appUser.getUserid());
|
|
@@ -142,17 +159,27 @@ public class AppGameBettingController extends BaseController{
|
|
|
|
|
|
appGameBettingService.save(gameBetting);
|
|
|
|
|
|
+
|
|
|
+ appAgentGameBettingTask.agentGameBettingTask(gameBetting);
|
|
|
+
|
|
|
FinTranRecord finTranRecord = new FinTranRecord();
|
|
|
|
|
|
finTranRecord.setAfterCoin(appUser.getCoin());
|
|
|
- finTranRecord.setCoinChange(0.00);
|
|
|
+ finTranRecord.setAfterDiamondCoin(appUser.getDiamondCoin());
|
|
|
+
|
|
|
+ if(gameBetting.getBettingType() == 0){
|
|
|
+ finTranRecord.setCurrencyType(4L);
|
|
|
+ finTranRecord.setDiamondCoinChange(gameBetting.getBettingAmount());
|
|
|
+ finTranRecord.setCoinChange(0.00);
|
|
|
+ }else{
|
|
|
+ finTranRecord.setCurrencyType(2L);
|
|
|
+ finTranRecord.setCoinChange(gameBetting.getBettingAmount());
|
|
|
+ finTranRecord.setDiamondCoinChange(0.00);
|
|
|
+ }
|
|
|
|
|
|
finTranRecord.setAfterMoney(0.00);
|
|
|
finTranRecord.setMoneyChange(0.00);
|
|
|
|
|
|
- finTranRecord.setAfterDiamondCoin(appUser.getDiamondCoin());
|
|
|
- finTranRecord.setDiamondCoinChange(gameBetting.getBettingAmount());
|
|
|
-
|
|
|
finTranRecord.setAfterTicket(0.00);
|
|
|
finTranRecord.setTicketChange(0.00);
|
|
|
|
|
@@ -177,9 +204,7 @@ public class AppGameBettingController extends BaseController{
|
|
|
|
|
|
finTranRecord.setCreateTime(new Date());
|
|
|
|
|
|
- finTranRecord.setCurrencyType(4L);
|
|
|
-
|
|
|
- finTranRecord.setFromUid(0L);
|
|
|
+ finTranRecord.setFromUid(appUser.getUserid());
|
|
|
finTranRecord.setGoodsId(0L);
|
|
|
finTranRecord.setGuildId(0L);
|
|
|
finTranRecord.setManagerCoId(0L);
|