service/app/mix/controller/hvyogo_api.go

94 lines
2.1 KiB
Go

package controller
import (
"service/api/errcode"
"service/api/message/response"
hvyogoproto "service/api/proto/hvyogo/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"github.com/gin-gonic/gin"
)
func ApiHvyogoQueryAgreeState(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*hvyogoproto.ApiQueryAgreeStateReq)
// 存入数据
data, ec, err := service.DefaultService.ApiHvyogoQueryAgreeState(ctx, req)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
if ec != errcode.ErrCodeHvyogoSrvOk {
logger.Error("ApiHygQueryAgreeState fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, data)
}
func ApiHvyogoWorkerFindDetail(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*hvyogoproto.ApiWorkerFindDetailReq)
// 存入数据
data, ec, err := service.DefaultService.ApiHvyogoWorkerFindDetail(ctx, req)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
if ec != errcode.ErrCodeHvyogoSrvOk {
logger.Error("ApiHygWorkerFindDetail fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, data)
}
func ApiHvyogoSingleDistribute(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*hvyogoproto.ApiSingleDistributeReq)
// 存入数据
data, ec, err := service.DefaultService.ApiHvyogoSingleDistribute(ctx, req)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
if ec != errcode.ErrCodeHvyogoSrvOk {
logger.Error("ApiHygSingleDistribute fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
if data.StatusCode != response.StatusCodeSuccess {
ReplyErrorMsg(ctx, data.StatusText)
return
}
ReplyOk(ctx, data)
}
func ApiHvyogoWorkerUpdate(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*hvyogoproto.ApiWorkerUpdateReq)
// 存入数据
data, ec, err := service.DefaultService.ApiHvyogoWorkerUpdate(ctx, req)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
if ec != errcode.ErrCodeHvyogoSrvOk {
logger.Error("ApiHygWorkerUpdate fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, data)
}