mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-06 01:55:58 +08:00
新增 firebase cloud message 消息推送 (#236)
* 新增 firebase cloud message 消息推送 新增 api接口 /third/fcm_update_token 用于更新客户端获取到 FCM token 同步到服务器 * mongodb授权缺少授权数据库 windows下面的编译+启动
This commit is contained in:
@@ -35,6 +35,7 @@ const (
|
||||
SignalCache = "SIGNAL_CACHE:"
|
||||
SignalListCache = "SIGNAL_LIST_CACHE:"
|
||||
GlobalMsgRecvOpt = "GLOBAL_MSG_RECV_OPT"
|
||||
FcmToken = "FCM_TOKEN:"
|
||||
)
|
||||
|
||||
|
||||
@@ -427,3 +428,13 @@ func (d *DataBases) GetUserInfoFromCache(userID string) (*pbCommon.UserInfo, err
|
||||
err = json.Unmarshal(bytes, userInfo)
|
||||
return userInfo, err
|
||||
}
|
||||
|
||||
func (d *DataBases) SetFcmToken(account string, platformid int, fcmToken string, expireTime int64) (err error) {
|
||||
key := FcmToken + account + ":" + strconv.Itoa(platformid)
|
||||
return d.rdb.Set(context.Background(), key, fcmToken, time.Duration(expireTime)*time.Second).Err()
|
||||
}
|
||||
|
||||
func (d *DataBases) GetFcmToken(account string, platformid int) (string, error) {
|
||||
key := FcmToken + account + ":" + strconv.Itoa(platformid)
|
||||
return d.rdb.Get(context.Background(), key).Result()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user