digitization_server.go
2.0 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
package service_gateway
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
"strconv"
"time"
)
type HttpLibAlliedCreationStandardServiceGateway struct {
HttpLibBaseServiceGateway
baseURL string
}
type Field struct {
Index int `json:"index"`
Name string `json:"name"`
SqlType string `json:"sqlType"`
SqlName string `json:"sqlName"`
Flag int `json:"flag"`
}
type Conditions struct {
Field *Field `json:"field"`
In []string `json:"in"`
Ex []string `json:"ex"`
}
type Where struct { //输入
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
Conditions []*Conditions `json:"conditions"`
}
func NewHttpLibAlliedCreationStandardServiceGateway() *HttpLibAlliedCreationStandardServiceGateway {
return &HttpLibAlliedCreationStandardServiceGateway{
HttpLibBaseServiceGateway: HttpLibBaseServiceGateway{
ConnectTimeout: 100 * time.Second,
ReadWriteTimeout: 30 * time.Second,
},
baseURL: constant.ALLIED_CREATION_STANDARD,
}
}
//获取下拉列表0
func (serviceGateway *HttpLibAlliedCreationStandardServiceGateway) GetBusiness() (map[string]interface{}, error) {
AppKey := "gBzrh4BBeVeGQbRngPTUTRZOAcqtSVr9" //可更改
AppSecret := "oCUsnka2RUjMKPWjiUbSOcKbqV1pYsaT" //产品不一样密钥不一样
timestamp := strconv.FormatInt(time.Now().Unix(), 10) //当前时间戳
sign := utils.GenMd5(AppKey + AppSecret + timestamp)
//serviceGateway.baseURL="http://127.1.0.1:8080"
req, err := serviceGateway.CreateRequest(serviceGateway.baseURL+"/data/business/search", "post").Header("AppKey", AppKey).Header("Timestamp", timestamp).Header("Sign", sign).JSONBody(map[string]interface{}{})
if err != nil {
return nil, err
}
//var response DataTableSearch
response := make(map[string]interface{})
err = req.ToJSON(&response)
if err != nil {
return nil, err
}
data, err := serviceGateway.responseHandle(response)
return data, err
}