mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 21:02:11 +08:00
fix: pkg update.
This commit is contained in:
parent
ca89004086
commit
be06145e47
@ -18,20 +18,24 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/openimsdk/tools/utils/httputil"
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/v3/internal/push/offlinepush"
|
"github.com/openimsdk/open-im-server/v3/internal/push/offlinepush"
|
||||||
"github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/jpush/body"
|
"github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/jpush/body"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
http2 "github.com/openimsdk/open-im-server/v3/pkg/common/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type JPush struct {
|
type JPush struct {
|
||||||
pushConf *config.Push
|
pushConf *config.Push
|
||||||
iOSPushConf *config.IOSPush
|
iOSPushConf *config.IOSPush
|
||||||
|
httpClient *httputil.HTTPClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(pushConf *config.Push, iOSPushConf *config.IOSPush) *JPush {
|
func NewClient(pushConf *config.Push, iOSPushConf *config.IOSPush) *JPush {
|
||||||
return &JPush{pushConf: pushConf, iOSPushConf: iOSPushConf}
|
return &JPush{pushConf: pushConf,
|
||||||
|
iOSPushConf: iOSPushConf,
|
||||||
|
httpClient: httputil.NewHTTPClient(httputil.NewClientConfig()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *JPush) Auth(apiKey, secretKey string, timeStamp int64) (token string, err error) {
|
func (j *JPush) Auth(apiKey, secretKey string, timeStamp int64) (token string, err error) {
|
||||||
@ -79,7 +83,7 @@ func (j *JPush) Push(ctx context.Context, userIDs []string, title, content strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (j *JPush) request(ctx context.Context, po body.PushObj, resp any, timeout int) error {
|
func (j *JPush) request(ctx context.Context, po body.PushObj, resp any, timeout int) error {
|
||||||
return http2.PostReturn(
|
return j.httpClient.PostReturn(
|
||||||
ctx,
|
ctx,
|
||||||
j.pushConf.Jpns.PushUrl,
|
j.pushConf.Jpns.PushUrl,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user