From 06b7842580c11b3ade0dc3dbdaee03a751ac1400 Mon Sep 17 00:00:00 2001 From: yl Date: Tue, 29 Jul 2025 12:52:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=82=E9=85=8D=E6=97=A0=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E7=8E=AF=E5=A2=83=E7=9A=84mycourse=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除用户未登录的错误返回 - 在无JWT认证时使用默认用户ID进行测试 - 清理未使用的gerror导入 - 适配同事调整的路由配置(无需认证组) --- server/internal/logic/mycourse/mycourse.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/internal/logic/mycourse/mycourse.go b/server/internal/logic/mycourse/mycourse.go index 8b4b1a4..cdb290c 100644 --- a/server/internal/logic/mycourse/mycourse.go +++ b/server/internal/logic/mycourse/mycourse.go @@ -6,7 +6,6 @@ import ( "hotgo/internal/library/contexts" "hotgo/internal/service" - "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/os/gtime" ) @@ -22,10 +21,11 @@ func New() *sMyCourse { // GetList 获取我的课程列表 func (s *sMyCourse) GetList(ctx context.Context, req *v1.MyCourseListReq) (res *v1.MyCourseListRes, err error) { - // 从JWT中间件解析出的用户ID + // 获取用户ID(测试环境下使用默认用户ID) userId := contexts.GetUserId(ctx) if userId <= 0 { - return nil, gerror.New("用户未登录") + // 测试环境下使用默认用户ID + userId = 1 } // 模拟数据 - 实际项目中应该从数据库查询