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 b2fa0457..e9702a7b 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 @@ -26,7 +26,7 @@ type ApiListReq struct { } type ApiListData struct { - *dbstruct.RavenIQTest + *ApiListVO } type ApiListResp struct { diff --git a/app/mix/controller/Raven_IQ_test_api.go b/app/mix/controller/Raven_IQ_test_api.go new file mode 100644 index 00000000..e2eb67a8 --- /dev/null +++ b/app/mix/controller/Raven_IQ_test_api.go @@ -0,0 +1,39 @@ +package controller + +import ( + "service/api/errcode" + Raven_IQ_testproto "service/api/proto/Raven_IQ_test/proto" + "service/app/mix/service" + "service/bizcommon/util" + "service/library/logger" + + "github.com/gin-gonic/gin" +) + +func ApiCreateRavenIQTest(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*Raven_IQ_testproto.ApiCreateReq) + 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) +} + +func ApiGetRavenIQTestList(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*Raven_IQ_testproto.ApiListReq) + + vo, ec := service.DefaultService.ApiGetRavenIQTestList(ctx, req) + if ec != errcode.ErrCodeRavenIQTestSrvOk { + logger.Error("ApiGetRavenIQTestList fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + data := &Raven_IQ_testproto.ApiListData{ + ApiListVO: vo, + } + ReplyOk(ctx, data) +} diff --git a/app/mix/controller/Raven_IQ_test_controller_center.go b/app/mix/controller/Raven_IQ_test_controller_center.go deleted file mode 100644 index 1bac47ec..00000000 --- a/app/mix/controller/Raven_IQ_test_controller_center.go +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index b8c69f56..00000000 --- a/app/mix/controller/Raven_IQ_test_op.go +++ /dev/null @@ -1,71 +0,0 @@ -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/controller/init.go b/app/mix/controller/init.go index 5a2f44e2..550a736e 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -19,6 +19,7 @@ import ( "service/api/base" "service/api/consts" "service/api/errcode" + 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" @@ -269,6 +270,11 @@ func Init(r *gin.Engine) { apiHvyogoGroup.POST("single_distribute", middleware.JSONParamValidator(hvyogoproto.ApiSingleDistributeReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiHvyogoSingleDistribute) apiHvyogoGroup.POST("worker_update", middleware.JSONParamValidator(hvyogoproto.ApiWorkerUpdateReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiHvyogoWorkerUpdate) + // 瑞文智商测试表 + apiRavenIQTestGroup := r.Group("/api/Raven_IQ_test", PrepareToC()) + apiRavenIQTestGroup.POST("create", middleware.JSONParamValidator(Raven_IQ_testproto.ApiCreateReq{}), ApiCreateRavenIQTest) + apiRavenIQTestGroup.POST("list", middleware.JSONParamValidator(Raven_IQ_testproto.ApiListReq{}), ApiGetRavenIQTestList) + // =============================== 以下是服务,只允许内网调用 =============================== // op相关,直接调用服务,不调用gateway