194 lines
6.5 KiB
Go
194 lines
6.5 KiB
Go
package sys
|
|
|
|
import (
|
|
"context"
|
|
|
|
"hotgo/api/admin/maoyucontent"
|
|
"hotgo/api/admin/maoyupet"
|
|
"hotgo/internal/model/input/sysin"
|
|
"hotgo/internal/service"
|
|
)
|
|
|
|
// 毛隅管理页面控制器:内容治理 + 萌宠管理,业务经 maoyu-server 内部接口处理。
|
|
|
|
var (
|
|
MaoyuContent = cMaoyuContent{}
|
|
MaoyuPet = cMaoyuPet{}
|
|
)
|
|
|
|
type (
|
|
cMaoyuContent struct{}
|
|
cMaoyuPet struct{}
|
|
)
|
|
|
|
// ---- 内容治理 ----
|
|
|
|
func (*cMaoyuContent) Dashboard(ctx context.Context, req *maoyucontent.MaoyuContentDashboardReq) (res *maoyucontent.MaoyuContentDashboardRes, err error) {
|
|
data, err := service.SysMaoyuContent().Dashboard(ctx, &req.MaoyuDashboardInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &maoyucontent.MaoyuContentDashboardRes{MaoyuDashboardModel: data}, nil
|
|
}
|
|
|
|
func (*cMaoyuContent) List(ctx context.Context, req *maoyucontent.MaoyuContentListReq) (res *maoyucontent.MaoyuContentListRes, err error) {
|
|
list, total, err := service.SysMaoyuContent().List(ctx, req.CultivateContentListInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if list == nil {
|
|
list = []*sysin.CultivateContentListModel{}
|
|
}
|
|
res = &maoyucontent.MaoyuContentListRes{List: list}
|
|
res.PageRes.Pack(req, total)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuContent) View(ctx context.Context, req *maoyucontent.MaoyuContentViewReq) (res *maoyucontent.MaoyuContentViewRes, err error) {
|
|
data, err := service.SysMaoyuContent().View(ctx, req.CultivateContentViewInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &maoyucontent.MaoyuContentViewRes{CultivateContentViewModel: data}, nil
|
|
}
|
|
|
|
func (*cMaoyuContent) Review(ctx context.Context, req *maoyucontent.MaoyuContentReviewReq) (res *maoyucontent.MaoyuContentReviewRes, err error) {
|
|
err = service.SysMaoyuContent().Review(ctx, req.CultivateContentReviewInp)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuContent) BatchReview(ctx context.Context, req *maoyucontent.MaoyuContentBatchReviewReq) (res *maoyucontent.MaoyuContentBatchReviewRes, err error) {
|
|
data, err := service.SysMaoyuContent().BatchReview(ctx, req.CultivateContentBatchReviewInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &maoyucontent.MaoyuContentBatchReviewRes{CultivateContentBatchReviewModel: data}, nil
|
|
}
|
|
|
|
func (*cMaoyuContent) ReportList(ctx context.Context, req *maoyucontent.MaoyuReportListReq) (res *maoyucontent.MaoyuReportListRes, err error) {
|
|
list, total, err := service.SysMaoyuContent().ReportList(ctx, req.CultivateReportListInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if list == nil {
|
|
list = []*sysin.CultivateReportListModel{}
|
|
}
|
|
res = &maoyucontent.MaoyuReportListRes{List: list}
|
|
res.PageRes.Pack(req, total)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuContent) ReportView(ctx context.Context, req *maoyucontent.MaoyuReportViewReq) (res *maoyucontent.MaoyuReportViewRes, err error) {
|
|
data, err := service.SysMaoyuContent().ReportView(ctx, req.CultivateReportViewInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &maoyucontent.MaoyuReportViewRes{CultivateReportViewModel: data}, nil
|
|
}
|
|
|
|
func (*cMaoyuContent) ReportHandle(ctx context.Context, req *maoyucontent.MaoyuReportHandleReq) (res *maoyucontent.MaoyuReportHandleRes, err error) {
|
|
err = service.SysMaoyuContent().ReportHandle(ctx, req.CultivateReportHandleInp)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuContent) LogList(ctx context.Context, req *maoyucontent.MaoyuLogListReq) (res *maoyucontent.MaoyuLogListRes, err error) {
|
|
list, total, err := service.SysMaoyuContent().LogList(ctx, req.CultivateOperationLogListInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if list == nil {
|
|
list = []*sysin.CultivateOperationLogListModel{}
|
|
}
|
|
res = &maoyucontent.MaoyuLogListRes{List: list}
|
|
res.PageRes.Pack(req, total)
|
|
return
|
|
}
|
|
|
|
// ---- 萌宠管理 ----
|
|
|
|
func (*cMaoyuPet) ActionConfigList(ctx context.Context, req *maoyupet.MaoyuActionConfigListReq) (res *maoyupet.MaoyuActionConfigListRes, err error) {
|
|
list, total, err := service.SysMaoyuPet().ActionConfigList(ctx, req.MaoyuActionConfigListInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if list == nil {
|
|
list = []*sysin.MaoyuActionConfigListModel{}
|
|
}
|
|
res = &maoyupet.MaoyuActionConfigListRes{List: list}
|
|
res.PageRes.Pack(req, total)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuPet) ActionConfigView(ctx context.Context, req *maoyupet.MaoyuActionConfigViewReq) (res *maoyupet.MaoyuActionConfigViewRes, err error) {
|
|
data, err := service.SysMaoyuPet().ActionConfigView(ctx, req.MaoyuActionConfigViewInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &maoyupet.MaoyuActionConfigViewRes{MaoyuActionConfigViewModel: data}, nil
|
|
}
|
|
|
|
func (*cMaoyuPet) ActionConfigEdit(ctx context.Context, req *maoyupet.MaoyuActionConfigEditReq) (res *maoyupet.MaoyuActionConfigEditRes, err error) {
|
|
err = service.SysMaoyuPet().ActionConfigEdit(ctx, req.MaoyuActionConfigEditInp)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuPet) ActionConfigStatus(ctx context.Context, req *maoyupet.MaoyuActionConfigStatusReq) (res *maoyupet.MaoyuActionConfigStatusRes, err error) {
|
|
err = service.SysMaoyuPet().ActionConfigStatus(ctx, req.MaoyuActionConfigStatusInp)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuPet) PetList(ctx context.Context, req *maoyupet.MaoyuPetListReq) (res *maoyupet.MaoyuPetListRes, err error) {
|
|
list, total, err := service.SysMaoyuPet().PetList(ctx, req.MaoyuPetListInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if list == nil {
|
|
list = []*sysin.MaoyuPetListModel{}
|
|
}
|
|
res = &maoyupet.MaoyuPetListRes{List: list}
|
|
res.PageRes.Pack(req, total)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuPet) PetView(ctx context.Context, req *maoyupet.MaoyuPetViewReq) (res *maoyupet.MaoyuPetViewRes, err error) {
|
|
data, err := service.SysMaoyuPet().PetView(ctx, req.MaoyuPetViewInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &maoyupet.MaoyuPetViewRes{MaoyuPetViewModel: data}, nil
|
|
}
|
|
|
|
func (*cMaoyuPet) JobList(ctx context.Context, req *maoyupet.MaoyuJobListReq) (res *maoyupet.MaoyuJobListRes, err error) {
|
|
list, total, err := service.SysMaoyuPet().JobList(ctx, req.MaoyuJobListInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if list == nil {
|
|
list = []*sysin.MaoyuJobListModel{}
|
|
}
|
|
res = &maoyupet.MaoyuJobListRes{List: list}
|
|
res.PageRes.Pack(req, total)
|
|
return
|
|
}
|
|
|
|
func (*cMaoyuPet) JobView(ctx context.Context, req *maoyupet.MaoyuJobViewReq) (res *maoyupet.MaoyuJobViewRes, err error) {
|
|
data, err := service.SysMaoyuPet().JobView(ctx, req.MaoyuJobViewInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &maoyupet.MaoyuJobViewRes{MaoyuJobViewModel: data}, nil
|
|
}
|
|
|
|
func (*cMaoyuPet) NoticeList(ctx context.Context, req *maoyupet.MaoyuNoticeListReq) (res *maoyupet.MaoyuNoticeListRes, err error) {
|
|
list, total, err := service.SysMaoyuPet().NoticeList(ctx, req.MaoyuNoticeListInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if list == nil {
|
|
list = []*sysin.MaoyuNoticeListModel{}
|
|
}
|
|
res = &maoyupet.MaoyuNoticeListRes{List: list}
|
|
res.PageRes.Pack(req, total)
|
|
return
|
|
}
|