common_controller.go
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 {
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.GetLatestVersionQuery{}
_ = controller.Unmarshal(queryParam)
queryParam.Request = controller.Ctx.Request
queryParam.DeviceType = controller.GetDeviceType()
data, err := commonService.LatestVersionInfo(queryParam)
controller.Response(data, err)
}
func (controller *CommonController) AdvancedSetting() {
commonService := service.NewCommonService(nil)
queryParam := &query.GetAdvancedSettingQuery{}
_ = controller.Unmarshal(queryParam)
data, err := commonService.AdvancedSetting(queryParam)
controller.Response(data, err)
}
func (controller *CommonController) AppSharing() {
commonService := service.NewCommonService(nil)
queryParam := &query.GetLatestVersionQuery{}
_ = controller.Unmarshal(queryParam)
queryParam.Request = controller.Ctx.Request
queryParam.DeviceType = controller.GetDeviceType()
data, err := commonService.AppSharing(queryParam)
controller.Response(data, err)
}
func (controller *CommonController) LogData() {
bytes, _ := ioutil.ReadFile("./app.log")
controller.Ctx.WriteString(string(bytes))
}