mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
feat: add openim auto format code
This commit is contained in:
parent
971d8ec2a0
commit
a98bc80b03
@ -100,7 +100,8 @@ func initConfig(config any, configName, configFolderPath string) error {
|
|||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
return errs.Wrap(err, fmt.Sprintf("failed to check existence of config file at path: %s", configFilePath))
|
return errs.Wrap(err, fmt.Sprintf("failed to check existence of config file at path: %s", configFilePath))
|
||||||
}
|
}
|
||||||
projectRoot, err := GetProjectRoot()
|
var projectRoot string
|
||||||
|
projectRoot, err = GetProjectRoot()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
6
pkg/common/db/cache/user.go
vendored
6
pkg/common/db/cache/user.go
vendored
@ -277,8 +277,8 @@ func (u *UserCacheRedis) refreshStatusOffline(ctx context.Context, userID string
|
|||||||
func (u *UserCacheRedis) refreshStatusOnline(ctx context.Context, userID string, platformID int32, isNil bool, err error, result, key string) error {
|
func (u *UserCacheRedis) refreshStatusOnline(ctx context.Context, userID string, platformID int32, isNil bool, err error, result, key string) error {
|
||||||
var onlineStatus user.OnlineStatus
|
var onlineStatus user.OnlineStatus
|
||||||
if !isNil {
|
if !isNil {
|
||||||
err := json.Unmarshal([]byte(result), &onlineStatus)
|
err2 := json.Unmarshal([]byte(result), &onlineStatus)
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
return errs.Wrap(err, "json.Unmarshal failed")
|
return errs.Wrap(err, "json.Unmarshal failed")
|
||||||
}
|
}
|
||||||
onlineStatus.PlatformIDs = RemoveRepeatedElementsInList(append(onlineStatus.PlatformIDs, platformID))
|
onlineStatus.PlatformIDs = RemoveRepeatedElementsInList(append(onlineStatus.PlatformIDs, platformID))
|
||||||
@ -289,7 +289,7 @@ func (u *UserCacheRedis) refreshStatusOnline(ctx context.Context, userID string,
|
|||||||
onlineStatus.UserID = userID
|
onlineStatus.UserID = userID
|
||||||
newjsonData, err := json.Marshal(&onlineStatus)
|
newjsonData, err := json.Marshal(&onlineStatus)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errs.Wrap(err)
|
return errs.Wrap(err, "json.Marshal failed")
|
||||||
}
|
}
|
||||||
_, err = u.rdb.HSet(ctx, key, userID, string(newjsonData)).Result()
|
_, err = u.rdb.HSet(ctx, key, userID, string(newjsonData)).Result()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user