From a7b8b0c439d0a705bced3fda9b04e38e44c26707 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Wed, 21 May 2025 10:53:00 +0800
Subject: [PATCH] fix(mall): 修复管理员禁用会员时未同步更新小程序登录状态

---
 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
index ffb469b..f2e24b9 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -2,11 +2,11 @@
 
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
-import cc.mrbird.febs.common.enumerates.AgentLevelEnum;
-import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum;
-import cc.mrbird.febs.common.enumerates.StateUpDownEnum;
+import cc.mrbird.febs.common.enumerates.*;
 import cc.mrbird.febs.common.exception.FebsException;
 import cc.mrbird.febs.common.utils.AppContants;
+import cc.mrbird.febs.common.utils.LoginUserUtil;
+import cc.mrbird.febs.common.utils.MallUtils;
 import cc.mrbird.febs.common.utils.RedisUtils;
 import cc.mrbird.febs.mall.dto.*;
 import cc.mrbird.febs.mall.entity.*;
@@ -97,6 +97,17 @@
         }
         mallMember.setAccountStatus(MallMember.ACCOUNT_STATUS_DISABLED);
         mallMemberMapper.updateById(mallMember);
+
+        String redisKey = AppContants.XCX_LOGIN_PREFIX + id;
+        String existToken = redisUtils.getString(redisKey);
+        if (StrUtil.isNotBlank(existToken)) {
+            Object o = redisUtils.get(existToken);
+            if (ObjectUtil.isNotEmpty(o)) {
+                redisUtils.del(existToken);
+            }
+        }
+        redisUtils.del(AppContants.XCX_LOGIN_PREFIX + id);
+        redisUtils.del(AppContants.XCX_LOGIN_PHONE_PREFIX + id);
         return new FebsResponse().success();
     }
 
@@ -512,12 +523,16 @@
 
         Integer type = mallSystemPayDto.getType();
         String filedType = "";
+        Integer flowType = 0;
         if (type == 1) {
             filedType = "balance";
+            flowType = FlowTypeEnum.BALANCE.getValue();
         } else if (type == 2) {
-            filedType = "score";
-        } else if (type == 3) {
             filedType = "prizeScore";
+            flowType = FlowTypeEnum.PRIZE_SCORE.getValue();
+        } else if (type == 3) {
+            filedType = "commission";
+            flowType = FlowTypeEnum.COMMISSION.getValue();
         } else {
             throw new FebsException("参数错误");
         }
@@ -531,7 +546,15 @@
         } else {
             iApiMallMemberWalletService.add(mallSystemPayDto.getAddBalance(), mallSystemPayDto.getId(), filedType);
         }
-        mallMoneyFlowService.addMoneyFlow(memberId, bigDecimal, MoneyFlowTypeEnum.SYSTEM.getValue(), null, type);
+        mallMoneyFlowService.addMoneyFlow(
+                memberId,
+                bigDecimal,
+                ScoreFlowTypeEnum.SYSTEM.getValue(),
+                MallUtils.getOrderNum(),
+                flowType,
+                StrUtil.format(ScoreFlowTypeEnum.SYSTEM.getDesc(),bigDecimal),
+                2
+        );
         return new FebsResponse().success();
     }
 

--
Gitblit v1.9.1