This commit is contained in:
Mrx
2026-02-04 15:18:37 +08:00
parent e44793c89e
commit 39c51aa4a2
6 changed files with 86 additions and 16 deletions

View File

@@ -3,6 +3,8 @@ package admin_platform_user
import (
"context"
"database/sql"
"fmt"
"strconv"
"xingfucha-server/app/main/api/internal/svc"
"xingfucha-server/app/main/api/internal/types"
@@ -65,6 +67,9 @@ func (l *AdminUpdatePlatformUserLogic) AdminUpdatePlatformUser(req *types.AdminU
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "更新用户失败: %v", err)
}
// 更新封禁状态缓存,使封禁/解封即时生效,避免中间件继续用旧缓存
disableKey := fmt.Sprintf(types.UserDisableCacheKey, req.Id)
_ = l.svcCtx.Redis.Setex(disableKey, strconv.FormatInt(user.Disable, 10), types.UserDisableCacheTTL)
resp = &types.AdminUpdatePlatformUserResp{Success: true}
return resp, nil
}