64 lines
1.9 KiB
Go
64 lines
1.9 KiB
Go
package controller
|
|
|
|
import (
|
|
"service/api/errcode"
|
|
zone_third_partnerproto "service/api/proto/zone_third_partner/proto"
|
|
"service/app/mix/service"
|
|
"service/bizcommon/util"
|
|
"service/library/logger"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func OpCreateZoneThirdPartner(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpCreateReq)
|
|
ec := service.DefaultService.OpCreateZoneThirdPartner(ctx, req)
|
|
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
|
logger.Error("OpCreateZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrorMsg(ctx, "server error")
|
|
return
|
|
}
|
|
|
|
ReplyOk(ctx, nil)
|
|
}
|
|
|
|
func OpUpdateZoneThirdPartner(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpUpdateReq)
|
|
ec := service.DefaultService.OpUpdateZoneThirdPartner(ctx, req)
|
|
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
|
logger.Error("OpUpdateZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
ReplyOk(ctx, nil)
|
|
}
|
|
|
|
func OpDeleteZoneThirdPartner(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpDeleteReq)
|
|
ec := service.DefaultService.OpDeleteZoneThirdPartner(ctx, req.Id)
|
|
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
|
logger.Error("OpDeleteZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
ReplyOk(ctx, nil)
|
|
}
|
|
|
|
func OpGetZoneThirdPartnerList(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpListReq)
|
|
|
|
zoneThirdPartner, ec := service.DefaultService.OpGetZoneThirdPartnerList(ctx, req)
|
|
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
|
logger.Error("OpGetZoneThirdPartnerList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
data := &zone_third_partnerproto.OpListData{
|
|
ZoneThirdPartner: zoneThirdPartner,
|
|
}
|
|
ReplyOk(ctx, data)
|
|
}
|