From 62efdad5c02f940c012078ac8155aec79520aa76 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Mon, 22 Jul 2024 13:45:57 +0800 Subject: [PATCH] 1 --- .../proto/Raven_IQ_test_vo_api.go | 34 +++++++++---------- apollostruct/RavenIQtest.go | 23 ++++++++++--- app/mix/service/apiservice.go | 7 ++-- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/api/proto/Raven_IQ_test/proto/Raven_IQ_test_vo_api.go b/api/proto/Raven_IQ_test/proto/Raven_IQ_test_vo_api.go index abd90fba..0eb58447 100644 --- a/api/proto/Raven_IQ_test/proto/Raven_IQ_test_vo_api.go +++ b/api/proto/Raven_IQ_test/proto/Raven_IQ_test_vo_api.go @@ -1,25 +1,23 @@ package proto import ( + "service/apollostruct" "service/dbstruct" ) type ApiListVO struct { - Id int64 `json:"id"` // 瑞文智商测试表id - UserId int64 `json:"user_id"` // 用户id - Age int64 `json:"age"` // 年龄 - TotalScore float64 `json:"total_score"` // 总得分 - IQBlockId int64 `json:"IQ_block_id"` // 智商值 - Percentile int64 `json:"percentile"` // 百分位 - Description string `json:"description"` // 描述 - ClassScoreList []*ApiClassSocreVO `json:"class_score_list"` // 大类得分list + Id int64 `json:"id"` // 瑞文智商测试表id + UserId int64 `json:"user_id"` // 用户id + Age int64 `json:"age"` // 年龄 + TotalScore float64 `json:"total_score"` // 总得分 + *apollostruct.IQResult + ClassScoreList []*ApiClassScoreVO `json:"class_score_list"` // 大类得分list } -type ApiClassSocreVO struct { - ClassId int64 `json:"class_id"` // 大类id - Score int64 `json:"score"` // 得分 - ClassBlockId int64 `json:"class_block_id"` // 大类得分key - Suggestions string `json:"suggestions"` // 建议 +type ApiClassScoreVO struct { + ClassBlockId int64 `json:"class_block_id"` // 大类得分key + Score int64 `json:"score"` // 总分 + *apollostruct.ClassResult } func (vo *ApiListVO) CopyRavenIQTest(test *dbstruct.RavenIQTest) *ApiListVO { @@ -31,12 +29,14 @@ func (vo *ApiListVO) CopyRavenIQTest(test *dbstruct.RavenIQTest) *ApiListVO { vo.Age = test.GetAge() vo.TotalScore = test.GetTotalScore() vo.IQBlockId = test.GetIQBlockId() - vo.ClassScoreList = make([]*ApiClassSocreVO, 0) + vo.ClassScoreList = make([]*ApiClassScoreVO, 0) for _, score := range test.ClassScoreList { - vo.ClassScoreList = append(vo.ClassScoreList, &ApiClassSocreVO{ - ClassId: score.GetClassId(), - Score: score.GetScore(), + vo.ClassScoreList = append(vo.ClassScoreList, &ApiClassScoreVO{ ClassBlockId: score.GetClassBlockId(), + Score: score.GetScore(), + ClassResult: &apollostruct.ClassResult{ + ClassId: score.GetClassId(), + }, }) } return vo diff --git a/apollostruct/RavenIQtest.go b/apollostruct/RavenIQtest.go index 7d0efe66..ec2ba71d 100644 --- a/apollostruct/RavenIQtest.go +++ b/apollostruct/RavenIQtest.go @@ -11,9 +11,10 @@ type RavenIQTestQuestion struct { } type IQResult struct { - IQBlockId int64 `json:"IQ_Block_Id"` // IQ分段id - Percentile int64 `json:"percentile"` // 百分位 - Description string `json:"description"` // 描述 + IQBlockId int64 `json:"IQ_Block_Id"` // IQ分段id + Percentile int64 `json:"percentile"` // 百分位 + Description string `json:"description"` // 描述 + Suggestions []string `json:"suggestions"` // 建议 } type AgeScore2IQResultMapCfg struct { @@ -31,8 +32,20 @@ type IQResultMapCfg struct { } type ClassResult struct { - ClassId int64 `json:"class_id"` // 大类id - Description string `json:"description"` // 描述 + ClassId int64 `json:"class_id"` // 大类id + Description string `json:"description"` // 描述 + Analysis string `json:"analysis"` // 成绩分析 + Suggestions []*Suggestion `json:"suggestions"` // 建议 +} + +type Suggestion struct { + Title string `json:"title"` + Tips []*Tip `json:"tips"` +} + +type Tip struct { + Summary string `json:"summary"` // 概括 + Content string `json:"content"` // 内容 } type ClassResultMapCfg struct { diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index b8d6eb95..97461d85 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3696,13 +3696,10 @@ func (s *Service) ApiGetRavenIQTestList(ctx *gin.Context, req *Raven_IQ_testprot return } - IQResult := IQResultMpcfg.Map[vo.IQBlockId] - vo.Percentile = IQResult.Percentile - vo.Description = IQResult.Description + vo.IQResult = IQResultMpcfg.Map[vo.IQBlockId] for _, classScore := range vo.ClassScoreList { - classResult := classResultMpCfg.Map[classScore.ClassBlockId] - classScore.Suggestions = classResult.Description + classScore.ClassResult = classResultMpCfg.Map[classScore.ClassBlockId] } return