config_controller.go 3.0 KB
package controllers

import (
	"github.com/astaxie/beego"
	"github.com/linmadan/egglib-go/web/beego/utils"
	"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/config/query"
	"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/config/service"
)

type ConfigController struct {
	beego.Controller
}

func (controller *ConfigController) ListTaskStatus() {
	configService := service.NewConfigService(nil)
	listTaskStatusQuery := &query.ListTaskStatusQuery{}
	data, err := configService.ListTaskStatus(listTaskStatusQuery)
	var response utils.JsonResponse
	if err != nil {
		response = utils.ResponseError(controller.Ctx, err)
	} else {
		response = utils.ResponseData(controller.Ctx, data)
	}
	controller.Data["json"] = response
	controller.ServeJSON()
}

func (controller *ConfigController) ListTaskType() {
	configService := service.NewConfigService(nil)
	listTaskTypeQuery := &query.ListTaskTypeQuery{}
	data, err := configService.ListTaskType(listTaskTypeQuery)
	var response utils.JsonResponse
	if err != nil {
		response = utils.ResponseError(controller.Ctx, err)
	} else {
		response = utils.ResponseData(controller.Ctx, data)
	}
	controller.Data["json"] = response
	controller.ServeJSON()
}

func (controller *ConfigController) ListTaskNature() {
	configService := service.NewConfigService(nil)
	listTaskNatureQuery := &query.ListTaskNatureQuery{}
	data, err := configService.ListTaskNature(listTaskNatureQuery)
	var response utils.JsonResponse
	if err != nil {
		response = utils.ResponseError(controller.Ctx, err)
	} else {
		response = utils.ResponseData(controller.Ctx, data)
	}
	controller.Data["json"] = response
	controller.ServeJSON()
}

func (controller *ConfigController) ListCustomerValue() {
	configService := service.NewConfigService(nil)
	listCustomerValueQuery := &query.ListCustomerValueQuery{}
	data, err := configService.ListCustomerValue(listCustomerValueQuery)
	var response utils.JsonResponse
	if err != nil {
		response = utils.ResponseError(controller.Ctx, err)
	} else {
		response = utils.ResponseData(controller.Ctx, data)
	}
	controller.Data["json"] = response
	controller.ServeJSON()
}

func (controller *ConfigController) ListReferenceResourceType() {
	configService := service.NewConfigService(nil)
	listReferenceResourceTypeQuery := &query.ListReferenceResourceTypeQuery{}
	data, err := configService.ListReferenceResourceType(listReferenceResourceTypeQuery)
	var response utils.JsonResponse
	if err != nil {
		response = utils.ResponseError(controller.Ctx, err)
	} else {
		response = utils.ResponseData(controller.Ctx, data)
	}
	controller.Data["json"] = response
	controller.ServeJSON()
}

func (controller *ConfigController) ListBidTimeMatch() {
	configService := service.NewConfigService(nil)
	listBidTimeMatchQuery := &query.ListBidTimeMatchQuery{}
	data, err := configService.ListBidTimeMatch(listBidTimeMatchQuery)
	var response utils.JsonResponse
	if err != nil {
		response = utils.ResponseError(controller.Ctx, err)
	} else {
		response = utils.ResponseData(controller.Ctx, data)
	}
	controller.Data["json"] = response
	controller.ServeJSON()
}