| | |
| | | import com.xcong.excoin.common.enumerates.CoinTypeEnum; |
| | | import com.xcong.excoin.common.response.Result; |
| | | import com.xcong.excoin.modules.coin.service.CoinService; |
| | | import com.xcong.excoin.modules.fish.dao.CannonAccountMoneyChangeDao; |
| | | import com.xcong.excoin.modules.fish.dao.CannonOwnRecordDao; |
| | | import com.xcong.excoin.modules.fish.dao.CannonSettingDao; |
| | | import com.xcong.excoin.modules.fish.dao.MemberAccountGoldDao; |
| | | import com.xcong.excoin.modules.fish.dao.*; |
| | | import com.xcong.excoin.modules.fish.dto.*; |
| | | import com.xcong.excoin.modules.fish.entity.*; |
| | | import com.xcong.excoin.modules.fish.service.MemberCannonService; |
| | |
| | | public class MemberCannonServiceImpl extends ServiceImpl<CannonOwnRecordDao, CannonOwnRecord> implements MemberCannonService { |
| | | |
| | | @Resource |
| | | CannonSettingDao cannonSettingDao; |
| | | @Resource |
| | | MemberAccountGoldDao memberAccountGoldDao; |
| | | @Resource |
| | | CannonAccountMoneyChangeDao cannonAccountMoneyChangeDao; |
| | | @Resource |
| | | MemberWalletCoinDao memberWalletCoinDao; |
| | | @Resource |
| | | private MemberCannonService memberCannonService; |
| | | @Resource |
| | | CannonAccountMoneyChangeDao cannonAccountMoneyChangeDao; |
| | | @Resource |
| | | CannonOwnRecordDao cannonOwnRecordDao; |
| | | @Resource |
| | | CannonSettingDao cannonSettingDao; |
| | | @Resource |
| | | CannonGameRecordDao cannonGameRecordDao; |
| | | @Resource |
| | | RedisUtils redisUtils; |
| | | @Resource |
| | | private CoinService coinService; |
| | | @Resource |
| | | private MemberCannonService memberCannonService; |
| | | |
| | | @Override |
| | | public Result coinGoldExchange(CoinGoldExchangeDto coinGoldExchangeDto) { |
| | |
| | | BigDecimal goldConsume = cannonSetting.getGoldConsume().subtract(new BigDecimal(goldWin)).setScale(0,BigDecimal.ROUND_DOWN); |
| | | MemberAccountGold memberAccountGold = memberAccountGoldDao.selectAccountGoldByMemberId(memberId); |
| | | memberCannonService.updateTotalBalanceAndAvailableBalance(memberAccountGold.getId(),goldConsume.negate(),goldConsume.negate(),null); |
| | | //增加一条游戏记录 |
| | | CannonGameRecord cannonGameRecord = new CannonGameRecord(); |
| | | cannonGameRecord.setMemberId(memberId); |
| | | cannonGameRecord.setCannonOwnId(cannonOwnRecord.getId()); |
| | | cannonGameRecord.setCannonName(cannonOwnRecord.getCannonName()); |
| | | cannonGameRecord.setCannonCode(cannonOwnRecord.getCannonCode()); |
| | | cannonGameRecord.setGoldConsume(cannonSetting.getGoldConsume()); |
| | | cannonGameRecord.setGoldReward(new BigDecimal(goldWin)); |
| | | cannonGameRecordDao.insert(cannonGameRecord); |
| | | |
| | | return Result.ok("success"); |
| | | } |
| | | |