|
@@ -2,6 +2,7 @@ package com.game.business.controller;
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.game.business.domain.*;
|
|
|
import com.game.business.task.AppAgentGameBettingTask;
|
|
|
import com.game.business.vo.*;
|
|
@@ -20,6 +21,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -63,8 +65,8 @@ public class AppGameBettingController extends BaseController{
|
|
|
@Anonymous
|
|
|
@PostMapping(value = "/create")
|
|
|
@ApiOperation(value = "游戏下注", notes = "游戏下注")
|
|
|
- public HttpRet<Double> betting(@RequestBody AppGameBetting gameBetting)
|
|
|
- {
|
|
|
+ @DSTransactional
|
|
|
+ public HttpRet<Double> betting(@RequestBody AppGameBetting gameBetting) throws Exception {
|
|
|
|
|
|
if(gameBetting.getClassId() == null){
|
|
|
return HttpRet.fail("游戏平台ID为空。");
|
|
@@ -189,11 +191,6 @@ public class AppGameBettingController extends BaseController{
|
|
|
|
|
|
appGameBettingService.save(gameBetting);
|
|
|
|
|
|
-
|
|
|
- if(gameBetting.getBettingType() == 0){
|
|
|
- appAgentGameBettingTask.agentGameBettingTask(gameBetting);
|
|
|
- }
|
|
|
-
|
|
|
FinTranRecord finTranRecord = new FinTranRecord();
|
|
|
|
|
|
|
|
@@ -247,7 +244,13 @@ public class AppGameBettingController extends BaseController{
|
|
|
finTranRecord.setProCount(0L);
|
|
|
|
|
|
finTranRecord.setOrderId(gameBetting.getId());
|
|
|
- finTranRecordService.insertFinTranRecord(finTranRecord);
|
|
|
+
|
|
|
+ appUserService.updateUserAmount(finTranRecord);
|
|
|
+
|
|
|
+
|
|
|
+ if(gameBetting.getBettingType() == 0){
|
|
|
+ appAgentGameBettingTask.agentGameBettingTask(gameBetting);
|
|
|
+ }
|
|
|
|
|
|
return HttpRet.success("下注成功", appUser.getDiamondCoin());
|
|
|
}
|