common_controller.go 1.3 KB
package controllers

import (
	"io/ioutil"

	"github.com/linmadan/egglib-go/web/beego"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/service"
)

type CommonController struct {
	beego.BaseController
}

func (controller *CommonController) GetDictionaryByCode() {
	commonService := service.NewCommonService(nil)
	queryParam := &query.GetDictionaryByCodeQuery{}
	_ = controller.Unmarshal(queryParam)
	data, err := commonService.GetDictionaryByCode(queryParam)
	controller.Response(data, err)
}

func (controller *CommonController) LatestVersionInfo() {
	commonService := service.NewCommonService(nil)
	queryParam := &query.GetDictionaryByCodeQuery{}
	_ = controller.Unmarshal(queryParam)
	data, err := commonService.LatestVersionInfo()
	controller.Response(data, err)
}

func (controller *CommonController) AppSharing() {
	commonService := service.NewCommonService(nil)
	queryParam := &query.GetDictionaryByCodeQuery{}
	_ = controller.Unmarshal(queryParam)
	data, err := commonService.AppSharing()
	controller.Response(data, err)
}

func (controller *CommonController) LogData() {
	bytes, _ := ioutil.ReadFile("./app.log")
	controller.Ctx.WriteString(string(bytes))
}