Преглед изворни кода

Merge remote-tracking branch 'origin/master'

kk пре 1 месец
родитељ
комит
7419e65694

+ 1 - 1
game-admin/src/main/resources/application.yml

@@ -146,4 +146,4 @@ websocket:
 
 #定时任务开关
 task:
-  switch: false
+  switch: true

+ 38 - 7
game-business/src/main/java/com/game/business/controller/AppGameLotteryController.java

@@ -1,5 +1,6 @@
 package com.game.business.controller;
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.game.business.domain.AppGame;
@@ -18,6 +19,7 @@ import com.game.business.vo.AppGameLotteryVO;
 import com.game.business.vo.AppUserAgentVO;
 import com.game.common.annotation.Anonymous;
 import com.game.common.annotation.Log;
+import com.game.common.annotation.RepeatSubmit;
 import com.game.common.core.controller.BaseController;
 import com.game.common.core.domain.HttpRet;
 import com.game.common.core.domain.HttpRetPageArr;
@@ -181,16 +183,16 @@ public class AppGameLotteryController extends BaseController{
     @PostMapping("/addLottery")
     @ApiOperation(value = "手动开奖", notes = "手动开奖")
     @Log(title = "手动开奖", businessType = BusinessType.UPDATE)
-    public HttpRet<Boolean> addLottery(@RequestBody AppGameLottery appGameLottery) throws Exception {
+    public R<Boolean> addLottery(@RequestBody AppGameLottery appGameLottery) throws Exception {
 
         Long userId = SecurityUtils.getUserId();
 
         if(userId == null){
-            return HttpRet.fail("权限不足,请联系管理员");
+            return R.fail("权限不足,请联系管理员");
         }
 
         if(userId != 10013 && SecurityUtils.getLoginUser().isBusUser()){ //app用户只有10013能发
-            return HttpRet.fail("权限不足,请联系管理员");
+            return R.fail("权限不足,请联系管理员");
         }
 
         if(StringUtils.isNotBlank(appGameLottery.getGameDate())){
@@ -199,11 +201,17 @@ public class AppGameLotteryController extends BaseController{
 
         AppGameLottery dbAppGameLottery = appGameLotteryService.selectLottery(appGameLottery.getClassId(), appGameLottery.getGameId(), appGameLottery.getGameDate());
         if(dbAppGameLottery != null && dbAppGameLottery.getIsLottery() == 1){
-            return HttpRet.fail("该游戏,当前期已自动开奖过了,不能手动开奖");
+            return R.fail("该游戏,当前期已自动开奖过了,不能手动开奖");
         }
 
         appGameLottery.setIsLottery(1);
-        appGameLottery.setGameRecordDate(new Date());
+        String time = DateUtil.format(new Date(),"yyyy-").concat(appGameLottery.getGameDate());
+        if(time.split("\\:").length > 2){
+            appGameLottery.setGameRecordDate(DateUtil.parse(time,"yyyy-MM-dd HH:mm:ss"));
+        }else{
+            appGameLottery.setGameRecordDate(DateUtil.parse(time,"yyyy-MM-dd HH:mm"));
+        }
+
         boolean flg = false;
         if(dbAppGameLottery == null){
             flg = appGameLotteryService.save(appGameLottery);
@@ -211,14 +219,25 @@ public class AppGameLotteryController extends BaseController{
             AppGameLottery updateAppGameLottery = new AppGameLottery();
             updateAppGameLottery.setId(dbAppGameLottery.getId());
             updateAppGameLottery.setIsLottery(1);
-            updateAppGameLottery.setGameRecordDate(new Date());
+            updateAppGameLottery.setGameRecordDate(appGameLottery.getGameRecordDate());
             updateAppGameLottery.setGameLotterySucc(appGameLottery.getGameLotterySucc());
             flg =appGameLotteryService.updateById(updateAppGameLottery);
         }
         if(flg){
             appGameLotteryTask.updateLottery(appGameLottery);
         }
-        return HttpRet.success("手动开奖成功",true);
+        return R.ok(true,"手动开奖成功");
+    }
+
+
+    @PostMapping("/leakLottery")
+    @ApiOperation(value = "修补数据", notes = "修补数据")
+    @Log(title = "修补数据", businessType = BusinessType.UPDATE)
+    @RepeatSubmit(message = "频繁操作,请稍后再试")
+    public R leakLottery() throws Exception {
+
+        appGameLotteryService.leakLottery();
+        return R.ok(true,"修补数据成功");
     }
 
     /**
@@ -248,6 +267,17 @@ public class AppGameLotteryController extends BaseController{
         util.exportExcel(response, list, "游戏开奖记录数据");
     }
 
+    /**
+     * 获取游戏开奖记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:lottery:query')")
+    @GetMapping(value = "/lotteryInfo/{id}")
+    @ApiOperation(value = "查询漏奖数据", notes = "查询漏奖数据")
+    public R<AppGameLottery> lotteryInfo(@PathVariable("id") Long id)
+    {
+        return R.ok(appGameLotteryService.leakInfo(id));
+    }
+
     /**
      * 获取游戏开奖记录详细信息
      */
@@ -294,4 +324,5 @@ public class AppGameLotteryController extends BaseController{
     {
         return R.ok(appGameLotteryService.deleteAppGameLotteryByIds(ids));
     }
+
 }

+ 21 - 0
game-business/src/main/java/com/game/business/mapper/AppGameLotteryMapper.java

@@ -2,6 +2,7 @@ package com.game.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.game.business.domain.AppGameLottery;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -55,4 +56,24 @@ public interface AppGameLotteryMapper extends BaseMapper<AppGameLottery> {
      */
     public int deleteAppGameLotteryByIds(Long[] ids);
 
+    /**
+     * 查询遗漏数据
+     * */
+    public List<AppGameLottery> selectLeakLottery(@Param("time") String time);
+
+    /**
+     * 查询遗漏数据2
+     * */
+    public List<AppGameLottery> selectLeakLottery2(@Param("time") String time);
+
+    /**
+     * 查询遗漏数据
+     * */
+    public AppGameLottery leakInfo(@Param("gameId") Long gameId, @Param("gameDate") String gameDate);
+
+    /**
+     * 查询遗漏数据
+     * */
+    public AppGameLottery leakInfo2(@Param("gameId") Long gameId, @Param("gameDate") String gameDate);
+
 }

+ 10 - 0
game-business/src/main/java/com/game/business/service/IAppGameLotteryService.java

@@ -65,4 +65,14 @@ public interface IAppGameLotteryService extends IService<AppGameLottery> {
      * @return 结果
      */
     public int deleteAppGameLotteryById(Long id);
+
+    /**
+     * 自动修改遗漏数据
+     * */
+    public void leakLottery();
+
+    /**
+     * 查询漏奖数据
+     * */
+    public AppGameLottery leakInfo(Long id);
 }

+ 64 - 0
game-business/src/main/java/com/game/business/service/impl/AppGameLotteryServiceImpl.java

@@ -1,13 +1,17 @@
 package com.game.business.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.game.business.domain.AppGameLottery;
 import com.game.business.mapper.AppGameLotteryMapper;
 import com.game.business.service.IAppGameLotteryService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import java.util.Date;
 
 import java.util.List;
 
@@ -116,4 +120,64 @@ public class AppGameLotteryServiceImpl extends ServiceImpl<AppGameLotteryMapper,
     public int deleteAppGameLotteryById(Long id) {
         return appGameLotteryMapper.deleteAppGameLotteryById(id);
     }
+
+    @Override
+    public void leakLottery() {
+        String time = DateUtil.format(DateUtil.offsetMinute(new Date(), -5),"yyyy-MM-dd HH:mm:ss");
+        List<AppGameLottery> list = appGameLotteryMapper.selectLeakLottery(time);
+        if(null != list && list.size() > 0) {
+            list.forEach(e->{
+                if(null != e.getGameId() && StringUtils.isNotBlank( e.getGameDate())){
+                    LambdaQueryWrapper<AppGameLottery> queryWrapper = new LambdaQueryWrapper<>();
+                    queryWrapper.eq(AppGameLottery::getGameId, e.getGameId());
+                    queryWrapper.eq(AppGameLottery::getGameDate, e.getGameDate());
+                    if(null == appGameLotteryMapper.selectOne(queryWrapper)){
+                        AppGameLottery insert = new AppGameLottery();
+                        BeanUtils.copyProperties(e,insert);
+                        insert.setId(null);
+                        insert.setIsLottery(0);//设置为未开奖
+                        insertAppGameLottery(insert);
+                    }
+                }
+            });
+        }
+        List<AppGameLottery> list2 = appGameLotteryMapper.selectLeakLottery2(time);
+        if(null != list2 && list2.size() > 0) {
+            list2.forEach(e->{
+                if(null != e.getGameId() && StringUtils.isNotBlank( e.getGameDate())){
+                    LambdaQueryWrapper<AppGameLottery> queryWrapper = new LambdaQueryWrapper<>();
+                    queryWrapper.eq(AppGameLottery::getGameId, e.getGameId());
+                    queryWrapper.eq(AppGameLottery::getGameDate, e.getGameDate());
+                    if(null == appGameLotteryMapper.selectOne(queryWrapper)){
+                        AppGameLottery insert = new AppGameLottery();
+                        BeanUtils.copyProperties(e,insert);
+                        insert.setId(null);
+                        insert.setIsLottery(0);//设置为未开奖
+                        insertAppGameLottery(insert);
+                    }
+                }
+            });
+        }
+    }
+
+    @Override
+    public AppGameLottery leakInfo(Long id) {
+        AppGameLottery reslut = null;
+        AppGameLottery appGameLottery = selectAppGameLotteryById(id);
+        if(null == appGameLottery){
+            return reslut;
+        }
+        reslut = new AppGameLottery();
+        BeanUtils.copyProperties(appGameLottery,reslut);
+        AppGameLottery history = appGameLotteryMapper.leakInfo(reslut.getGameId(),reslut.getGameDate());
+        if(null != history){
+            reslut.setGameLotterySucc(history.getGameLotterySucc());
+        }else{
+            AppGameLottery history2 = appGameLotteryMapper.leakInfo2(reslut.getGameId(),reslut.getGameDate());
+            if(null != history2){
+                reslut.setGameLotterySucc(history2.getGameLotterySucc());
+            }
+        }
+        return reslut;
+    }
 }

+ 13 - 8
game-business/src/main/java/com/game/business/service/impl/AppUserServiceImpl.java

@@ -183,9 +183,11 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
         int finRes = 0;
         RLock rLock = redisson.getLock("app_user_amount_".concat(String.valueOf(finTranRecord.getUid())));
         boolean tryLock = false;
+        boolean hasLock = false;
         try {
             tryLock = rLock.tryLock(10L,10L, TimeUnit.SECONDS); //等待10秒 最多持有锁10秒
             if(tryLock){
+                hasLock = true;
                 AppUser appUser = appUserMapper.selectAppUserByUserid(finTranRecord.getUid());
                 if(null != appUser){
                     AppUser updateAppUser = new AppUser();
@@ -223,17 +225,19 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
                     }
                 }
             }else{
-                log.info("用户{}钱包更新失败:{}",finTranRecord.getUid(),tryLock);
+                //获取锁失败则递归再次调用
+                log.info("更新钱包等待超时,再次重试");
+                updateUserAmount(finTranRecord,withdrawAble,coinCashFlag);
             }
         } catch (InterruptedException e) {
             log.info("用户{}钱包更新失败:{}",finTranRecord.getUid(),e);
         } finally {
-            if(finRes < 1){
+            if(finRes < 1 && hasLock){
                 String params = "";
                 if(null != finTranRecord){
                     params = JSONObject.toJSONString(finTranRecord);
                 }
-                log.info("res:{},finRes:{},更新失败:{}",res,finRes,params);
+                log.info("res:{},finRes:{},更新失败:{},hasLock",res,finRes,params,hasLock);
                 throw new ServiceException("更新失败");
             }
             rLock.unlock();
@@ -269,16 +273,17 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
             if(tryLock){
                 AppUser appUser = selectAppUserByUserid(userId);
                 return appUser;
+            }else{
+                return getUserAsset(userId);
             }
-            rLock.unlock();
         }catch (Exception e){
             log.info("获取用户资产出错:{}",e);
             return null;
+        }finally {
+            if(null != rLock){
+                rLock.unlock();
+            }
         }
-        if(null != rLock){
-            rLock.unlock();
-        }
-        return null;
     }
 
     @Override

+ 91 - 54
game-business/src/main/java/com/game/business/task/AppUserCountTask.java

@@ -20,6 +20,8 @@ import com.game.common.utils.DateUtils;
 import com.game.common.utils.StringUtils;
 import com.game.system.service.ISysConfigService;
 import lombok.extern.log4j.Log4j2;
+import org.redisson.api.RLock;
+import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -76,6 +78,9 @@ public class AppUserCountTask {
     @Value("${task.switch}")
     private Boolean taskSwitch;
 
+    @Autowired
+    private RedissonClient redissonClient;
+
 
     /**
      * 统计用户前一天
@@ -644,7 +649,7 @@ public class AppUserCountTask {
         //查询是否有该时间段以外的开奖
         int count = appGameBettingService.selectBettingCount(userId,beginDate,endDate);
         //资产为0 则充值两倍流水条件设为已作废
-        if(null != appUser && appUser.getDiamondCoin().doubleValue() < 1 && count < 1){
+        if(null != appUser && appUser.getDiamondCoin().doubleValue() <= 0 && count < 1){
             //更新为已满足提现
 //            userChargeList.forEach(e->{
                 /*FinTranRecord updateTran = new FinTranRecord();
@@ -659,7 +664,7 @@ public class AppUserCountTask {
         }else{
             //查询本次充值到下次充值期间资产除去返佣后是否已归零
             double amount  = finTranRecordService.sumUserRechareTran(userId,beginDate,endDate);
-            if(amount < 1 && count < 1){
+            if(amount <= 0 && count < 1){
                /* FinTranRecord updateTran = new FinTranRecord();
                 updateTran.setId(tranRecord.getId());
                 updateTran.setWithdrawFlag(2);
@@ -714,60 +719,38 @@ public class AppUserCountTask {
         if(null != chargeList && chargeList.size() > 0){
             Map<Long, List<FinTranRecord>> chargeMap = chargeList.stream().collect(Collectors.groupingBy(FinTranRecord::getUid));
             for(Long uid : chargeMap.keySet()) {
-                int i = 1;
-                double withdrawAble = 0;
-                List<FinTranRecord> tranRecordList = chargeMap.get(uid);
-                tranRecordList = tranRecordList.stream().sorted(Comparator.comparing(FinTranRecord::getCreateTime)).collect(Collectors.toList());
-                Date beginDate = null;
-                Date endDate = null;
-                for (FinTranRecord finTranRecord : tranRecordList) {
-                    if(null == beginDate) {
-                        beginDate = finTranRecord.getCreateTime();
-                    }
-                    if (tranRecordList.size() > i) {
-                        endDate = new Date(chargeList.get(i).getCreateTime().getTime() - 1);
-                    }else{
-                        //查询用户是否还有未满足提现的充值
-                        List<FinTranRecord> curChargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(),chargeType3,finTranRecord.getUid(),finTranRecord.getCreateTime(),null,0);
-                        if(null != curChargeList && curChargeList.size() > 0){
-                            endDate = curChargeList.get(0).getCreateTime();
-                        }else{
-                            endDate = new Date();
-                        }
-
-                    }
-                    i++;
-
-                }
-                //查询用户这段时间流水记录
-                /*List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, uid, null, endDate, null);
-                withdrawAble += curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
-                withdrawAble = finTranRecordService.sumUserTran(null, null, uid, null, endDate, null);
-                AppUser updateUser = new AppUser();
-                updateUser.setUserid(uid);
-                updateUser.setWithdrawAble(withdrawAble);
-                appUserService.updateAppUser(updateUser);
-                log.info("用户{},可提现额度{}",uid,withdrawAble);
-                //清除用户缓存
-                redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(uid)));
+                dealWithdraw(uid,chargeMap,chargeList,chargeType3);
             }
         }else if(null != userId){
-            //查询所有未满足提现的充值、转账
-            List<FinTranRecord> notchargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(),chargeType3,userId,null,null,0);
-            if(null != notchargeList && notchargeList.size() > 0) {
-                log.info("用户{},有为满足提现订单,停止更新可提现余额",userId);
-            }else{
-                //查询用户这段时间流水记录
-               /* List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, userId, null, null, null);
-                double withdrawAble = curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
-                double withdrawAble = finTranRecordService.sumUserTran(null, null, userId, null, null, null);
-                AppUser updateUser = new AppUser();
-                updateUser.setUserid(userId);
-                updateUser.setWithdrawAble(withdrawAble);
-                appUserService.updateAppUser(updateUser);
-                log.info("用户{},可提现额度{}",userId,withdrawAble);
-                //清除用户缓存
-                redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(userId)));
+            RLock rLock = redissonClient.getLock("app_user_amount_".concat(String.valueOf(userId)));
+            boolean tryLock = false;
+            try {
+                tryLock = rLock.tryLock(20,10, TimeUnit.SECONDS);
+            } catch (InterruptedException e) {
+                log.info("更新用户可提现余额失败:{}",e);
+                throw new RuntimeException(e);
+            }
+            if(tryLock){
+                //查询所有未满足提现的充值、转账
+                List<FinTranRecord> notchargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(),chargeType3,userId,null,null,0);
+                if(null != notchargeList && notchargeList.size() > 0) {
+                    log.info("用户{},有为满足提现订单,停止更新可提现余额",userId);
+                }else{
+                    //查询用户这段时间流水记录
+                   /* List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, userId, null, null, null);
+                    double withdrawAble = curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
+                    double withdrawAble = finTranRecordService.sumUserTran(null, null, userId, null, null, null);
+                    AppUser updateUser = new AppUser();
+                    updateUser.setUserid(userId);
+                    updateUser.setWithdrawAble(withdrawAble);
+                    appUserService.updateAppUser(updateUser);
+                    log.info("用户{},可提现额度{}",userId,withdrawAble);
+                    //清除用户缓存
+                    redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(userId)));
+                    if(null != rLock){
+                        rLock.unlock();
+                    }
+                }
             }
         }
     }
@@ -813,4 +796,58 @@ public class AppUserCountTask {
 //            userChargeList.clear();
         }
     }
+
+    private void dealWithdraw(Long uid,Map<Long, List<FinTranRecord>> chargeMap,List<FinTranRecord> chargeList,String chargeType3){
+        RLock rLock = redissonClient.getLock("app_user_amount_".concat(String.valueOf(uid)));
+        boolean tryLock = false;
+        try {
+            tryLock = rLock.tryLock(10,10, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+            log.info("更新提现余额失败: {}",e);
+            throw new RuntimeException(e);
+        }
+        if(tryLock) {
+            int i = 1;
+            double withdrawAble = 0;
+            List<FinTranRecord> tranRecordList = chargeMap.get(uid);
+            tranRecordList = tranRecordList.stream().sorted(Comparator.comparing(FinTranRecord::getCreateTime)).collect(Collectors.toList());
+            Date beginDate = null;
+            Date endDate = null;
+            for (FinTranRecord finTranRecord : tranRecordList) {
+                if (null == beginDate) {
+                    beginDate = finTranRecord.getCreateTime();
+                }
+                if (tranRecordList.size() > i) {
+                    endDate = new Date(chargeList.get(i).getCreateTime().getTime() - 1);
+                } else {
+                    //查询用户是否还有未满足提现的充值
+                    List<FinTranRecord> curChargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(), chargeType3, finTranRecord.getUid(), finTranRecord.getCreateTime(), null, 0);
+                    if (null != curChargeList && curChargeList.size() > 0) {
+                        endDate = curChargeList.get(0).getCreateTime();
+                    } else {
+                        endDate = new Date();
+                    }
+
+                }
+                i++;
+
+            }
+            //查询用户这段时间流水记录
+                    /*List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, uid, null, endDate, null);
+                    withdrawAble += curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
+            withdrawAble = finTranRecordService.sumUserTran(null, null, uid, null, endDate, null);
+            AppUser updateUser = new AppUser();
+            updateUser.setUserid(uid);
+            updateUser.setWithdrawAble(withdrawAble);
+            appUserService.updateAppUser(updateUser);
+            log.info("用户{},可提现额度{}", uid, withdrawAble);
+            //清除用户缓存
+            redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(uid)));
+            if(null != rLock){
+                rLock.unlock();
+            }
+        }else{
+            dealWithdraw(uid,chargeMap,chargeList,chargeType3);
+        }
+    }
 }

+ 24 - 0
game-business/src/main/resources/mapper/business/AppGameLotteryMapper.xml

@@ -79,4 +79,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="selectLeakLottery" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history
+                 where is_lottery != 0
+                 and  CONCAT(game_id,'_',game_date) in (select CONCAT(game_id,'_',game_date) from app_game_lottery where is_lottery = 0)
+                 and game_record_date &lt;= #{time}
+    </select>
+
+    <select id="selectLeakLottery2" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history2
+                 where is_lottery != 0
+                 and  CONCAT(game_id,'_',game_date) in (select CONCAT(game_id,'_',game_date) from app_game_lottery where is_lottery = 0)
+                 and game_record_date &lt;= #{time}
+    </select>
+
+    <select id="leakInfo" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history
+                 where game_id = #{gameId} and game_date = #{gameDate}
+    </select>
+
+    <select id="leakInfo2" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history2
+                 where game_id = #{gameId} and game_date = #{gameDate}
+    </select>
 </mapper>

+ 16 - 0
game-ui/src/api/business/lottery.js

@@ -26,6 +26,14 @@ export function getLottery(id) {
   })
 }
 
+// 查询游戏开奖记录详细
+export function lotteryInfo(id) {
+  return request({
+    url: '/business/lottery/lotteryInfo/' + id,
+    method: 'get'
+  })
+}
+
 // 新增游戏开奖记录
 export function addLottery(data) {
   return request({
@@ -44,6 +52,14 @@ export function kjLottery(data) {
   })
 }
 
+// 修补数据
+export function leakLottery() {
+  return request({
+    url: '/business/lottery/leakLottery',
+    method: 'post'
+  })
+}
+
 // 修改游戏开奖记录
 export function updateLottery(data) {
   return request({

+ 71 - 4
game-ui/src/views/business/lottery/index.vue

@@ -63,6 +63,15 @@
           @click="handleKj"
         >手动开奖</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handLeakLottery"
+        >修补开奖数据(10分钟之前的数据)</el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="primary"
@@ -140,6 +149,14 @@
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleLeakInfo(scope.row)"
+            v-if="scope.row.isLottery == 0
+"
+          >开奖</el-button>
           <el-button
             size="mini"
             type="text"
@@ -278,7 +295,7 @@
 </template>
 
 <script>
-import { listLottery, getLottery, delLottery, addLottery, updateLottery,allList,kjLottery } from "@/api/business/lottery";
+import { listLottery, getLottery, delLottery, addLottery, updateLottery,allList,kjLottery,leakLottery,lotteryInfo } from "@/api/business/lottery";
 
 import {allGameList } from "@/api/business/game_item";
 
@@ -430,12 +447,14 @@ export default {
       that.kjForm.gameLotterySucc = null;
       for(var i in that.gameItemList){
         var item = that.gameItemList[i];
-        console.log(item["value"],val)
         if(item["gameId"] == val){
+
           that.kjGameItemList.push({
             value:item["value"].split("_")[0],
             label:item["label"],
-            gameId:item["gameId"]
+            gameId:item["gameId"],
+            isLottery: item["isLottery"],
+
           });
         }
       }
@@ -532,6 +551,27 @@ export default {
       this.kjOpen = true;
       this.title = "手动开奖";
     },
+    /** 新增按钮操作 */
+    handLeakLottery() {
+      this.$confirm('是否开始修补10分钟之前的开奖数据', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        /*this.$message({
+          type: 'success',
+          message: '删除成功!'
+        });*/
+        leakLottery().then(()=>{
+          this.$message({
+            type: 'success',
+            message: '修补成功!'
+          });
+        })
+      }).catch(() => {
+
+      });
+    },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
@@ -542,6 +582,33 @@ export default {
         this.title = "修改游戏开奖记录";
       });
     },
+    /** 修改按钮操作 */
+    handleLeakInfo(row) {
+      this.reset();
+      const id = row.id || this.ids
+      lotteryInfo(id).then(response => {
+        let item = response.data;
+        this.resetKj();
+        this.changeClass(item.classId);
+        this.changeGame(item.gameId)
+        let arr = [];
+        if(undefined != item["gameLotterySucc"] && null != item["gameLotterySucc"] && "" != item["gameLotterySucc"]){
+          let gameLotterySucc = item["gameLotterySucc"].split(",");
+          for(var i in gameLotterySucc){
+            arr.push(gameLotterySucc[i]);
+          }
+        }
+        this.kjForm = {
+          classId: item.classId,
+          gameId: item.gameId,
+          gameDate: item.gameDate,
+          isLottery:"1",
+          gameLotterySuccItem:arr
+        }
+        this.kjOpen = true;
+        this.title = "手动开奖";
+      });
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -575,7 +642,7 @@ export default {
           }
           kjLottery(this.kjForm).then(response => {
                 this.$modal.msgSuccess(response.msg);
-                this.open = false;
+                this.kjOpen = false;
                 this.getList();
 
             });