mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-24 03:29:29 +08:00
added: 学员,我的课程
This commit is contained in:
@@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.domain.CourseChapter;
|
||||
import xyz.playedu.api.event.CourseChapterDestroyEvent;
|
||||
@@ -16,8 +16,6 @@ import xyz.playedu.api.service.CourseChapterService;
|
||||
import xyz.playedu.api.service.CourseHourService;
|
||||
import xyz.playedu.api.types.JsonResponse;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author 杭州白书科技有限公司
|
||||
* @create 2023/2/26 17:28
|
||||
@@ -65,7 +63,7 @@ public class CourseChapterController {
|
||||
return JsonResponse.error("当前章节下面存在课时无法删除");
|
||||
}
|
||||
chapterService.removeById(chapter.getId());
|
||||
ctx.publishEvent(new CourseChapterDestroyEvent(this, PlayEduBContext.getAdminUserID(), chapter.getCourseId(), chapter.getId()));
|
||||
ctx.publishEvent(new CourseChapterDestroyEvent(this, PlayEduBCtx.getAdminUserID(), chapter.getCourseId(), chapter.getId()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.domain.*;
|
||||
import xyz.playedu.api.event.CourseDestroyEvent;
|
||||
@@ -185,7 +185,7 @@ public class CourseController {
|
||||
@DeleteMapping("/{id}")
|
||||
public JsonResponse destroy(@PathVariable(name = "id") Integer id) {
|
||||
courseService.removeById(id);
|
||||
ctx.publishEvent(new CourseDestroyEvent(this, PlayEduBContext.getAdminUserID(), id));
|
||||
ctx.publishEvent(new CourseDestroyEvent(this, PlayEduBCtx.getAdminUserID(), id));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.constant.BackendConstant;
|
||||
import xyz.playedu.api.domain.CourseChapter;
|
||||
@@ -75,7 +75,7 @@ public class CourseHourController {
|
||||
chapterService.findOrFail(chapterId, courseId);
|
||||
|
||||
CourseHour courseHour = hourService.create(courseId, chapterId, req.getSort(), req.getTitle(), type, req.getRid(), req.getDuration());
|
||||
ctx.publishEvent(new CourseHourCreatedEvent(this, PlayEduBContext.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId()));
|
||||
ctx.publishEvent(new CourseHourCreatedEvent(this, PlayEduBCtx.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class CourseHourController {
|
||||
public JsonResponse destroy(@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "id") Integer id) throws NotFoundException {
|
||||
CourseHour courseHour = hourService.findOrFail(id, courseId);
|
||||
hourService.removeById(courseHour.getId());
|
||||
ctx.publishEvent(new CourseHourDestroyEvent(this, PlayEduBContext.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId()));
|
||||
ctx.publishEvent(new CourseHourDestroyEvent(this, PlayEduBCtx.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.domain.Department;
|
||||
import xyz.playedu.api.domain.User;
|
||||
import xyz.playedu.api.event.DepartmentDestroyEvent;
|
||||
import xyz.playedu.api.exception.NotFoundException;
|
||||
import xyz.playedu.api.middleware.BackendPermissionMiddleware;
|
||||
@@ -19,7 +18,6 @@ import xyz.playedu.api.service.UserService;
|
||||
import xyz.playedu.api.types.JsonResponse;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author 杭州白书科技有限公司
|
||||
@@ -119,7 +117,7 @@ public class DepartmentController {
|
||||
public JsonResponse destroy(@PathVariable Integer id) throws NotFoundException {
|
||||
Department department = departmentService.findOrFail(id);
|
||||
departmentService.deleteById(department.getId());
|
||||
ctx.publishEvent(new DepartmentDestroyEvent(this, PlayEduBContext.getAdminUserID(), department.getId()));
|
||||
ctx.publishEvent(new DepartmentDestroyEvent(this, PlayEduBCtx.getAdminUserID(), department.getId()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.bus.BackendBus;
|
||||
import xyz.playedu.api.constant.SystemConstant;
|
||||
import xyz.playedu.api.domain.AdminUser;
|
||||
@@ -21,7 +21,6 @@ import xyz.playedu.api.util.HelperUtil;
|
||||
import xyz.playedu.api.util.IpUtil;
|
||||
import xyz.playedu.api.util.RequestUtil;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
||||
@RestController
|
||||
@@ -75,7 +74,7 @@ public class LoginController {
|
||||
|
||||
@GetMapping("/detail")
|
||||
public JsonResponse detail() {
|
||||
AdminUser user = PlayEduBContext.getAdminUser();
|
||||
AdminUser user = PlayEduBCtx.getAdminUser();
|
||||
HashMap<String, Boolean> permissions = backendBus.adminUserPermissions(user.getId());
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
@@ -87,7 +86,7 @@ public class LoginController {
|
||||
|
||||
@PutMapping("/password")
|
||||
public JsonResponse changePassword(@RequestBody @Validated PasswordChangeRequest req) {
|
||||
AdminUser user = PlayEduBContext.getAdminUser();
|
||||
AdminUser user = PlayEduBCtx.getAdminUser();
|
||||
String password = HelperUtil.MD5(req.getOldPassword() + user.getSalt());
|
||||
if (!password.equals(user.getPassword())) {
|
||||
return JsonResponse.error("原密码不正确");
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.constant.BackendConstant;
|
||||
import xyz.playedu.api.domain.Resource;
|
||||
@@ -124,7 +124,7 @@ public class ResourceCategoryController {
|
||||
public JsonResponse destroy(@PathVariable Integer id) throws NotFoundException {
|
||||
ResourceCategory category = categoryService.findOrFail(id);
|
||||
categoryService.deleteById(category.getId());
|
||||
ctx.publishEvent(new ResourceCategoryDestroyEvent(this, PlayEduBContext.getAdminUserID(), category.getId()));
|
||||
ctx.publishEvent(new ResourceCategoryDestroyEvent(this, PlayEduBCtx.getAdminUserID(), category.getId()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.bus.BackendBus;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.constant.BackendConstant;
|
||||
@@ -70,7 +70,7 @@ public class ResourceController {
|
||||
filter.setName(name);
|
||||
|
||||
if (!backendBus.isSuperAdmin()) {// 非超管只能读取它自己上传的资源
|
||||
filter.setAdminId(PlayEduBContext.getAdminUserID());
|
||||
filter.setAdminId(PlayEduBCtx.getAdminUserID());
|
||||
}
|
||||
|
||||
PaginationResult<Resource> result = resourceService.paginate(page, size, filter);
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.service.ImageCaptchaService;
|
||||
import xyz.playedu.api.types.ImageCaptchaResult;
|
||||
import xyz.playedu.api.types.JsonResponse;
|
||||
@@ -33,7 +33,7 @@ public class SystemController {
|
||||
|
||||
@GetMapping("/config")
|
||||
public JsonResponse config() {
|
||||
Map<String, String> data = PlayEduBContext.getConfig();
|
||||
Map<String, String> data = PlayEduBCtx.getConfig();
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.PlayEduBCtx;
|
||||
import xyz.playedu.api.constant.BackendConstant;
|
||||
import xyz.playedu.api.domain.Resource;
|
||||
import xyz.playedu.api.exception.ServiceException;
|
||||
@@ -40,7 +40,7 @@ public class UploadController {
|
||||
@PostMapping("/minio")
|
||||
public JsonResponse uploadMinio(@RequestParam HashMap<String, Object> params, MultipartFile file) throws ServiceException {
|
||||
String categoryIds = MapUtils.getString(params, "category_ids");
|
||||
Resource res = uploadService.storeMinio(PlayEduBContext.getAdminUserID(), file, categoryIds);
|
||||
Resource res = uploadService.storeMinio(PlayEduBCtx.getAdminUserID(), file, categoryIds);
|
||||
return JsonResponse.data(res);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class UploadController {
|
||||
|
||||
// 视频素材保存
|
||||
Resource videoResource = resourceService.create(
|
||||
PlayEduBContext.getAdminUserID(),
|
||||
PlayEduBCtx.getAdminUserID(),
|
||||
req.getCategoryIds(),
|
||||
type,
|
||||
req.getOriginalFilename(),
|
||||
@@ -104,7 +104,7 @@ public class UploadController {
|
||||
url
|
||||
);
|
||||
// 视频封面素材保存
|
||||
Resource posterResource = uploadService.storeBase64Image(PlayEduBContext.getAdminUserID(), req.getPoster(), null);
|
||||
Resource posterResource = uploadService.storeBase64Image(PlayEduBCtx.getAdminUserID(), req.getPoster(), null);
|
||||
// 视频的封面素材改为[隐藏 && 属于视频的子素材]
|
||||
resourceService.changeParentId(posterResource.getId(), videoResource.getId());
|
||||
// 视频信息
|
||||
|
||||
Reference in New Issue
Block a user