httplib_message_service_gateway.go
970 字节
package service_gateway
import (
"strings"
"time"
)
type HttplibMessageServiceGateway struct {
httplibBaseServiceGateway
}
// PushMessage 推送消息
func (serviceGateway *HttplibMessageServiceGateway) PushMessage(msgType int, projects []string, uids []int64, title string, content string) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "v1", "push", "pushInfo"}, "/")
request := serviceGateway.createRequest(url, "post")
options := map[string]interface{}{}
_, _ = request.JSONBody(options)
response := make(map[string]interface{})
_ = request.ToJSON(&response)
data, err := serviceGateway.responseHandle(response)
return data, err
}
func NewHttplibMessageServiceGateway() *HttplibMessageServiceGateway {
return &HttplibMessageServiceGateway{
httplibBaseServiceGateway: httplibBaseServiceGateway{
baseURL: "",
connectTimeout: 100 * time.Second,
readWriteTimeout: 30 * time.Second,
},
}
}