service.go
2.4 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package service
import (
"fmt"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/version_server"
)
const IOSPage = "http://fir.fjmaimaimai.com/pdvn"
const ANDPage = "http://fir.fjmaimaimai.com/ben1"
type CommonService struct {
}
func NewCommonService(options map[string]interface{}) *CommonService {
return &CommonService{}
}
//GetDictionaryByCode 根据code获取字典数据
func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) {
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{})
result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{
DictCodes: getDictionaryQuery.DictCode,
})
if err != nil {
return nil, err
}
return result, nil
}
//LatestVersionInfo 版本升级
func (srv *CommonService) LatestVersionInfo(q *query.GetLatestVersionQuery) (interface{}, error) {
vs := version_server.NewHttpLibVersionServer()
data, err := vs.GetLatestVersion(q.Request, version_server.ReqLatestVersion{
VersionNo: q.VersionNo,
Channel: q.Channel,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return data, nil
}
//AppSharing 获取分享链接地址
func (srv *CommonService) AppSharing(q *query.GetLatestVersionQuery) (interface{}, error) {
vs := version_server.NewHttpLibVersionServer()
data, err := vs.GetLatestVersion(q.Request, version_server.ReqLatestVersion{
VersionNo: q.VersionNo,
Channel: q.Channel,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return data, nil
}
// AdvancedSetting 高级查询 配置
func (srv *CommonService) AdvancedSetting(q *query.GetAdvancedSettingQuery) (interface{}, error) {
if err := q.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
m, ok := domain.GetModel(q.Model)
if !ok {
return nil, application.ThrowError(application.BUSINESS_ERROR, fmt.Sprintf("模型:%v 不存在", q.Model))
}
return m, nil
}