task_controller.go 855 字节
package controllers

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

type TaskController struct {
	beego.BaseController
}

func (c *TaskController) GetTaskInfo() {
	srv := service.NewTaskService()
	paramReq := &command.GetTaskCommand{}
	err := c.BindJSON(paramReq)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)

	paramReq.CompanyId = int(userReq.CompanyId)
	data, err := srv.GetTaskInfo(paramReq)
	c.Response(data, err)
}