diff --git a/api/proto/Raven_IQ_test/proto/Raven_IQ_test_api.go b/api/proto/Raven_IQ_test/proto/Raven_IQ_test_api.go index e9702a7b..e0ca724e 100644 --- a/api/proto/Raven_IQ_test/proto/Raven_IQ_test_api.go +++ b/api/proto/Raven_IQ_test/proto/Raven_IQ_test_api.go @@ -12,6 +12,7 @@ type ApiCreateReq struct { } type ApiCreateData struct { + Id int64 `json:"id"` } type ApiCreateResp struct { diff --git a/app/mix/controller/Raven_IQ_test_api.go b/app/mix/controller/Raven_IQ_test_api.go index e2eb67a8..643275e2 100644 --- a/app/mix/controller/Raven_IQ_test_api.go +++ b/app/mix/controller/Raven_IQ_test_api.go @@ -12,14 +12,17 @@ import ( func ApiCreateRavenIQTest(ctx *gin.Context) { req := ctx.MustGet("client_req").(*Raven_IQ_testproto.ApiCreateReq) - ec := service.DefaultService.ApiCreateRavenIQTest(ctx, req) + id, ec := service.DefaultService.ApiCreateRavenIQTest(ctx, req) if ec != errcode.ErrCodeRavenIQTestSrvOk { logger.Error("ApiCreateRavenIQTest fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrorMsg(ctx, "server error") return } - ReplyOk(ctx, nil) + data := &Raven_IQ_testproto.ApiCreateData{ + Id: id, + } + ReplyOk(ctx, data) } func ApiGetRavenIQTestList(ctx *gin.Context) { diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 5be910ce..568e5b08 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3589,7 +3589,7 @@ func (s *Service) ApiHvyogoWorkerUpdate(ctx *gin.Context, req *hvyogoproto.ApiWo } // RavenIQTest -func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto.ApiCreateReq) (ec errcode.ErrCode) { +func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto.ApiCreateReq) (id int64, ec errcode.ErrCode) { ec = errcode.ErrCodeRavenIQTestSrvOk // 缓存数据准备 @@ -3597,7 +3597,7 @@ func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto err := apollo.GetJson(consts.QuestionMapKey, &questionMapcfg, apollo.ApolloOpts().SetNamespace("Raven_IQ_test")) if err != nil { logger.Error("Apollo read failed : %v", err) - return errcode.ErrCodeApolloReadFail + return -1, errcode.ErrCodeApolloReadFail } ageScore2IQResultMapCfg := apollostruct.AgeScore2IQResultMapCfg{} @@ -3624,7 +3624,7 @@ func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto for _, answer := range req.AnswerList { question, ok := questionMapcfg.Map[answer.GetQuestionId()] if !ok { - return errcode.ErrCodeRavenIQTestQuestionNotExist + return -1, errcode.ErrCodeRavenIQTestQuestionNotExist } if answer.GetSelectedOption() == question.CorrectOption { classScoreMap[answer.GetQuestionId()] += 1 @@ -3665,6 +3665,8 @@ func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto ec = errcode.ErrCodeRavenIQTestSrvFail return } + + id = req.RavenIQTest.GetId() return }