diff --git a/api/errcode/errcode.go b/api/errcode/errcode.go index 53cd00c8..8f44644a 100644 --- a/api/errcode/errcode.go +++ b/api/errcode/errcode.go @@ -222,6 +222,9 @@ var ErrCodeMsgMap = map[ErrCode]string{ ErrCodeUnhandleableSingleDistributeStatus: "无法处理的下发打款状态", ErrCodeHvyogoSrvFail: "慧用工接口服务错误", + + ErrCodeRavenIQTestSrvFail: "瑞文智商测试表服务错误", + ErrCodeRavenIQTestNotExist: "瑞文智商测试表不存在", } const ( @@ -542,4 +545,9 @@ const ( // Websocket: 1xxxxx ErrCodeHandleWsFail ErrCode = -100001 // 长链连接失败 + // RavenIQTest: 101xxx + ErrCodeRavenIQTestSrvOk ErrCode = ErrCodeOk + ErrCodeRavenIQTestSrvFail ErrCode = -101001 // 瑞文智商测试表服务错误 + ErrCodeRavenIQTestNotExist ErrCode = -101002 // 瑞文智商测试表不存在 + ) 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 new file mode 100644 index 00000000..b2fa0457 --- /dev/null +++ b/api/proto/Raven_IQ_test/proto/Raven_IQ_test_api.go @@ -0,0 +1,35 @@ +package proto + +import ( + "service/api/base" + "service/dbstruct" +) + +// op 创建 +type ApiCreateReq struct { + base.BaseRequest + *dbstruct.RavenIQTest +} + +type ApiCreateData struct { +} + +type ApiCreateResp struct { + base.BaseResponse + Data *ApiCreateData `json:"data"` +} + +// op 列表 +type ApiListReq struct { + base.BaseRequest + Id *int64 `json:"id"` +} + +type ApiListData struct { + *dbstruct.RavenIQTest +} + +type ApiListResp struct { + base.BaseResponse + Data *ApiListData `json:"data"` +} diff --git a/api/proto/Raven_IQ_test/proto/Raven_IQ_test_op.go b/api/proto/Raven_IQ_test/proto/Raven_IQ_test_op.go new file mode 100644 index 00000000..3f9c3601 --- /dev/null +++ b/api/proto/Raven_IQ_test/proto/Raven_IQ_test_op.go @@ -0,0 +1,66 @@ +package proto + +import ( + "service/api/base" + "service/dbstruct" +) + +// op 创建 +type OpCreateReq struct { + base.BaseRequest + *dbstruct.RavenIQTest +} + +type OpCreateData struct { +} + +type OpCreateResp struct { + base.BaseResponse + Data *OpCreateData `json:"data"` +} + +// op 删除 +type OpDeleteReq struct { + base.BaseRequest + Id int64 `json:"id"` +} + +type OpDeleteData struct { +} + +type OpDeleteResp struct { + base.BaseResponse + Data *OpDeleteData `json:"data"` +} + +// op 更新 +type OpUpdateReq struct { + base.BaseRequest + *dbstruct.RavenIQTest +} + +type OpUpdateData struct { +} + +type OpUpdateResp struct { + base.BaseResponse + Data *OpUpdateData `json:"data"` +} + +// op 列表 +type OpListReq struct { + base.BaseRequest + Offset int `json:"offset"` + Limit int `json:"limit"` +} + +type OpListData struct { + List []*dbstruct.RavenIQTest `json:"list"` + Offset int `json:"offset"` + More int `json:"more"` +} + +type OpListResp struct { + base.BaseResponse + Data *OpListData `json:"data"` +} 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 new file mode 100644 index 00000000..2511a7a7 --- /dev/null +++ b/api/proto/Raven_IQ_test/proto/Raven_IQ_test_vo_api.go @@ -0,0 +1,41 @@ +package proto + +import ( + "service/dbstruct" +) + +type ApiListVO struct { + Id int64 `json:"id"` // 瑞文智商测试表id + UserId int64 `json:"user_id"` // 用户id + Age int64 `json:"age" ` // 年龄 + TotalScores int64 `json:"total_scores"` // 总得分 + IQ float64 `json:"IQ"` // 智商值 + Percentile int64 `json:"percentile"` // 百分位 + Description string `json:"description"` // 描述 + ClassScoreList []*ApiClassSocreVO `json:"class_score_list"` // 大类得分list +} + +type ApiClassSocreVO struct { + ClassId int64 `json:"class_id"` // 大类id + Score int64 `json:"score"` // 得分 + Suggestions string `json:"suggestions"` // 建议 +} + +func (vo *ApiListVO) CopyRavenIQTest(test *dbstruct.RavenIQTest) *ApiListVO { + if test == nil { + return vo + } + vo.Id = test.GetId() + vo.UserId = test.GetUserId() + vo.Age = test.GetAge() + vo.TotalScores = test.GetTotalScores() + vo.IQ = test.GetIQ() + vo.ClassScoreList = make([]*ApiClassSocreVO, 0) + for _, score := range test.ClassScoreList { + vo.ClassScoreList = append(vo.ClassScoreList, &ApiClassSocreVO{ + ClassId: score.GetClassId(), + Score: score.GetScore(), + }) + } + return vo +} diff --git a/api/proto/Raven_IQ_test/proto/not_null_def_api.go b/api/proto/Raven_IQ_test/proto/not_null_def_api.go new file mode 100644 index 00000000..3259bcad --- /dev/null +++ b/api/proto/Raven_IQ_test/proto/not_null_def_api.go @@ -0,0 +1,19 @@ +package proto + +import ( + "service/library/validator" +) + +// api 查询 +func (p *ApiCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) { + params = make([]*validator.JsonParam, 0) + params = append(params, validator.NewInt64PtrParam("请提供您的年龄!", p.Age)) + return params +} + +// api 经验增长 +func (p *ApiListReq) ProvideNotNullValue() (params []*validator.JsonParam) { + params = make([]*validator.JsonParam, 0) + params = append(params, validator.NewInt64PtrParam("请提供待查询的id!", p.Id)) + return params +} diff --git a/app/mix/controller/Raven_IQ_test_controller_center.go b/app/mix/controller/Raven_IQ_test_controller_center.go new file mode 100644 index 00000000..1bac47ec --- /dev/null +++ b/app/mix/controller/Raven_IQ_test_controller_center.go @@ -0,0 +1,8 @@ +Raven_IQ_testproto "service/api/proto/Raven_IQ_test/proto" + + // 瑞文智商测试表 + opRavenIQTestGroup := r.Group("/api/Raven_IQ_test", PrepareToC()) + opRavenIQTestGroup.POST("create", middleware.JSONParamValidator(Raven_IQ_testproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateRavenIQTest) + opRavenIQTestGroup.POST("update", middleware.JSONParamValidator(Raven_IQ_testproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateRavenIQTest) + opRavenIQTestGroup.POST("delete", middleware.JSONParamValidator(Raven_IQ_testproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteRavenIQTest) + opRavenIQTestGroup.POST("list", middleware.JSONParamValidator(Raven_IQ_testproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetRavenIQTestList) \ No newline at end of file diff --git a/app/mix/controller/Raven_IQ_test_op.go b/app/mix/controller/Raven_IQ_test_op.go new file mode 100644 index 00000000..b8c69f56 --- /dev/null +++ b/app/mix/controller/Raven_IQ_test_op.go @@ -0,0 +1,71 @@ +package controller + +import ( + "github.com/gin-gonic/gin" + "service/api/errcode" + Raven_IQ_testproto "service/api/proto/Raven_IQ_test/proto" + "service/app/mix/service" + "service/bizcommon/util" + "service/library/logger" +) + +func OpCreateRavenIQTest(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*Raven_IQ_testproto.OpCreateReq) + ec := service.DefaultService.OpCreateRavenIQTest(ctx, req) + if ec != errcode.ErrCodeRavenIQTestSrvOk { + logger.Error("OpCreateRavenIQTest fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrorMsg(ctx, "server error") + return + } + + ReplyOk(ctx, nil) +} + +func OpUpdateRavenIQTest(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*Raven_IQ_testproto.OpUpdateReq) + ec := service.DefaultService.OpUpdateRavenIQTest(ctx, req) + if ec != errcode.ErrCodeRavenIQTestSrvOk { + logger.Error("OpUpdateRavenIQTest fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + ReplyOk(ctx, nil) +} + +func OpDeleteRavenIQTest(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*Raven_IQ_testproto.OpDeleteReq) + ec := service.DefaultService.OpDeleteRavenIQTest(ctx, req.Id) + if ec != errcode.ErrCodeRavenIQTestSrvOk { + logger.Error("OpDeleteRavenIQTest fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + ReplyOk(ctx, nil) +} + +func OpGetRavenIQTestList(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*Raven_IQ_testproto.OpListReq) + + //设置默认页长 + if req.Limit == 0 { + req.Limit = consts.DefaultPageSize + } + + list, ec := service.DefaultService.OpGetRavenIQTestList(ctx, req) + if ec != errcode.ErrCodeRavenIQTestSrvOk { + logger.Error("OpGetRavenIQTestList fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + data := &Raven_IQ_testproto.OpListData{ + List: list, + Offset: req.Offset + len(list), + } + if len(list) >= req.Limit { + data.More = 1 + } + ReplyOk(ctx, data) +} diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index d79d0bb8..29f17d6b 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -17,6 +17,7 @@ import ( "go.mongodb.org/mongo-driver/bson" options2 "go.mongodb.org/mongo-driver/mongo/options" + Raven_IQ_testproto "service/api/proto/Raven_IQ_test/proto" accountproto "service/api/proto/account/proto" account_cancellationproto "service/api/proto/account_cancellation/proto" accountpunishmentproto "service/api/proto/accountpunishment/proto" @@ -226,6 +227,9 @@ const ( DBSingleDistributeHis = "single_distribute_his" COLSingleDistributeHis = "single_distribute_his" COLSingleDistributeLock = "single_distribute_lock" + + DBRavenIQTest = "Raven_IQ_test" + COLRavenIQTest = "Raven_IQ_test" ) // 商品表 @@ -577,6 +581,11 @@ func (m *Mongo) getColSingleDistributeLock() *qmgo.Collection { return m.clientMix.Database(DBSingleDistributeHis).Collection(COLSingleDistributeLock) } +// 瑞文智商测试表表 +func (m *Mongo) getColRavenIQTest() *qmgo.Collection { + return m.clientMix.Database(DBRavenIQTest).Collection(COLRavenIQTest) +} + // 商品相关 func (m *Mongo) CreateProduct(ctx *gin.Context, product *dbstruct.Product) error { col := m.getColProduct() @@ -5554,3 +5563,61 @@ func (m *Mongo) GetSingleDistributeHisById(ctx *gin.Context, id string) (*dbstru } return one, err } + +// 瑞文智商测试表相关 +func (m *Mongo) CreateRavenIQTest(ctx *gin.Context, Raven_IQ_test *dbstruct.RavenIQTest) error { + col := m.getColRavenIQTest() + _, err := col.InsertOne(ctx, Raven_IQ_test) + return err +} + +func (m *Mongo) UpdateRavenIQTest(ctx *gin.Context, Raven_IQ_test *dbstruct.RavenIQTest) error { + col := m.getColRavenIQTest() + set := util.EntityToM(Raven_IQ_test) + set["ut"] = time.Now().Unix() + up := qmgo.M{ + "$set": set, + } + err := col.UpdateId(ctx, Raven_IQ_test.Id, up) + return err +} + +func (m *Mongo) DeleteRavenIQTest(ctx *gin.Context, id int64) error { + col := m.getColRavenIQTest() + update := qmgo.M{ + "$set": qmgo.M{ + "del_flag": 1, + }, + } + err := col.UpdateId(ctx, id, update) + return err +} + +func (m *Mongo) GetRavenIQTestList(ctx *gin.Context, req *Raven_IQ_testproto.OpListReq) ([]*dbstruct.RavenIQTest, error) { + list := make([]*dbstruct.RavenIQTest, 0) + col := m.getColRavenIQTest() + query := qmgo.M{ + "del_flag": 0, + } + err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return list, err + } + return list, err +} + +func (m *Mongo) GetRavenIQTestById(ctx *gin.Context, id int64) (*dbstruct.RavenIQTest, error) { + test := &dbstruct.RavenIQTest{} + col := m.getColRavenIQTest() + query := qmgo.M{ + "_id": id, + "del_flag": 0, + } + err := col.Find(ctx, query).One(test) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return test, err + } + return test, err +} diff --git a/app/mix/dao/mongo_idseq.go b/app/mix/dao/mongo_idseq.go index ab01dc16..eeee723d 100644 --- a/app/mix/dao/mongo_idseq.go +++ b/app/mix/dao/mongo_idseq.go @@ -62,6 +62,9 @@ const ( COLImageAuditRTI = "image_audit_rti" COLTextAuditRTI = "text_audit_rti" COLVideoModerationRTI = "video_moderation_rti" + + DBRavenIQTestIdSeq = "Raven_IQ_test_id_seq" + COLRavenIQTestIdSeq = "Raven_IQ_test_id_seq" ) // UserIdSeq序列表 @@ -159,6 +162,11 @@ func (m *Mongo) getColVideoModerationRTI() *qmgo.Collection { return m.clientMix.Database(DBContentAuditRTI).Collection(COLVideoModerationRTI) } +// AccountIdSeq序列表 +func (m *Mongo) getColRavenIQTestIdSeq() *qmgo.Collection { + return m.clientMix.Database(DBRavenIQTestIdSeq).Collection(COLRavenIQTestIdSeq) +} + // account_id发号器 func (m *Mongo) GetAndUpdateAccountIdSeq(ctx *gin.Context) (accountIdSeq *dbstruct.AccountIdSeq, err error) { col := m.getColAccountIdSeq() @@ -569,3 +577,22 @@ func (m *Mongo) GetVideoModerationBatchId(ctx *gin.Context) (videoModerationBatc return } + +// Raven_IQ_test_id发号器 +func (m *Mongo) GetAndUpdateRavenIQTestIdSeq(ctx *gin.Context) (Raven_IQ_testIdSeq *dbstruct.RavenIQTestIdSeq, err error) { + col := m.getColRavenIQTestIdSeq() + + change := qmgo.Change{ + Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, + Upsert: true, + ReturnNew: false, + } + + instance := dbstruct.RavenIQTestIdSeq{} + if err = col.Find(ctx, qmgo.M{"_id": "Raven_IQ_test_id_seq_id"}).Apply(change, &instance); err != nil { + logger.Error("change error : %v", err) + return + } + + return &instance, err +} diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 2bff4b54..96709e1e 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -49,6 +49,8 @@ import ( "strings" "time" + Raven_IQ_testproto "service/api/proto/Raven_IQ_test/proto" + "go.mongodb.org/mongo-driver/mongo" goproto "google.golang.org/protobuf/proto" @@ -3585,3 +3587,42 @@ func (s *Service) ApiHvyogoWorkerUpdate(ctx *gin.Context, req *hvyogoproto.ApiWo return } + +// RavenIQTest +func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto.ApiCreateReq) (ec errcode.ErrCode) { + ec = errcode.ErrCodeRavenIQTestSrvOk + err := _DefaultRavenIQTest.OpCreate(ctx, &Raven_IQ_testproto.OpCreateReq{ + BaseRequest: req.BaseRequest, + RavenIQTest: req.RavenIQTest, + }) + if err != nil { + logger.Error("ApiCreate fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeRavenIQTestSrvFail + return + } + return +} + +func (s *Service) ApiGetRavenIQTestList(ctx *gin.Context, req *Raven_IQ_testproto.ApiListReq) (vo *Raven_IQ_testproto.ApiListVO, ec errcode.ErrCode) { + ec = errcode.ErrCodeRavenIQTestSrvOk + + vo = &Raven_IQ_testproto.ApiListVO{} + + test, err := _DefaultRavenIQTest.GetById(ctx, util.DerefInt64(req.Id)) + if err != nil { + logger.Error("ApiGetRavenIQTest fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeRavenIQTestSrvFail + return + } + if test == nil { + logger.Error("No RavenIQTest entity was found, req: %v", util.ToJson(req)) + ec = errcode.ErrCodeRavenIQTestNotExist + return + } + + vo.CopyRavenIQTest(test) + + // 填充业务数据 + + return +} diff --git a/app/mix/service/logic/RavenIQTest.go b/app/mix/service/logic/RavenIQTest.go new file mode 100644 index 00000000..b807ec52 --- /dev/null +++ b/app/mix/service/logic/RavenIQTest.go @@ -0,0 +1,81 @@ +package logic + +import ( + "service/api/consts" + Raven_IQ_testproto "service/api/proto/Raven_IQ_test/proto" + "service/app/mix/dao" + "service/dbstruct" + "service/library/logger" + "time" + + "github.com/gin-gonic/gin" + goproto "google.golang.org/protobuf/proto" +) + +type RavenIQTest struct { + store *dao.Store +} + +func NewRavenIQTest(store *dao.Store) (a *RavenIQTest) { + a = &RavenIQTest{ + store: store, + } + return +} + +func (p *RavenIQTest) OpCreate(ctx *gin.Context, req *Raven_IQ_testproto.OpCreateReq) error { + + //产生mid + idSeq, err := p.store.GetAndUpdateRavenIQTestIdSeq(ctx) + if err != nil { + logger.Error("GetAndUpdateRavenIQTestIdSeq failed : %v", err) + return err + } + + req.RavenIQTest.Id = goproto.Int64(idSeq.Seq) + req.RavenIQTest.Ct = goproto.Int64(time.Now().Unix()) + req.RavenIQTest.Ut = goproto.Int64(time.Now().Unix()) + req.RavenIQTest.DelFlag = goproto.Int64(consts.Exist) + err = p.store.CreateRavenIQTest(ctx, req.RavenIQTest) + if err != nil { + logger.Error("CreateRavenIQTest fail, err: %v", err) + return err + } + return nil +} + +func (p *RavenIQTest) OpUpdate(ctx *gin.Context, req *Raven_IQ_testproto.OpUpdateReq) error { + err := p.store.UpdateRavenIQTest(ctx, req.RavenIQTest) + if err != nil { + logger.Error("UpdateRavenIQTest fail, err: %v", err) + return err + } + return nil +} + +func (p *RavenIQTest) OpDelete(ctx *gin.Context, id int64) error { + err := p.store.DeleteRavenIQTest(ctx, id) + if err != nil { + logger.Error("DeleteRavenIQTest fail, err: %v", err) + return err + } + return nil +} + +func (p *RavenIQTest) OpList(ctx *gin.Context, req *Raven_IQ_testproto.OpListReq) ([]*dbstruct.RavenIQTest, error) { + list, err := p.store.GetRavenIQTestList(ctx, req) + if err != nil { + logger.Error("GetRavenIQTestList fail, err: %v", err) + return make([]*dbstruct.RavenIQTest, 0), err + } + return list, nil +} + +func (p *RavenIQTest) GetById(ctx *gin.Context, id int64) (*dbstruct.RavenIQTest, error) { + test, err := p.store.GetRavenIQTestById(ctx, id) + if err != nil { + logger.Error("GetRavenIQTestListByIds fail, id: %v, err: %v", id, err) + return nil, err + } + return test, nil +} diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 170a40cb..706ab7a7 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -140,6 +140,7 @@ var ( _DefaultStreamerScore *logic.StreamerScore _DefaultWorkerId *logic.WorkerId _DefaultSingleDistributeHis *logic.SingleDistributeHis + _DefaultRavenIQTest *logic.RavenIQTest ) type Service struct { @@ -235,6 +236,7 @@ func (s *Service) Init(c any) (err error) { _DefaultStreamerScore = logic.NewStreamerScore(store) _DefaultWorkerId = logic.NewWorkerId(store) _DefaultSingleDistributeHis = logic.NewSingleDistributeHis(store) + _DefaultRavenIQTest = logic.NewRavenIQTest(store) _DefaultVas = logic.NewVas(store, _DefaultStreamer, _DefaultAccount, _DefaultZone, _DefaultZoneThirdPartner, _DefaultZoneCollaborator) _DefaultStreamerAcct = logic.NewStreamerAcct(store) diff --git a/codecreate/codecreate.go b/codecreate/codecreate.go index 645bf5ac..723a640e 100644 --- a/codecreate/codecreate.go +++ b/codecreate/codecreate.go @@ -9,10 +9,10 @@ import ( func main() { genSource := &generator.GenSource{ - EntityName: "SingleDistributeHis", - ModuleName: "single_distribute_his", - EntityCNName: "慧用工下发打款历史表", - ErrCodeSeq: "42", + EntityName: "RavenIQTest", + ModuleName: "Raven_IQ_test", + EntityCNName: "瑞文智商测试表", + ErrCodeSeq: "101", } generator.CreateFileDirectory(genSource) diff --git a/codecreate/resource/EntityDefine.xlsx b/codecreate/resource/EntityDefine.xlsx index d65c315b..45cf4458 100644 Binary files a/codecreate/resource/EntityDefine.xlsx and b/codecreate/resource/EntityDefine.xlsx differ diff --git a/dbstruct/RavenIQTest.go b/dbstruct/RavenIQTest.go new file mode 100644 index 00000000..5f42b80a --- /dev/null +++ b/dbstruct/RavenIQTest.go @@ -0,0 +1,73 @@ +package dbstruct + +type RavenIQTest struct { + Id *int64 `json:"id" bson:"_id"` // 瑞文智商测试表id + UserId *int64 `json:"user_id" bson:"user_id"` // 用户id + Age *int64 `json:"age" bson:"age"` // 年龄 + TotalScores *int64 `json:"total_scores" bson:"total_scores"` // 总得分 + IQ *float64 `json:"IQ" bson:"IQ"` // 智商值 + AnswerList []*RavenIQTestAnswer `json:"answer_list" bson:"answer_list"` // 答案list + ClassScoreList []*RavenIQTestClassScore `json:"class_score_list" bson:"class_score_list"` // 大类得分list + Ct *int64 `json:"ct" bson:"ct"` // 创建时间 + Ut *int64 `json:"ut" bson:"ut"` // 更新时间 + DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 +} + +type RavenIQTestAnswer struct { + QuestionId *int64 `json:"question_id" bson:"question_id"` // 问题Id + SelectedOption *int64 `json:"selected_option" bson:"selected_option"` // 选择的选项 +} + +type RavenIQTestClassScore struct { + ClassId *int64 `json:"class_id" bson:"class_id"` // 大类id + Score *int64 `json:"score" bson:"score"` // 得分 +} + +func (p *RavenIQTest) GetId() int64 { + if p == nil || p.Id == nil { + return -1 + } + return *p.Id +} + +func (p *RavenIQTest) GetUserId() int64 { + if p == nil || p.UserId == nil { + return -1 + } + return *p.UserId +} + +func (p *RavenIQTest) GetAge() int64 { + if p == nil || p.UserId == nil { + return 0 + } + return *p.Age +} + +func (p *RavenIQTest) GetTotalScores() int64 { + if p == nil || p.TotalScores == nil { + return 0 + } + return *p.TotalScores +} + +func (p *RavenIQTest) GetIQ() float64 { + if p == nil || p.IQ == nil { + return 0 + } + return *p.IQ +} + +func (p *RavenIQTestClassScore) GetClassId() int64 { + if p == nil || p.ClassId == nil { + return 0 + } + return *p.ClassId +} + +func (p *RavenIQTestClassScore) GetScore() int64 { + if p == nil || p.Score == nil { + return 0 + } + return *p.Score +} diff --git a/dbstruct/idSeq.go b/dbstruct/idSeq.go index 6be66020..9c650a25 100644 --- a/dbstruct/idSeq.go +++ b/dbstruct/idSeq.go @@ -80,3 +80,7 @@ type TextAuditBatchId struct { type VideoModerationBatchId struct { BatchId string `json:"batch_id" bson:"batch_id"` //视频审核批次号 } + +type RavenIQTestIdSeq struct { + Seq int64 //用户Id序列号 +}