push log add

pull/103/head
Gordon 3 years ago
parent 2e14e0f767
commit 51622e77d4

@ -6,13 +6,14 @@ import (
"Open_IM/src/push/jpush/requestBody"
"bytes"
"encoding/json"
"io/ioutil"
"net/http"
)
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
_ = pf.SetPlatform(platform)
@ -46,8 +47,9 @@ func JGAccountListPush(accounts []string, jsonCustomContent string, platform str
return nil, err
}
defer resp.Body.Close()
result, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return resp, nil
return result, nil
}

@ -24,7 +24,7 @@ func Init(rpcPort int) {
log.NewPrivateLog(config.Config.ModuleName.PushName)
rpcServer.Init(rpcPort)
pushCh.Init()
pushTerminal = []int32{utils.IOSPlatformID, utils.AndroidPlatformID}
pushTerminal = []int32{utils.AndroidPlatformID}
}
func init() {
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)
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…
Cancel
Save