From f88b3e27e6ef3ef4e8ec785d69c09d589d08ba8e Mon Sep 17 00:00:00 2001 From: wangguixi Date: Fri, 14 Nov 2025 14:54:08 +0800 Subject: [PATCH] =?UTF-8?q?11.14=20=E8=A1=A5=E5=85=85=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E7=9A=84=E8=B7=A8=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Knowledge_Test_Go/internal/cmd/cmd.go | 1 + Knowledge_Test_Go/internal/controller/knowledge.go | 18 +++++++++--------- .../internal/controller/questionBank.go | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Knowledge_Test_Go/internal/cmd/cmd.go b/Knowledge_Test_Go/internal/cmd/cmd.go index 568e8ba..25d9087 100644 --- a/Knowledge_Test_Go/internal/cmd/cmd.go +++ b/Knowledge_Test_Go/internal/cmd/cmd.go @@ -34,6 +34,7 @@ var ( s.Group("/admin", func(group *ghttp.RouterGroup) { group.Middleware( ghttp.MiddlewareHandlerResponse, + ghttp.MiddlewareCORS, ) group.POST("/questions/get", controller.NewQuestionBank().GetQuestions) // 获取题目列表 group.POST("/questions/update", controller.NewQuestionBank().QuestionUpdate) // 新增修改题目 diff --git a/Knowledge_Test_Go/internal/controller/knowledge.go b/Knowledge_Test_Go/internal/controller/knowledge.go index ab6942b..933ab54 100644 --- a/Knowledge_Test_Go/internal/controller/knowledge.go +++ b/Knowledge_Test_Go/internal/controller/knowledge.go @@ -9,14 +9,14 @@ import ( "github.com/gogf/gf/v2/net/ghttp" ) -type cKnowledgeTest struct{} +type CKnowledgeTest struct{} -func NewKnowledgeTest() *cKnowledgeTest { - return &cKnowledgeTest{} +func NewKnowledgeTest() *CKnowledgeTest { + return &CKnowledgeTest{} } // GetQuestions 获取题目列表 -func (c *cKnowledgeTest) GetQuestions(r *ghttp.Request) { +func (c *CKnowledgeTest) GetQuestions(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.GetQuestionsReq if err := r.Parse(&req); err != nil { @@ -33,7 +33,7 @@ func (c *cKnowledgeTest) GetQuestions(r *ghttp.Request) { } // GetUserScores 获取用户成绩 -func (c *cKnowledgeTest) GetUserScores(r *ghttp.Request) { +func (c *CKnowledgeTest) GetUserScores(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.GetUserScoresReq if err := r.Parse(&req); err != nil { @@ -46,8 +46,8 @@ func (c *cKnowledgeTest) GetUserScores(r *ghttp.Request) { response.JsonExit(r, 200, "success", res) } -// GetScores 获取课程推荐 -func (c *cKnowledgeTest) GetCourse(r *ghttp.Request) { +// GetCourse 获取用户课程 +func (c *CKnowledgeTest) GetCourse(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.GetCourseReq if err := r.Parse(&req); err != nil { @@ -61,7 +61,7 @@ func (c *cKnowledgeTest) GetCourse(r *ghttp.Request) { } // SubmitAnswers 提交答案 -func (c *cKnowledgeTest) SubmitAnswers(r *ghttp.Request) { +func (c *CKnowledgeTest) SubmitAnswers(r *ghttp.Request) { ctx := r.GetCtx() var req v1.SubmitAnswersReq if err := r.Parse(&req); err != nil { @@ -77,7 +77,7 @@ func (c *cKnowledgeTest) SubmitAnswers(r *ghttp.Request) { } // GetWrongQuestions 获取错题列表 -func (c *cKnowledgeTest) GetWrongQuestions(r *ghttp.Request) { +func (c *CKnowledgeTest) GetWrongQuestions(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.GetWrongQuestionsReq if err := r.Parse(&req); err != nil { diff --git a/Knowledge_Test_Go/internal/controller/questionBank.go b/Knowledge_Test_Go/internal/controller/questionBank.go index 9814342..4c9ec21 100644 --- a/Knowledge_Test_Go/internal/controller/questionBank.go +++ b/Knowledge_Test_Go/internal/controller/questionBank.go @@ -9,14 +9,14 @@ import ( "github.com/gogf/gf/v2/net/ghttp" ) -type cQuestionBank struct{} +type CQuestionBank struct{} -func NewQuestionBank() *cQuestionBank { - return &cQuestionBank{} +func NewQuestionBank() *CQuestionBank { + return &CQuestionBank{} } // GetQuestions 获取题目列表 -func (c *cQuestionBank) GetQuestions(r *ghttp.Request) { +func (c *CQuestionBank) GetQuestions(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.QuestionOutputReq if err := r.Parse(&req); err != nil { @@ -33,7 +33,7 @@ func (c *cQuestionBank) GetQuestions(r *ghttp.Request) { } // QuestionUpdate 获取题目列表 -func (c *cQuestionBank) QuestionUpdate(r *ghttp.Request) { +func (c *CQuestionBank) QuestionUpdate(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.QuestionUpdateReq if err := r.Parse(&req); err != nil { @@ -49,7 +49,7 @@ func (c *cQuestionBank) QuestionUpdate(r *ghttp.Request) { } // QuestionDel 删除题目 -func (c *cQuestionBank) QuestionDel(r *ghttp.Request) { +func (c *CQuestionBank) QuestionDel(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.QuestionDelReq if err := r.Parse(&req); err != nil { @@ -65,7 +65,7 @@ func (c *cQuestionBank) QuestionDel(r *ghttp.Request) { } // UserScoreOutput 获取用户成绩列表 -func (c *cQuestionBank) UserScoreOutput(r *ghttp.Request) { +func (c *CQuestionBank) UserScoreOutput(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.UserScoreOutputReq if err := r.Parse(&req); err != nil { @@ -82,7 +82,7 @@ func (c *cQuestionBank) UserScoreOutput(r *ghttp.Request) { } // ErrorOutPutUser 错题统计出错用户 -func (c *cQuestionBank) ErrorOutPutUser(r *ghttp.Request) { +func (c *CQuestionBank) ErrorOutPutUser(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.ErrorOutPutUserReq if err := r.Parse(&req); err != nil { @@ -99,7 +99,7 @@ func (c *cQuestionBank) ErrorOutPutUser(r *ghttp.Request) { } // ExportQuestion 导出题目数据到 Excel -func (c *cQuestionBank) ExportQuestion(r *ghttp.Request) { +func (c *CQuestionBank) ExportQuestion(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.QuestionOutputReq if err := r.Parse(&req); err != nil { @@ -109,7 +109,7 @@ func (c *cQuestionBank) ExportQuestion(r *ghttp.Request) { } // ExportUserScore 导出用户成绩到 Excel -func (c *cQuestionBank) ExportUserScore(r *ghttp.Request) { +func (c *CQuestionBank) ExportUserScore(r *ghttp.Request) { ctx := r.GetCtx() var req *v1.UserScoreOutputReq if err := r.Parse(&req); err != nil {