This commit is contained in:
wangchuxiao
2023-02-22 19:51:14 +08:00
parent 2b38381296
commit 94d50a6c71
31 changed files with 500 additions and 602 deletions
+30 -2
View File
@@ -1,13 +1,32 @@
package getui
import "Open_IM/pkg/common/config"
import (
"Open_IM/pkg/common/config"
"fmt"
)
type CommonResp struct {
type Resp struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
func (r *Resp) parseError() (err error) {
switch r.Code {
case tokenExpireCode:
err = TokenExpireError
case 0:
err = nil
default:
err = fmt.Errorf("code %d, msg %s", r.Code, r.Msg)
}
return err
}
type RespI interface {
parseError() error
}
type AuthReq struct {
Sign string `json:"sign"`
Timestamp string `json:"timestamp"`
@@ -95,6 +114,10 @@ type Options struct {
} `json:"VV"`
}
type Payload struct {
IsSignal bool `json:"isSignal"`
}
func newPushReq(title, content string) PushReq {
pushReq := PushReq{PushMessage: &PushMessage{Notification: &Notification{
Title: title,
@@ -106,6 +129,11 @@ func newPushReq(title, content string) PushReq {
return pushReq
}
func newBatchPushReq(userIDs []string, taskID string) PushReq {
var IsAsync = true
return PushReq{Audience: &Audience{Alias: userIDs}, IsAsync: &IsAsync, TaskID: &taskID}
}
func (pushReq *PushReq) setPushChannel(title string, body string) {
pushReq.PushChannel = &PushChannel{}
// autoBadge := "+1"