ws and push update

This commit is contained in:
Gordon
2022-06-02 16:44:55 +08:00
parent 48410c428a
commit a18dcfce9e
10 changed files with 163 additions and 60 deletions
+5 -5
View File
@@ -8,7 +8,7 @@ import (
http2 "net/http"
)
func callbackUserOnline(operationID, userID string, platformID int32, token string) cbApi.CommonCallbackResp {
func callbackUserOnline(operationID, userID string, platformID int, token string) cbApi.CommonCallbackResp {
callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
if !config.Config.Callback.CallbackUserOnline.Enable {
return callbackResp
@@ -19,7 +19,7 @@ func callbackUserOnline(operationID, userID string, platformID int32, token stri
CallbackCommand: constant.CallbackUserOnlineCommand,
OperationID: operationID,
UserID: userID,
PlatformID: platformID,
PlatformID: int32(platformID),
Platform: constant.PlatformIDToName(platformID),
}}
callbackUserOnlineResp := &cbApi.CallbackUserOnlineResp{CommonCallbackResp: callbackResp}
@@ -30,7 +30,7 @@ func callbackUserOnline(operationID, userID string, platformID int32, token stri
return callbackResp
}
func callbackUserOffline(operationID, userID string, platform string) cbApi.CommonCallbackResp {
func callbackUserOffline(operationID, userID string, platformID int) cbApi.CommonCallbackResp {
callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
if !config.Config.Callback.CallbackUserOffline.Enable {
return callbackResp
@@ -39,8 +39,8 @@ func callbackUserOffline(operationID, userID string, platform string) cbApi.Comm
CallbackCommand: constant.CallbackUserOfflineCommand,
OperationID: operationID,
UserID: userID,
PlatformID: constant.PlatformNameToID(platform),
Platform: platform,
PlatformID: int32(platformID),
Platform: constant.PlatformIDToName(platformID),
}}
callbackUserOfflineResp := &cbApi.CallbackUserOfflineResp{CommonCallbackResp: callbackResp}
if err := http.PostReturn(config.Config.Callback.CallbackUrl, callbackOfflineReq, callbackUserOfflineResp, config.Config.Callback.CallbackUserOffline.CallbackTimeOut); err != nil {