service/app/mix/controller/Raven_IQ_test_api.go

43 lines
1.1 KiB
Go

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)
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
}
data := &Raven_IQ_testproto.ApiCreateData{
Id: id,
}
ReplyOk(ctx, data)
}
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)
}