mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
push log add
This commit is contained in:
parent
2e14e0f767
commit
51622e77d4
@ -6,13 +6,14 @@ import (
|
|||||||
"Open_IM/src/push/jpush/requestBody"
|
"Open_IM/src/push/jpush/requestBody"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
type JPushResp struct {
|
type JPushResp struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func JGAccountListPush(accounts []string, jsonCustomContent string, platform string) (*http.Response, error) {
|
func JGAccountListPush(accounts []string, jsonCustomContent string, platform string) ([]byte, error) {
|
||||||
|
|
||||||
var pf requestBody.Platform
|
var pf requestBody.Platform
|
||||||
_ = pf.SetPlatform(platform)
|
_ = pf.SetPlatform(platform)
|
||||||
@ -46,8 +47,9 @@ func JGAccountListPush(accounts []string, jsonCustomContent string, platform str
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
result, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return resp, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ func Init(rpcPort int) {
|
|||||||
log.NewPrivateLog(config.Config.ModuleName.PushName)
|
log.NewPrivateLog(config.Config.ModuleName.PushName)
|
||||||
rpcServer.Init(rpcPort)
|
rpcServer.Init(rpcPort)
|
||||||
pushCh.Init()
|
pushCh.Init()
|
||||||
pushTerminal = []int32{utils.IOSPlatformID, utils.AndroidPlatformID}
|
pushTerminal = []int32{utils.AndroidPlatformID}
|
||||||
}
|
}
|
||||||
func init() {
|
func init() {
|
||||||
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
||||||
|
@ -68,7 +68,12 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
|
|||||||
}
|
}
|
||||||
bCustomContent, _ := json.Marshal(customContent)
|
bCustomContent, _ := json.Marshal(customContent)
|
||||||
jsonCustomContent := string(bCustomContent)
|
jsonCustomContent := string(bCustomContent)
|
||||||
push.JGAccountListPush(UIDList, jsonCustomContent, utils.PlatformIDToName(t))
|
pushResult, err := push.JGAccountListPush(UIDList, jsonCustomContent, utils.PlatformIDToName(t))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), t)
|
||||||
|
} else {
|
||||||
|
log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, t)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user