httplib_mmm_open_api_service_gateway.go
1.2 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
package service_gateway
import (
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
"strings"
"time"
)
type HttplibMmmOpenApiServiceGateway struct {
httplibBaseServiceGateway
}
func (serviceGateway *HttplibMmmOpenApiServiceGateway) PushInfo(msgType int, uids []int64, title string, content string, ext map[string]interface{}) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "v1", "push", "pushInfo"}, "/")
request := serviceGateway.createRequest(url, "post")
options := make(map[string]interface{})
options["mmmType"] = msgType
options["project"] = "worth"
options["receivers"] = uids
options["title"] = title
options["content"] = content
options["ext"] = ext
request.JSONBody(options)
response := make(map[string]interface{})
request.ToJSON(&response)
data, err := serviceGateway.responseHandle(response)
return data, err
}
func NewHttplibMmmOpenApiServiceGateway() *HttplibMmmOpenApiServiceGateway {
return &HttplibMmmOpenApiServiceGateway{
httplibBaseServiceGateway: httplibBaseServiceGateway{
baseURL: constant.MMM_OPEN_API_SERVICE_HOST,
connectTimeout: 100 * time.Second,
readWriteTimeout: 30 * time.Second,
},
}
}