2 Commits

Author SHA1 Message Date
085cd485ad 新增后台管理
Some checks failed
CI Build and Test / build (push) Has been cancelled
Deploy to Server / build-and-deploy (push) Has been cancelled
2025-10-28 15:40:06 +08:00
9007c7de57 Merge pull request #1 from MakeSomeFakeNews/dev_20251028
Dev 20251028
2025-10-28 15:37:05 +08:00
15 changed files with 21 additions and 97 deletions

View File

@@ -41,7 +41,6 @@ dependencies {
runtimeOnly 'com.mysql:mysql-connector-j' // MySQL 驱动
annotationProcessor 'org.projectlombok:lombok' // Lombok 注解处理
testImplementation 'org.springframework.boot:spring-boot-starter-test' // 测试框架
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // thymeleaf模版引擎
}
tasks.named('test') {

View File

@@ -32,7 +32,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
// 排除固件查询接口(不需要登录)
.excludePathPatterns("/firmware/**")
// 排除静态资源
.excludePathPatterns("/", "/loading.html", "/admin/login.html", "/*.css", "/*.js", "/*.ico", "/static/**")
.excludePathPatterns("/", "/index.html", "/*.html", "/*.css", "/*.js", "/*.ico", "/static/**")
// 排除后台管理静态资源
.excludePathPatterns("/admin/**")
// 排除 Druid 监控

View File

@@ -1,4 +1,4 @@
package com.corewing.app.modules.app;
package com.corewing.app.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;

View File

@@ -1,4 +1,4 @@
package com.corewing.app.modules.app;
package com.corewing.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;

View File

@@ -1,4 +1,4 @@
package com.corewing.app.modules.app;
package com.corewing.app.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;

View File

@@ -1,4 +1,4 @@
package com.corewing.app.modules.admin;
package com.corewing.app.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.corewing.app.common.Result;
@@ -32,7 +32,6 @@ public class SysUserController {
@PostMapping("/login")
public Result<Map<String, Object>> login(@RequestBody SysLoginRequest request, HttpServletRequest httpRequest) {
try {
// 获取登录IP
String loginIp = IpUtil.getClientIp(httpRequest);
// 执行登录

View File

@@ -1,4 +1,4 @@
package com.corewing.app.modules.app;
package com.corewing.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -10,9 +10,10 @@ import com.corewing.app.service.TutorialCategoryService;
import com.corewing.app.service.TutorialService;
import com.corewing.app.util.I18nUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@@ -20,7 +21,7 @@ import java.util.List;
* 教程接口
*/
@RequestMapping("/tutorial")
@Controller
@RestController
@Slf4j
public class TutorialController {
@@ -32,37 +33,6 @@ public class TutorialController {
this.tutorialCategoryService = tutorialCategoryService;
}
/**
* 跳转到界面查看教程详情
* @param tutorialId 教程id
* @param model 数据模型
* @return 详情页
*/
@GetMapping("/viewDetail/{tutorialId}")
public String viewDetail(@PathVariable Long tutorialId, ModelMap model) {
Tutorial tutorial = tutorialService.getById(tutorialId);
model.put("tutorial", tutorial);
return "/app/tutorial/viewDetail";
}
/**
* 添加查看次数
* @param tutorialId 教程id
* @return
*/
@GetMapping("/addViewCount")
@ResponseBody
public Result<String> addViewCount(@RequestParam Long tutorialId) {
Tutorial tutorial = tutorialService.getById(tutorialId);
if(tutorial == null) {
return Result.error();
}
tutorial.setViewCount(tutorial.getViewCount() + 1);
tutorialService.updateById(tutorial);
return Result.success();
}
/**
* 分类查询列表
*
@@ -70,7 +40,6 @@ public class TutorialController {
*
*/
@GetMapping("/category")
@ResponseBody
public Result<List<TutorialCategory>> category(
@RequestParam(required = false, defaultValue = "0") Integer firstStatus
) {
@@ -92,7 +61,6 @@ public class TutorialController {
*
*/
@GetMapping("/page")
@ResponseBody
public Result<IPage<Tutorial>> getPageList(
@RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size,

View File

@@ -1,4 +1,4 @@
package com.corewing.app.modules.app;
package com.corewing.app.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.corewing.app.common.Result;

View File

@@ -27,11 +27,6 @@ public class TutorialCategory implements Serializable {
*/
private String icon;
/**
* 颜色
*/
private String color;
/**
* 分类名称
*/

View File

@@ -1,7 +1,5 @@
package com.corewing.app.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -19,7 +17,6 @@ public class TutorialCategoryRelation implements Serializable {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**

View File

@@ -1,24 +0,0 @@
package com.corewing.app.modules.admin;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class SysMainController {
@GetMapping({"/", "/index.html"})
public String loading() {
return "/admin/loading";
}
@GetMapping("/admin/login.html")
public String login() {
return "/admin/login";
}
@GetMapping("/admin/index.html")
public String adminIndex() {
return "/admin/index";
}
}

View File

@@ -488,7 +488,7 @@
const token = localStorage.getItem('token');
if (token) {
// 如果已有 token尝试跳转到主页
// window.location.href = '/admin/loading.html';
// window.location.href = '/admin/index.html';
}
}
}).mount('#app');

View File

@@ -80,14 +80,14 @@
</script>
</head>
<body>
<div class="container">
<div class="logo">🚀</div>
<h1>CoreWing</h1>
<p>后台管理系统</p>
<div class="loading">
<div class="spinner"></div>
<span>正在跳转...</span>
<div class="container">
<div class="logo">🚀</div>
<h1>CoreWing</h1>
<p>后台管理系统</p>
<div class="loading">
<div class="spinner"></div>
<span>正在跳转...</span>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title th:text="${tutorial?.tutorialTitle}"></title>
</head>
<body>
</body>
</html>