Version:0.0.6.dev.260204

feat: 🏗️ 在 sv/dao 层引入 ctx 支持链路追踪与超时控制(预留扩展)

- 架构改造:在 sv 与 dao 层统一引入 ctx 🧩
- 为后续链路追踪、超时控制等能力提供支持 ⏱️(未来开发)

perf: 🚀 为获取任务类列表接口引入 Redis 缓存并保证一致性

- 获取任务类列表接口新增 Redis 缓存提升访问速度 
- 通过新增任务类时主动删除缓存,确保主从一致性 
- 防止缓存与数据库列表不一致问题 🛡️
This commit is contained in:
LoveLosita
2026-02-04 20:17:52 +08:00
parent af8e8bd804
commit eb521a4c35
10 changed files with 130 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
package service
import (
"context"
"fmt"
"github.com/LoveLosita/smartflow/backend/dao"
@@ -33,7 +34,7 @@ func CheckSingleCourse(req model.UserCheckCourseRequest) bool {
}
// AddUserCourses 添加用户课程表
func (ss *ScheduleService) AddUserCourses(req model.UserImportCoursesRequest, userID int) error {
func (ss *ScheduleService) AddUserCourses(ctx context.Context, req model.UserImportCoursesRequest, userID int) error {
//1.先校验参数是否正确
for _, course := range req.Courses {
result := CheckSingleCourse(course)