dos před 1 měsícem
rodič
revize
906c89275f

+ 5 - 0
game-business/src/main/java/com/game/business/service/IAppUserService.java

@@ -88,6 +88,11 @@ public interface IAppUserService extends IService<AppUser> {
      * */
     int updateUserAmount(FinTranRecord finTranRecord);
 
+    /**
+     * 更新用户余额、插入流水(更新可提现)
+     * */
+    int updateUserAmount(FinTranRecord finTranRecord,boolean withdrawAble);
+
     ApiUserInfoVo getUserInfo(Long userId);
 
     Map<String, BigDecimal> getUserCount(Long userId);

+ 12 - 1
game-business/src/main/java/com/game/business/service/impl/AppUserServiceImpl.java

@@ -15,6 +15,8 @@ import com.game.business.domain.FinTranRecord;
 import com.game.business.service.IFinTranRecordService;
 import com.game.business.vo.ApiUserInfoVo;
 import com.game.common.annotation.DataSource;
+import com.game.common.constant.finance.FinTranType1;
+import com.game.common.constant.finance.FinTranType2;
 import com.game.common.constant.finance.FinTranType3;
 import com.game.common.core.redis.RedisCache;
 import com.game.common.enums.DataSourceType;
@@ -175,7 +177,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
 
     @Override
     @DataSource(DataSourceType.SLAVE)
-    public int updateUserAmount(FinTranRecord finTranRecord){
+    public int updateUserAmount(FinTranRecord finTranRecord,boolean withdrawAble){
         int res = 0;
         int finRes = 0;
         RLock rLock = redisson.getLock("app_user_amount_".concat(String.valueOf(finTranRecord.getUid())));
@@ -196,6 +198,9 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
                         updateAppUser.setDiamondCoin(finTranRecord.getDiamondCoinChange());
                         updateAppUser.setDiamondCoinTotal(finTranRecord.getDiamondCoinChange());
                         updateAppUser.setDiamondCoinCash(MoneyUtils.consumeCash(appUser.getDiamondCoin(),appUser.getDiamondCoinCash(),finTranRecord.getDiamondCoinChange()));
+                        if(withdrawAble){
+                            updateAppUser.setWithdrawAble(finTranRecord.getDiamondCoinChange());
+                        }
                     }
                     if(finTranRecord.getTranType3().intValue() == FinTranType3.CASH_DIAMOND_INCOME_BACK.getType()){
                         //回退已提现金额
@@ -233,6 +238,12 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
         return res;
     }
 
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int updateUserAmount(FinTranRecord finTranRecord){
+        return updateUserAmount(finTranRecord,false);
+    }
+
     @Override
     @DataSource(DataSourceType.SLAVE)
     public Map<String, BigDecimal> getUserCount(Long userId) {

+ 1 - 1
game-business/src/main/java/com/game/business/task/AppAgentGameBettingTask.java

@@ -256,7 +256,7 @@ public class AppAgentGameBettingTask {
 
             finTranRecord.setOrderId(appGameBetting.getId());
             //finTranRecordService.insertFinTranRecord(finTranRecord);
-            appUserService.updateUserAmount(finTranRecord);
+            appUserService.updateUserAmount(finTranRecord,true);
         }
     }
 

+ 1 - 0
game-business/src/main/resources/mapper/business/AppUserMapper.xml

@@ -855,6 +855,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="diamondCoinCash != null">diamond_coin_cash = diamond_coin_cash + #{diamondCoinCash},</if>
             <if test="diamondCoinTotal != null">diamond_coin_total = diamond_coin_total + #{diamondCoinTotal},</if>
             <if test="withdraw != null">withdraw = withdraw + #{withdraw},</if>
+            <if test="withdrawAble != null">withdraw_able = withdraw_able + #{withdrawAble},</if>
         </trim>
         where userid = #{userid}
     </update>