帐号状态(0正常 1停用)status
This commit is contained in:
@ -92,7 +92,7 @@ public class Customer extends TenantEntity {
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
private String status = "0";
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 1代表删除)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuyuanshen.customer.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -93,6 +94,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
}
|
||||
customer.setUserLevel((byte) (loginUser.getUserLevel() + 1));
|
||||
customer.setPid(loginUser.getUserId());
|
||||
customer.setStatus("0");
|
||||
|
||||
save(customer);
|
||||
|
||||
@ -127,7 +129,18 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
if (customer.getEnabled()) {
|
||||
customer.setStatus("0");
|
||||
} else {
|
||||
// 强制下线
|
||||
// StpUtil.logout(customer.getCustomerId());
|
||||
// StpUtil.kickout(customer.getCustomerId());
|
||||
customer.setStatus("1");
|
||||
// 检查目标用户是否有有效的登录状态
|
||||
if (StpUtil.isLogin(customer.getCustomerId())) {
|
||||
// 用户已登录,可以执行踢出操作
|
||||
StpUtil.kickout(customer.getCustomerId());
|
||||
} else {
|
||||
// 用户未登录,无法踢出
|
||||
System.out.println("目标用户未登录,无法执行踢出操作");
|
||||
}
|
||||
}
|
||||
saveOrUpdate(customer);
|
||||
}
|
||||
|
Reference in New Issue
Block a user