This commit is contained in:
670788339
2025-11-05 13:34:56 +08:00
parent f9528a5705
commit cb4eb1b1b6

View File

@@ -286,6 +286,16 @@ public class CourseManageApi extends ApiBaseController{
log.info("-------- 标签相关开始 ------- 课程ID = {} " , dto.getCourse().getId());
CurrentUser userInfo = getCurrent();
Course oldCourse = StringUtils.isBlank(dto.getCourse().getId()) ? null : courseService.get(dto.getCourse().getId());
if(oldCourse!=null && StringUtils.isNotEmpty(oldCourse.getTags())){
String[] tagArray = oldCourse.getTags().split(",");
// 检查每个元素是否为纯数字
for (String tag : tagArray) {
if (!tag.matches("\\d+")) { // 使用正则表达式检查是否为纯数字
oldCourse.setTags(null); // 兼容
break;
}
}
}
tagService.updateTags(oldCourse,dto.getCourse(),userInfo);
log.info("-------- 标签相关结束 -------");