Error code standardization

test-errcode
skiffer-git 2 years ago
parent 4aad2c86ec
commit bedba8d8f5

@ -3,7 +3,6 @@ package im_mysql_model
import (
"Open_IM/pkg/common/db"
"Open_IM/pkg/utils"
"gorm.io/gorm"
"time"
)
@ -23,15 +22,14 @@ type Group struct {
ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"`
NotificationUpdateTime time.Time `gorm:"column:notification_update_time"`
NotificationUserID string `gorm:"column:notification_user_id;size:64"`
DB *gorm.DB `gorm:"-" json:"-"`
}
func (tb *Group) Create(groupList []*Group) error {
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Create(&groupList).Error, "")
func (tb *Group) Create(groups []*Group) error {
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Create(&groups).Error, "")
}
func (tb *Group) Delete(groupIDList []string) error {
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDList).Delete(&Group{}).Error, "")
func (tb *Group) Delete(groupIDs []string) error {
return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDs).Delete(&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, ""), "")
}
func (*Group) Find(groupIDList []string) ([]*Group, error) {
func (*Group) Find(groupIDs []string) ([]*Group, error) {
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, "")
}
func (tb *GroupRequest) Get(groupIDs []string) ([]*Group, error) {
var ms []*Group
return ms, utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDs).Find(&ms).Error, "")
func (tb *GroupRequest) Get(groupIDs []string, userIDs []string) ([]*GroupRequest, error) {
var ms []*GroupRequest
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, ""), "")
}

Loading…
Cancel
Save