mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-13 05:25:59 +08:00
Merge branch 'v2.3.0release' of github.com:OpenIMSDK/Open-IM-Server into v2.3.0release
This commit is contained in:
@@ -410,15 +410,19 @@ func (d *DataBases) GetSendMsgStatus(operationID string) (int, error) {
|
||||
return status, err
|
||||
}
|
||||
|
||||
func (d *DataBases) SetFcmToken(account string, platformid int, fcmToken string, expireTime int64) (err error) {
|
||||
key := FcmToken + account + ":" + strconv.Itoa(platformid)
|
||||
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)
|
||||
func (d *DataBases) GetFcmToken(account string, platformID int) (string, error) {
|
||||
key := FcmToken + account + ":" + strconv.Itoa(platformID)
|
||||
return d.RDB.Get(context.Background(), key).Result()
|
||||
}
|
||||
func (d *DataBases) DelFcmToken(account string, platformID int) error {
|
||||
key := FcmToken + account + ":" + strconv.Itoa(platformID)
|
||||
return d.RDB.Del(context.Background(), key).Err()
|
||||
}
|
||||
func (d *DataBases) IncrUserBadgeUnreadCountSum(uid string) (int, error) {
|
||||
key := userBadgeUnreadCountSum + uid
|
||||
seq, err := d.RDB.Incr(context.Background(), key).Result()
|
||||
|
||||
@@ -125,23 +125,6 @@ func init() {
|
||||
fmt.Println("createMongoIndex success")
|
||||
DB.mongoClient = mongoClient
|
||||
|
||||
// redis pool init
|
||||
//DB.redisPool = &redis.Pool{
|
||||
// MaxIdle: config.Config.Redis.DBMaxIdle,
|
||||
// MaxActive: config.Config.Redis.DBMaxActive,
|
||||
// IdleTimeout: time.Duration(config.Config.Redis.DBIdleTimeout) * time.Second,
|
||||
// Dial: func() (redis.Conn, error) {
|
||||
// return redis.Dial(
|
||||
// "tcp",
|
||||
// config.Config.Redis.DBAddress,
|
||||
// redis.DialReadTimeout(time.Duration(1000)*time.Millisecond),
|
||||
// redis.DialWriteTimeout(time.Duration(1000)*time.Millisecond),
|
||||
// redis.DialConnectTimeout(time.Duration(1000)*time.Millisecond),
|
||||
// redis.DialDatabase(0),
|
||||
// redis.DialPassword(config.Config.Redis.DBPassWord),
|
||||
// )
|
||||
// },
|
||||
//}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
if config.Config.Redis.EnableCluster {
|
||||
|
||||
@@ -370,6 +370,9 @@ func (d *DataBases) GetMsgBySeqListMongo2(uid string, seqList []uint32, operatio
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(hasSeqList) == 0 {
|
||||
return nil, errors.New("pull message is null")
|
||||
}
|
||||
if len(hasSeqList) != len(seqList) {
|
||||
var diff []uint32
|
||||
diff = utils.Difference(hasSeqList, seqList)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package token_verify
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_ParseToken(t *testing.T) {
|
||||
token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVSUQiOiJvcGVuSU1BZG1pbiIsIlBsYXRmb3JtIjoiQVBhZCIsImV4cCI6MTY3NDYxNTA2MSwibmJmIjoxNjY2ODM4NzYxLCJpYXQiOjE2NjY4MzkwNjF9.l8RiIu6pR4ItwDOpNIDYA9LBzIcpk8r8n6NRtXjqOp8"
|
||||
_, err := GetClaimFromToken(token)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
Reference in New Issue
Block a user