95 lines
2.6 KiB
Go
95 lines
2.6 KiB
Go
package controller
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"service/api/errcode"
|
|
resourceproto "service/api/proto/resource/proto"
|
|
"service/app/mix/service"
|
|
"service/bizcommon/util"
|
|
"service/library/logger"
|
|
)
|
|
|
|
func OpSetL2CatalogIndex(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*resourceproto.OpSetL2CatalogIndexReq)
|
|
ec := service.DefaultService.OpSetL2CatalogIndex(ctx, req)
|
|
if ec != errcode.ErrCodeResourceSrvOk {
|
|
logger.Error("OpSetL2CatalogIndex fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
ReplyOk(ctx, nil)
|
|
}
|
|
|
|
func OpGetL2CatalogIndexByL1Id(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*resourceproto.OpGetL2CatalogIndexByL1IdReq)
|
|
list, ec := service.DefaultService.OpGetL2CatalogIndexByL1Id(ctx, req.L1Id)
|
|
if ec != errcode.ErrCodeResourceSrvOk {
|
|
logger.Error("OpGetL2CatalogIndexByL1Id fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
data := &resourceproto.OpGetL2CatalogIndexByL1IdData{
|
|
List: list,
|
|
}
|
|
ReplyOk(ctx, data)
|
|
}
|
|
|
|
func GetL2CatalogListByL1Id(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*resourceproto.GetL2CatalogListByL1IdReq)
|
|
list, ec := service.DefaultService.GetL2CatalogListByL1Id(ctx, req.L1Id)
|
|
if ec != errcode.ErrCodeResourceSrvOk {
|
|
logger.Error("OpGetL2CatalogIndexByL1Id fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
data := &resourceproto.GetL2CatalogListByL1IdData{
|
|
List: list,
|
|
}
|
|
ReplyOk(ctx, data)
|
|
}
|
|
|
|
func OpSetBannerIndex(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*resourceproto.OpSetBannerIndexReq)
|
|
ec := service.DefaultService.OpSetBannerIndex(ctx, req)
|
|
if ec != errcode.ErrCodeResourceSrvOk {
|
|
logger.Error("OpSetBannerIndex fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
ReplyOk(ctx, nil)
|
|
}
|
|
|
|
func OpGetBannerIndex(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*resourceproto.OpGetBannerIndexReq)
|
|
list, ec := service.DefaultService.OpGetBannerIndex(ctx)
|
|
if ec != errcode.ErrCodeResourceSrvOk {
|
|
logger.Error("OpGetBannerIndex fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
data := &resourceproto.OpGetBannerIndexData{
|
|
List: list,
|
|
}
|
|
ReplyOk(ctx, data)
|
|
}
|
|
|
|
func GetBannerList(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*resourceproto.GetBannerListReq)
|
|
list, ec := service.DefaultService.GetBannerList(ctx)
|
|
if ec != errcode.ErrCodeResourceSrvOk {
|
|
logger.Error("GetBannerList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
return
|
|
}
|
|
|
|
data := &resourceproto.GetBannerListData{
|
|
List: list,
|
|
}
|
|
ReplyOk(ctx, data)
|
|
}
|