log_opt_controller.go 828 字节
package controllers

import (
	"github.com/linmadan/egglib-go/core/application"
	"github.com/linmadan/egglib-go/web/beego"
	service "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/log_opt"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/log_opt/command"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)

type LogOptController struct {
	beego.BaseController
}

func (controller *LogOptController) ListLog() {
	logService := service.NewLogOptService()
	in := &command.QueryLogCommand{}
	if err := controller.Unmarshal(in); err != nil {
		controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error()))
	} else {
		ua := middlewares.GetUser(controller.Ctx)
		in.CompanyId = ua.CompanyId
		controller.Response(logService.List(in))
	}
}