mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 18:45:58 +08:00
Error code standardization
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
package msg
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/utils"
|
||||
"github.com/go-redis/redis/v8"
|
||||
"gorm.io/gorm"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/proto/sdkws"
|
||||
)
|
||||
|
||||
func IsNotFound(err error) bool {
|
||||
switch utils.Unwrap(err) {
|
||||
case gorm.ErrRecordNotFound, redis.Nil:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
func isMessageHasReadEnabled(msgData *sdkws.MsgData) bool {
|
||||
switch msgData.ContentType {
|
||||
case constant.HasReadReceipt:
|
||||
if config.Config.SingleMessageHasReadReceiptEnable {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case constant.GroupHasReadReceipt:
|
||||
if config.Config.GroupMessageHasReadReceiptEnable {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user