refactor(auth): 新增 AUTO_TK 功能权限与过期时间字段
This commit is contained in:
@@ -153,7 +153,10 @@ public class FeatureAuthComponent {
|
||||
}
|
||||
|
||||
// 校验功能代码(如果指定)
|
||||
if (StrUtil.isNotBlank(requiredFeatureCode) && !requiredFeatureCode.equals(payload.getFeatureCode())) {
|
||||
// 功能码统一按忽略大小写比较,避免发证与校验阶段大小写不一致
|
||||
if (StrUtil.isNotBlank(requiredFeatureCode)
|
||||
&& (StrUtil.isBlank(payload.getFeatureCode())
|
||||
|| !requiredFeatureCode.equalsIgnoreCase(payload.getFeatureCode()))) {
|
||||
log.warn("功能代码不匹配,需要: {}, Ticket: {}", requiredFeatureCode, payload.getFeatureCode());
|
||||
throw new BusinessException(ErrorCode.TICKET_FEATURE_MISMATCH, "功能代码不匹配");
|
||||
}
|
||||
|
||||
@@ -135,6 +135,9 @@ public class FeatureAuthController {
|
||||
case "BROTHER":
|
||||
case "BIG_BROTHER":
|
||||
return tenant.getBrotherExpireTime();
|
||||
case "AUTO_TK":
|
||||
// auto_tk 当前走租户通用到期时间
|
||||
return tenant.getAutoTkExpireTime();
|
||||
default:
|
||||
return tenant.getExpireTime();
|
||||
}
|
||||
@@ -160,6 +163,8 @@ public class FeatureAuthController {
|
||||
return user.getBigBrother() != null && user.getBigBrother() == 1;
|
||||
case "WEB_AI":
|
||||
return user.getWebAi() != null && user.getWebAi() == 1;
|
||||
case "AUTO_TK":
|
||||
return user.getAutoTk() != null && user.getAutoTk() == 1;
|
||||
default:
|
||||
// 未知功能代码,默认不允许
|
||||
return false;
|
||||
|
||||
@@ -39,8 +39,9 @@ public class TaskExecuteController {
|
||||
* 2. 请求头 X-Machine-Id: 与 Ticket 中一致的设备 ID
|
||||
*/
|
||||
@PostMapping("/execute-task")
|
||||
@RequireFeatureTicket(featureCode = "CRAWL")
|
||||
@ApiOperation(value = "执行任务", notes = "需要 Feature Ticket 校验,功能代码: CRAWL")
|
||||
// 任务执行接口改为校验 auto_tk 功能票据
|
||||
@RequireFeatureTicket(featureCode = "auto_tk")
|
||||
@ApiOperation(value = "执行任务", notes = "需要 Feature Ticket 校验,功能代码: auto_tk")
|
||||
public BaseResponse<Map<String, Object>> executeTask(
|
||||
@RequestBody Map<String, Object> taskParams,
|
||||
HttpServletRequest request) {
|
||||
|
||||
@@ -107,6 +107,12 @@ public class SystemTenant {
|
||||
@TableField(value = "brother_expire_time")
|
||||
private LocalDateTime brotherExpireTime;
|
||||
|
||||
/**
|
||||
* tks私信过期时间
|
||||
*/
|
||||
@ApiModelProperty(value="大哥过期时间")
|
||||
@TableField(value = "auto_tk_expire_time")
|
||||
private LocalDateTime autoTkExpireTime;
|
||||
|
||||
/**
|
||||
* 账号数量
|
||||
|
||||
@@ -196,6 +196,10 @@ public class SystemUsers {
|
||||
@ApiModelProperty(value = "能否登录智能回复客户端")
|
||||
private Byte webAi;
|
||||
|
||||
@TableField(value = "auto_tk")
|
||||
@ApiModelProperty(value = "tk自动回复")
|
||||
private Byte autoTk;
|
||||
|
||||
@TableField(value = "points")
|
||||
@ApiModelProperty(value = "用户积分")
|
||||
private Integer points;
|
||||
|
||||
@@ -51,6 +51,8 @@ public class SystemUsersVO {
|
||||
|
||||
private Byte webAi;
|
||||
|
||||
private Byte autoTk;
|
||||
|
||||
private Boolean aiReplayEnabled;
|
||||
|
||||
private Boolean crawlEnabled;
|
||||
@@ -61,5 +63,7 @@ public class SystemUsersVO {
|
||||
|
||||
private Boolean webAiEnabled;
|
||||
|
||||
private Boolean autoTkEnabled;
|
||||
|
||||
private Integer points;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class LoginService {
|
||||
vo.setBigBrotherEnabled(isEnabled(user.getBigBrother()));
|
||||
vo.setAiChatEnabled(isEnabled(user.getAiChat()));
|
||||
vo.setWebAiEnabled(isEnabled(user.getWebAi()));
|
||||
vo.setAutoTkEnabled(isEnabled(user.getAutoTk()));
|
||||
}
|
||||
|
||||
private boolean isEnabled(Byte value) {
|
||||
|
||||
@@ -102,6 +102,8 @@ sa-token:
|
||||
token-style: random-128
|
||||
# 是否输出操作日志
|
||||
is-log: true
|
||||
#活跃时间自动续签token
|
||||
active-timeout: 86400
|
||||
|
||||
|
||||
md5:
|
||||
|
||||
Reference in New Issue
Block a user