mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-29 05:38:45 +08:00
Error code standardization
This commit is contained in:
parent
4aad2c86ec
commit
bedba8d8f5
@ -3,7 +3,6 @@ package im_mysql_model
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"gorm.io/gorm"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,15 +22,14 @@ type Group struct {
|
|||||||
ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"`
|
ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"`
|
||||||
NotificationUpdateTime time.Time `gorm:"column:notification_update_time"`
|
NotificationUpdateTime time.Time `gorm:"column:notification_update_time"`
|
||||||
NotificationUserID string `gorm:"column:notification_user_id;size:64"`
|
NotificationUserID string `gorm:"column:notification_user_id;size:64"`
|
||||||
DB *gorm.DB `gorm:"-" json:"-"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tb *Group) Create(groupList []*Group) error {
|
func (tb *Group) Create(groups []*Group) error {
|
||||||
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Create(&groupList).Error, "")
|
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Create(&groups).Error, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tb *Group) Delete(groupIDList []string) error {
|
func (tb *Group) Delete(groupIDs []string) error {
|
||||||
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDList).Delete(&Group{}).Error, "")
|
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDs).Delete(&Group{}).Error, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tb *Group) Get(groupIDs []string) ([]*Group, error) {
|
func (tb *Group) Get(groupIDs []string) ([]*Group, error) {
|
||||||
@ -43,7 +41,7 @@ func (tb *Group) Update(groups []*Group) error {
|
|||||||
return utils.Wrap(utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Updates(groups).Error, ""), "")
|
return utils.Wrap(utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Updates(groups).Error, ""), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Group) Find(groupIDList []string) ([]*Group, error) {
|
func (*Group) Find(groupIDs []string) ([]*Group, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ func (*GroupRequest) Delete(groupIDList []string) error {
|
|||||||
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDList).Delete(&Group{}).Error, "")
|
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDList).Delete(&Group{}).Error, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tb *GroupRequest) Get(groupIDs []string) ([]*Group, error) {
|
func (tb *GroupRequest) Get(groupIDs []string, userIDs []string) ([]*GroupRequest, error) {
|
||||||
var ms []*Group
|
var ms []*GroupRequest
|
||||||
return ms, utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDs).Find(&ms).Error, "")
|
return ms, utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?) and user_id in (?)", groupIDs, userIDs).Find(&ms).Error, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tb *GroupRequest) Update(groups []*Group) error {
|
func (tb *GroupRequest) Update(groups []*GroupRequest) error {
|
||||||
return utils.Wrap(utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Updates(groups).Error, ""), "")
|
return utils.Wrap(utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Updates(groups).Error, ""), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user