service/app/mix/controller/hvyogo_api.go

93 lines
2.1 KiB
Go
Raw Normal View History

2024-06-17 22:25:43 +08:00
package controller
import (
"service/api/errcode"
2024-06-28 23:25:22 +08:00
"service/api/message/response"
2024-06-17 22:25:43 +08:00
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)
// 存入数据
2024-06-21 18:25:24 +08:00
data, ec, err := service.DefaultService.ApiHvyogoQueryAgreeState(ctx, req)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
2024-06-18 20:07:42 +08:00
if ec != errcode.ErrCodeHvyogoSrvOk {
2024-06-17 22:25:43 +08:00
logger.Error("ApiHygQueryAgreeState fail, req: %v, ec: %v", util.ToJson(req), ec)
2024-06-18 19:40:09 +08:00
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, data)
}
func ApiHvyogoWorkerFindDetail(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*hvyogoproto.ApiWorkerFindDetailReq)
// 存入数据
2024-06-21 18:25:24 +08:00
data, ec, err := service.DefaultService.ApiHvyogoWorkerFindDetail(ctx, req)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
2024-06-18 20:07:42 +08:00
if ec != errcode.ErrCodeHvyogoSrvOk {
2024-06-18 19:40:09 +08:00
logger.Error("ApiHygWorkerFindDetail fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
2024-06-17 22:25:43 +08:00
return
}
2024-06-28 20:39:34 +08:00
ReplyOk(ctx, data)
2024-06-17 22:25:43 +08:00
}
func ApiHvyogoSingleDistribute(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*hvyogoproto.ApiSingleDistributeReq)
// 存入数据
2024-06-21 18:25:24 +08:00
data, ec, err := service.DefaultService.ApiHvyogoSingleDistribute(ctx, req)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
2024-06-18 20:07:42 +08:00
if ec != errcode.ErrCodeHvyogoSrvOk {
2024-06-17 22:25:43 +08:00
logger.Error("ApiHygSingleDistribute fail, req: %v, ec: %v", util.ToJson(req), ec)
2024-06-18 19:40:09 +08:00
ReplyErrCodeMsg(ctx, ec)
2024-06-17 22:25:43 +08:00
return
}
2024-06-28 23:25:22 +08:00
if data.StatusCode != response.StatusCodeSuccess {
ReplyErrorMsg(ctx, data.StatusText)
}
2024-06-17 22:25:43 +08:00
ReplyOk(ctx, data)
}
2024-06-21 18:25:24 +08:00
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
}
2024-06-28 20:39:34 +08:00
ReplyOk(ctx, data)
2024-06-21 18:25:24 +08:00
}