mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-21 02:55:38 +08:00
update
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.PlayEduBackendThreadLocal;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.domain.CourseChapter;
|
||||
import xyz.playedu.api.event.CourseChapterDestroyEvent;
|
||||
@@ -74,7 +74,7 @@ public class CourseChapterController {
|
||||
public JsonResponse destroy(@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "id") Integer id) throws NotFoundException {
|
||||
CourseChapter chapter = chapterService.findOrFail(id, courseId);
|
||||
chapterService.removeById(chapter.getId());
|
||||
ctx.publishEvent(new CourseChapterDestroyEvent(this, PlayEduBackendThreadLocal.getAdminUserID(), chapter.getCourseId(), chapter.getId(), new Date()));
|
||||
ctx.publishEvent(new CourseChapterDestroyEvent(this, PlayEduBContext.getAdminUserID(), chapter.getCourseId(), chapter.getId(), new Date()));
|
||||
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.PlayEduBackendThreadLocal;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.domain.*;
|
||||
import xyz.playedu.api.event.CourseDestroyEvent;
|
||||
@@ -108,7 +108,7 @@ public class CourseController {
|
||||
@DeleteMapping("/{id}")
|
||||
public JsonResponse destroy(@PathVariable(name = "id") Integer id) {
|
||||
courseService.removeById(id);
|
||||
ctx.publishEvent(new CourseDestroyEvent(this, PlayEduBackendThreadLocal.getAdminUserID(), id, new Date()));
|
||||
ctx.publishEvent(new CourseDestroyEvent(this, PlayEduBContext.getAdminUserID(), id, new Date()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package xyz.playedu.api.controller.backend;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
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.PlayEduBackendThreadLocal;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.constant.BackendConstant;
|
||||
import xyz.playedu.api.domain.CourseChapter;
|
||||
@@ -82,7 +80,7 @@ public class CourseHourController {
|
||||
chapterService.findOrFail(chapterId, courseId);
|
||||
|
||||
CourseHour courseHour = hourService.create(courseId, chapterId, req.getTitle(), type, req.getDuration(), req.getPublishedAt());
|
||||
ctx.publishEvent(new CourseHourCreatedEvent(this, PlayEduBackendThreadLocal.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId(), new Date()));
|
||||
ctx.publishEvent(new CourseHourCreatedEvent(this, PlayEduBContext.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId(), new Date()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
@@ -110,7 +108,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, PlayEduBackendThreadLocal.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId(), new Date()));
|
||||
ctx.publishEvent(new CourseHourDestroyEvent(this, PlayEduBContext.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId(), new Date()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,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.PlayEduBackendThreadLocal;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.domain.Department;
|
||||
import xyz.playedu.api.event.DepartmentDestroyEvent;
|
||||
@@ -87,7 +87,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, PlayEduBackendThreadLocal.getAdminUserID(), department.getId(), new Date()));
|
||||
ctx.publishEvent(new DepartmentDestroyEvent(this, PlayEduBContext.getAdminUserID(), department.getId(), new Date()));
|
||||
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.PlayEduBackendThreadLocal;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.bus.BackendBus;
|
||||
import xyz.playedu.api.constant.SystemConstant;
|
||||
import xyz.playedu.api.domain.AdminUser;
|
||||
@@ -23,7 +23,6 @@ import xyz.playedu.api.util.RequestUtil;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/backend/v1/auth")
|
||||
@@ -76,7 +75,7 @@ public class LoginController {
|
||||
|
||||
@GetMapping("/detail")
|
||||
public JsonResponse detail() {
|
||||
AdminUser user = PlayEduBackendThreadLocal.getAdminUser();
|
||||
AdminUser user = PlayEduBContext.getAdminUser();
|
||||
HashMap<String, Boolean> permissions = backendBus.adminUserPermissions(user.getId());
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
@@ -88,7 +87,7 @@ public class LoginController {
|
||||
|
||||
@PutMapping("/password")
|
||||
public JsonResponse changePassword(@RequestBody @Validated PasswordChangeRequest req) {
|
||||
AdminUser user = PlayEduBackendThreadLocal.getAdminUser();
|
||||
AdminUser user = PlayEduBContext.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.PlayEduBackendThreadLocal;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.domain.ResourceCategory;
|
||||
import xyz.playedu.api.event.ResourceCategoryDestroyEvent;
|
||||
@@ -84,7 +84,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, PlayEduBackendThreadLocal.getAdminUserID(), category.getId(), new Date()));
|
||||
ctx.publishEvent(new ResourceCategoryDestroyEvent(this, PlayEduBContext.getAdminUserID(), category.getId(), new Date()));
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -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.PlayEduBackendThreadLocal;
|
||||
import xyz.playedu.api.PlayEduBContext;
|
||||
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 = PlayEduBackendThreadLocal.getConfig();
|
||||
Map<String, String> data = PlayEduBContext.getConfig();
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user