Files
open-im-server/pkg/common/db/controller/third.go
T

29 lines
836 B
Go
Raw Normal View History

2023-03-01 15:32:26 +08:00
package controller
import (
"context"
2023-06-19 13:02:49 +08:00
2023-03-16 10:46:06 +08:00
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
2023-03-01 15:32:26 +08:00
)
type ThirdDatabase interface {
FcmUpdateToken(ctx context.Context, account string, platformID int, fcmToken string, expireTime int64) error
SetAppBadge(ctx context.Context, userID string, value int) error
}
type thirdDatabase struct {
2023-05-04 12:11:29 +08:00
cache cache.MsgModel
2023-03-01 15:32:26 +08:00
}
2023-05-04 12:11:29 +08:00
func NewThirdDatabase(cache cache.MsgModel) ThirdDatabase {
2023-03-01 15:32:26 +08:00
return &thirdDatabase{cache: cache}
}
func (t *thirdDatabase) FcmUpdateToken(ctx context.Context, account string, platformID int, fcmToken string, expireTime int64) error {
return t.cache.SetFcmToken(ctx, account, platformID, fcmToken, expireTime)
}
func (t *thirdDatabase) SetAppBadge(ctx context.Context, userID string, value int) error {
return t.cache.SetUserBadgeUnreadCountSum(ctx, userID, value)
}