This commit is contained in:
wangchuxiao 2023-01-04 18:36:04 +08:00
parent 9d433fb248
commit f2cade3251
3 changed files with 53 additions and 52 deletions

View File

@ -3,6 +3,7 @@ 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"
) )
@ -22,6 +23,7 @@ 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 (*Group) Create(groupList []*Group) error { func (*Group) Create(groupList []*Group) error {
@ -29,7 +31,7 @@ func (*Group) Create(groupList []*Group) error {
} }
func (*Group) Delete(groupIDList []string) error { func (*Group) Delete(groupIDList []string) error {
return nil return utils.Wrap(db.DB.MysqlDB.DefaultGormDB().Where("group_id in (?)", groupIDList).Delete(&Group{}).Error, "")
} }
func (*Group) Update(groupList []*Group) error { func (*Group) Update(groupList []*Group) error {

View File

@ -1,32 +1,32 @@
package im_mysql_model package im_mysql_model
func (tb *Group) Create(groups []*Group) error { //func (tb *Group) Create(groups []*Group) error {
return nil // return nil
} //}
func (tb *Group) Take(groupIDs []string) (*Group, error) { //func (tb *Group) Take(groupIDs []string) (*Group, error) {
return nil, nil // return nil, nil
} //}
func (tb *Group) Get(groupIDs []string) (*Group, error) { //func (tb *Group) Get(groupIDs []string) (*Group, error) {
return nil, nil // return nil, nil
} //}
func (tb *Group) Update(groups []*Group) error { //func (tb *Group) Update(groups []*Group) error {
return nil // return nil
} //}
func (tb *Group) GetByName(groupName string, pageNumber, showNumber int32) ([]GroupWithNum, int64, error) { //func (tb *Group) GetByName(groupName string, pageNumber, showNumber int32) ([]GroupWithNum, int64, error) {
//
} //}
func (tb *Group) GetGroups(pageNumber, showNumber int) ([]GroupWithNum, error) { //func (tb *Group) GetGroups(pageNumber, showNumber int) ([]GroupWithNum, error) {
} //}
func (tb *Group) OperateGroupStatus(groupId string, groupStatus int32) error { //func (tb *Group) OperateGroupStatus(groupId string, groupStatus int32) error {
} //}
//
func (tb *Group) GetCountsNum(groupIDs []string) ([]int32, error) { //func (tb *Group) GetCountsNum(groupIDs []string) ([]int32, error) {
//
} //}
//
func (tb *Group) UpdateDefaultZero(groupID string, args map[string]interface{}) error { //func (tb *Group) UpdateDefaultZero(groupID string, args map[string]interface{}) error {
} //}
//
func (tb *Group) GetGroupIDsByGroupType(groupType int) ([]string, error) { //func (tb *Group) GetGroupIDsByGroupType(groupType int) ([]string, error) {
//
} //}

View File

@ -1,7 +1,6 @@
package im_mysql_model package im_mysql_model
import ( import (
"gorm.io/gorm"
"time" "time"
) )
@ -87,26 +86,26 @@ func (FriendRequest) TableName() string {
// } // }
// //
// open_im_sdk.GroupInfo (OwnerUserID , MemberCount )> imdb.Group // open_im_sdk.GroupInfo (OwnerUserID , MemberCount )> imdb.Group
type Group struct { //type Group struct {
//`json:"operationID" binding:"required"` // //`json:"operationID" binding:"required"`
//`protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` `json:"operationID" binding:"required"` // //`protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` `json:"operationID" binding:"required"`
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"` // GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
GroupName string `gorm:"column:name;size:255" json:"groupName"` // GroupName string `gorm:"column:name;size:255" json:"groupName"`
Notification string `gorm:"column:notification;size:255" json:"notification"` // Notification string `gorm:"column:notification;size:255" json:"notification"`
Introduction string `gorm:"column:introduction;size:255" json:"introduction"` // Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"` // FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
CreateTime time.Time `gorm:"column:create_time;index:create_time"` // CreateTime time.Time `gorm:"column:create_time;index:create_time"`
Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"` // Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"`
Status int32 `gorm:"column:status"` // Status int32 `gorm:"column:status"`
CreatorUserID string `gorm:"column:creator_user_id;size:64"` // CreatorUserID string `gorm:"column:creator_user_id;size:64"`
GroupType int32 `gorm:"column:group_type"` // GroupType int32 `gorm:"column:group_type"`
NeedVerification int32 `gorm:"column:need_verification"` // NeedVerification int32 `gorm:"column:need_verification"`
LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"` // LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"`
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:"-"` // DB *gorm.DB `gorm:"-" json:"-"`
} //}
// message GroupMemberFullInfo { // message GroupMemberFullInfo {
// string GroupID = 1 ; // string GroupID = 1 ;