From 37518c255d676f17e661dfdfd6152de3405f7dcd Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 07 Dec 2021 15:50:55 +0800 Subject: [PATCH] 20211207 fish --- src/main/java/com/xcong/excoin/modules/fish/dao/CannonWinRecordDao.java | 7 +++++++ src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java | 18 +++++++++++++++--- src/main/java/com/xcong/excoin/modules/fish/entity/CannonWinRecord.java | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/fish/dao/CannonWinRecordDao.java b/src/main/java/com/xcong/excoin/modules/fish/dao/CannonWinRecordDao.java new file mode 100644 index 0000000..d29896a --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/fish/dao/CannonWinRecordDao.java @@ -0,0 +1,7 @@ +package com.xcong.excoin.modules.fish.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.xcong.excoin.modules.fish.entity.CannonWinRecord; + +public interface CannonWinRecordDao extends BaseMapper<CannonWinRecord> { +} diff --git a/src/main/java/com/xcong/excoin/modules/fish/entity/CannonWinRecord.java b/src/main/java/com/xcong/excoin/modules/fish/entity/CannonWinRecord.java new file mode 100644 index 0000000..7127e62 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/fish/entity/CannonWinRecord.java @@ -0,0 +1,18 @@ +package com.xcong.excoin.modules.fish.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.xcong.excoin.common.system.base.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@TableName("cannon_win_record") +public class CannonWinRecord extends BaseEntity { + + private Long memberId; + + private BigDecimal consumeNum; + + private String awardName; +} diff --git a/src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java b/src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java index c26364d..b798f65 100644 --- a/src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/fish/service/impl/MemberCannonServiceImpl.java @@ -44,6 +44,8 @@ @Resource CannonGameRecordDao cannonGameRecordDao; @Resource + CannonWinRecordDao cannonWinRecordDao; + @Resource RedisUtils redisUtils; @Resource private CoinService coinService; @@ -281,6 +283,8 @@ @Override public Result getAwards() { Long memberId = LoginUserUtils.getAppLoginUser().getId(); + +// Long memberId = 1L; AwardsVo awardsVo = cannonOwnRecordDao.getAwards(); return Result.ok(awardsVo); } @@ -288,6 +292,8 @@ @Override public Result lotteryDraw(LotteryDrawDto lotteryDrawDto) { Long memberId = LoginUserUtils.getAppLoginUser().getId(); + +// Long memberId = 1L; //获取每次抽奖需要的USDT数量 CannonAwardSet cannonAwardSet = cannonOwnRecordDao.getCannonAwardSet(); if(ObjectUtil.isEmpty(cannonAwardSet)){ @@ -317,6 +323,12 @@ cannonAccountMoneyChangeDao.insert(cannonAccountMoneyChange); //抽奖品 CannonAwardVo award = getAward(memberId); + + CannonWinRecord cannonWinRecord = new CannonWinRecord(); + cannonWinRecord.setMemberId(memberId); + cannonWinRecord.setAwardName(award.getName()+"*"+award.getQuantity()); + cannonWinRecord.setConsumeNum(consume); + cannonWinRecordDao.insert(cannonWinRecord); return Result.ok(award); } @@ -327,19 +339,19 @@ if(CollUtil.isNotEmpty(cannonAwards)){ CannonAward cannonAward = RandomUtil.randomEle(cannonAwards); //获得金币 - if(cannonAward.getCode() == "GOLD"){ + if("GOLD".equals(cannonAward.getCode())){ BigDecimal quantity = new BigDecimal(cannonAward.getQuantity()); MemberAccountGold memberAccountGold = memberAccountGoldDao.selectAccountGoldByMemberId(memberId); memberCannonService.updateTotalBalanceAndAvailableBalance(memberAccountGold.getId(),quantity,quantity,null); cannonAwardVo.setName(cannonAward.getName()); cannonAwardVo.setQuantity(cannonAward.getQuantity()); - }else if(cannonAward.getCode() == "COIN"){ + }else if("COIN".equals(cannonAward.getCode())){ BigDecimal quantity = new BigDecimal(cannonAward.getQuantity()); MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.XCC.name()); coinService.updateWalletBalance(memberWalletCoinEntity.getId(),quantity,quantity,null); cannonAwardVo.setName(cannonAward.getName()); cannonAwardVo.setQuantity(cannonAward.getQuantity()); - }else if(cannonAward.getCode() == "USDT"){ + }else if("USDT".equals(cannonAward.getCode())){ BigDecimal quantity = new BigDecimal(cannonAward.getQuantity()); MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.USDT.name()); coinService.updateWalletBalance(memberWalletCoinEntity.getId(),quantity,quantity,null); -- Gitblit v1.9.1