mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 09:36:00 +08:00
fix bug
This commit is contained in:
@@ -214,11 +214,13 @@ type config struct {
|
||||
MsgToPush string `yaml:"msgToPush"`
|
||||
}
|
||||
}
|
||||
Secret string `yaml:"secret"`
|
||||
MultiLoginPolicy int `yaml:"multiloginpolicy"`
|
||||
ChatPersistenceMysql bool `yaml:"chatpersistencemysql"`
|
||||
ReliableStorage bool `yaml:"reliablestorage"`
|
||||
MsgCacheTimeout int `yaml:"msgCacheTimeout"`
|
||||
Secret string `yaml:"secret"`
|
||||
MultiLoginPolicy int `yaml:"multiloginpolicy"`
|
||||
ChatPersistenceMysql bool `yaml:"chatpersistencemysql"`
|
||||
ReliableStorage bool `yaml:"reliablestorage"`
|
||||
MsgCacheTimeout int `yaml:"msgCacheTimeout"`
|
||||
GroupMessageHasReadReceiptEnable bool `yaml:"groupMessageHasReadReceiptEnable"`
|
||||
SingleMessageHasReadReceiptEnable bool `yaml:"singleMessageHasReadReceiptEnable"`
|
||||
|
||||
TokenPolicy struct {
|
||||
AccessSecret string `yaml:"accessSecret"`
|
||||
|
||||
@@ -28,23 +28,24 @@ const (
|
||||
|
||||
///ContentType
|
||||
//UserRelated
|
||||
Text = 101
|
||||
Picture = 102
|
||||
Voice = 103
|
||||
Video = 104
|
||||
File = 105
|
||||
AtText = 106
|
||||
Merger = 107
|
||||
Card = 108
|
||||
Location = 109
|
||||
Custom = 110
|
||||
Revoke = 111
|
||||
HasReadReceipt = 112
|
||||
Typing = 113
|
||||
Quote = 114
|
||||
Common = 200
|
||||
GroupMsg = 201
|
||||
SignalMsg = 202
|
||||
Text = 101
|
||||
Picture = 102
|
||||
Voice = 103
|
||||
Video = 104
|
||||
File = 105
|
||||
AtText = 106
|
||||
Merger = 107
|
||||
Card = 108
|
||||
Location = 109
|
||||
Custom = 110
|
||||
Revoke = 111
|
||||
HasReadReceipt = 112
|
||||
Typing = 113
|
||||
Quote = 114
|
||||
GroupHasReadReceipt = 116
|
||||
Common = 200
|
||||
GroupMsg = 201
|
||||
SignalMsg = 202
|
||||
|
||||
//SysRelated
|
||||
NotificationBegin = 1000
|
||||
|
||||
@@ -49,12 +49,13 @@ var (
|
||||
ErrTokenUnknown = ErrInfo{705, TokenUnknownMsg.Error()}
|
||||
ErrTokenKicked = ErrInfo{706, TokenUserKickedMsg.Error()}
|
||||
|
||||
ErrAccess = ErrInfo{ErrCode: 801, ErrMsg: AccessMsg.Error()}
|
||||
ErrDB = ErrInfo{ErrCode: 802, ErrMsg: DBMsg.Error()}
|
||||
ErrArgs = ErrInfo{ErrCode: 803, ErrMsg: ArgsMsg.Error()}
|
||||
ErrStatus = ErrInfo{ErrCode: 804, ErrMsg: StatusMsg.Error()}
|
||||
ErrCallback = ErrInfo{ErrCode: 809, ErrMsg: CallBackMsg.Error()}
|
||||
ErrSendLimit = ErrInfo{ErrCode: 810, ErrMsg: "send msg limit, to many request, try again later"}
|
||||
ErrAccess = ErrInfo{ErrCode: 801, ErrMsg: AccessMsg.Error()}
|
||||
ErrDB = ErrInfo{ErrCode: 802, ErrMsg: DBMsg.Error()}
|
||||
ErrArgs = ErrInfo{ErrCode: 803, ErrMsg: ArgsMsg.Error()}
|
||||
ErrStatus = ErrInfo{ErrCode: 804, ErrMsg: StatusMsg.Error()}
|
||||
ErrCallback = ErrInfo{ErrCode: 809, ErrMsg: CallBackMsg.Error()}
|
||||
ErrSendLimit = ErrInfo{ErrCode: 810, ErrMsg: "send msg limit, to many request, try again later"}
|
||||
ErrMessageHasReadDisable = ErrInfo{ErrCode: 811, ErrMsg: "message has read disable"}
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -16,14 +16,14 @@ func CreateDepartment(department *db.Department) error {
|
||||
return dbConn.Table("departments").Create(department).Error
|
||||
}
|
||||
|
||||
func GetDepartment(departmentID string) (error, *db.Department) {
|
||||
func GetDepartment(departmentID string) (*db.Department, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err, nil
|
||||
return nil, err
|
||||
}
|
||||
var department db.Department
|
||||
err = dbConn.Table("departments").Where("department_id=?", departmentID).Find(&department).Error
|
||||
return err, &department
|
||||
return &department, err
|
||||
}
|
||||
|
||||
func UpdateDepartment(department *db.Department, args map[string]interface{}) error {
|
||||
@@ -237,6 +237,15 @@ func GetSubDepartmentNum(departmentID string) (error, uint32) {
|
||||
return nil, number
|
||||
}
|
||||
|
||||
func SetDepartmentRelatedGroupID(groupID, departmentID string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return utils.Wrap(err, "DefaultGormDB failed")
|
||||
}
|
||||
department := &db.Department{RelatedGroupID: groupID}
|
||||
return dbConn.Model(&department).Where("department_id=?", departmentID).Update(department).Error
|
||||
}
|
||||
|
||||
func GetDepartmentRelatedGroupIDList(departmentIDList []string) ([]string, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
@@ -257,7 +266,7 @@ func getDepartmentParent(departmentID string, dbConn *gorm.DB) (*db.Department,
|
||||
return nil, utils.Wrap(err, "")
|
||||
}
|
||||
err = dbConn.Model(&parentDepartment).Where("department_id = ?", department.ParentID).Find(&parentDepartment).Error
|
||||
return &department, err
|
||||
return &parentDepartment, utils.Wrap(err, "")
|
||||
}
|
||||
|
||||
func GetDepartmentParent(departmentID string, dbConn *gorm.DB, parentIDList *[]string) error {
|
||||
|
||||
Reference in New Issue
Block a user