优化api

This commit is contained in:
none 2023-03-20 10:33:24 +08:00
parent 77a73be615
commit 00e4e66271
4 changed files with 21 additions and 4 deletions

View File

@ -27,9 +27,11 @@ public class CourseController {
public JsonResponse index(@RequestParam HashMap<String, Object> params) {
Integer page = MapUtils.getInteger(params, "page", 1);
Integer size = MapUtils.getInteger(params, "size", 10);
String categoryIds = MapUtils.getString(params, "category_ids");
CoursePaginateFiler filer = new CoursePaginateFiler();
filer.setIsShow(1);
filer.setCategoryIds(categoryIds);
PaginationResult<Course> result = courseService.paginate(page, size, filer);

View File

@ -39,11 +39,15 @@ public class DepartmentController {
Integer page = MapUtils.getInteger(params, "page", 1);
Integer size = MapUtils.getInteger(params, "size", 10);
Department department = departmentService.findOrFail(id);
CoursePaginateFiler filer = new CoursePaginateFiler();
filer.setIsShow(1);
filer.setDepIds(department.getId() + "");
if (id == 0) {
filer.setDepIds("0");//无部门所属的线上课
} else {
Department department = departmentService.findOrFail(id);
filer.setDepIds(department.getId() + "");
}
PaginationResult<Course> result = courseService.paginate(page, size, filer);

View File

@ -47,6 +47,8 @@ public class LoginController {
@PostMapping("/password")
public JsonResponse password(@RequestBody @Validated LoginPasswordRequest req) throws LimitException {
String email = req.getEmail();
// 限流-限制学员10s内登录成功一次
userLoginCache.check(email);
User user = userService.find(email);

View File

@ -29,7 +29,16 @@ public class SystemController {
@GetMapping("/config")
public JsonResponse config() {
Map<String, String> data = appConfigService.keyValues();
Map<String, String> configs = appConfigService.keyValues();
HashMap<String, String> data = new HashMap<>();
data.put("system-name", configs.get("system.name"));
data.put("system-logo", configs.get("system.logo"));
data.put("system-api-url", configs.get("system.api_url"));
data.put("system-pc-url", configs.get("system.pc_url"));
data.put("system-h5-url", configs.get("system.h5_url"));
return JsonResponse.data(data);
}