diff --git a/src/dao/im_group_batch_send_message_records_dao.go b/src/dao/im_group_batch_send_message_records_dao.go new file mode 100644 index 0000000..2631a65 --- /dev/null +++ b/src/dao/im_group_batch_send_message_records_dao.go @@ -0,0 +1,9 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type ImGroupBatchSendMessageRecordsDao interface { + //TODO:: You can add specific method definitions here + ImGroupBatchSendMessageRecordsInsert(m *model.ImGroupBatchSendMessageRecords) (int, error) + ImGroupBatchSendMessageRecordsUpdate(id interface{}, m *model.ImGroupBatchSendMessageRecords, forceColumns ...string) (int64, error) +} diff --git a/src/dao/im_user_batch_send_message_records_dao.go b/src/dao/im_user_batch_send_message_records_dao.go new file mode 100644 index 0000000..54750d7 --- /dev/null +++ b/src/dao/im_user_batch_send_message_records_dao.go @@ -0,0 +1,9 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type ImUserBatchSendMessageRecordsDao interface { + //TODO:: You can add specific method definitions here + ImUserBatchSendMessageRecordsInsert(m *model.ImUserBatchSendMessageRecords) (int, error) + ImUserBatchSendMessageRecordsUpdate(id interface{}, m *model.ImUserBatchSendMessageRecords, forceColumns ...string) (int64, error) +} diff --git a/src/dao/user_dao.go b/src/dao/user_dao.go index 5a91632..c665546 100644 --- a/src/dao/user_dao.go +++ b/src/dao/user_dao.go @@ -18,4 +18,5 @@ type UserDao interface { UpdateUser(m *model.User, columns ...string) (int64, error) GetUser(id int64) (m *model.User, err error) UserCount() (int64, error) + UserFindNotInByParamsByPage(page int, limit int, params map[string]interface{}) ([]model.User, int64, error) } diff --git a/src/implement/im_group_batch_send_message_records_implement.go b/src/implement/im_group_batch_send_message_records_implement.go new file mode 100644 index 0000000..9edcd58 --- /dev/null +++ b/src/implement/im_group_batch_send_message_records_implement.go @@ -0,0 +1,39 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + +func NewImGroupBatchSendMessageRecordsDb(engine *xorm.Engine) dao.ImGroupBatchSendMessageRecordsDao { + return &ImGroupBatchSendMessageRecordsDb{Db: engine} +} + +type ImGroupBatchSendMessageRecordsDb struct { + Db *xorm.Engine +} + +func (i ImGroupBatchSendMessageRecordsDb) ImGroupBatchSendMessageRecordsInsert(m *model.ImGroupBatchSendMessageRecords) (int, error) { + _, err := i.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (i ImGroupBatchSendMessageRecordsDb) ImGroupBatchSendMessageRecordsUpdate(id interface{}, m *model.ImGroupBatchSendMessageRecords, forceColumns ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColumns != nil { + affected, err = i.Db.Where("id=?", id).MustCols(forceColumns...).Update(m) + } else { + affected, err = i.Db.Where("id=?", id).Update(m) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/implement/im_user_batch_send_message_records_implement.go b/src/implement/im_user_batch_send_message_records_implement.go new file mode 100644 index 0000000..8bc1c68 --- /dev/null +++ b/src/implement/im_user_batch_send_message_records_implement.go @@ -0,0 +1,39 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + +func NewImUserBatchSendMessageRecordsDb(engine *xorm.Engine) dao.ImUserBatchSendMessageRecordsDao { + return &ImUserBatchSendMessageRecordsDb{Db: engine} +} + +type ImUserBatchSendMessageRecordsDb struct { + Db *xorm.Engine +} + +func (i ImUserBatchSendMessageRecordsDb) ImUserBatchSendMessageRecordsInsert(m *model.ImUserBatchSendMessageRecords) (int, error) { + _, err := i.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (i ImUserBatchSendMessageRecordsDb) ImUserBatchSendMessageRecordsUpdate(id interface{}, m *model.ImUserBatchSendMessageRecords, forceColumns ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColumns != nil { + affected, err = i.Db.Where("id=?", id).MustCols(forceColumns...).Update(m) + } else { + affected, err = i.Db.Where("id=?", id).Update(m) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/implement/user_implement.go b/src/implement/user_implement.go index 6117051..e4df67b 100644 --- a/src/implement/user_implement.go +++ b/src/implement/user_implement.go @@ -157,3 +157,22 @@ func (u UserDb) UserCount() (int64, error) { } return count, nil } + +func (u UserDb) UserFindNotInByParamsByPage(page int, limit int, params map[string]interface{}) ([]model.User, int64, error) { + var m []model.User + var total int64 + var err error + if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { + //指定In查询 + if total, err = u.Db.NotIn(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m); err != nil { + return nil, 0, zhios_order_relate_logx.Warn(err) + } + } else { + var query = fmt.Sprintf("%s != ?", params["key"]) + total, err = u.Db.Where(query, params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m) + if err != nil { + return nil, 0, zhios_order_relate_logx.Error(err) + } + } + return m, total, nil +} diff --git a/src/model/im_group_batch_send_message_records.go b/src/model/im_group_batch_send_message_records.go new file mode 100644 index 0000000..a4a8c4e --- /dev/null +++ b/src/model/im_group_batch_send_message_records.go @@ -0,0 +1,15 @@ +package model + +type ImGroupBatchSendMessageRecords struct { + Id int `json:"id" xorm:"not null pk autoincr comment('主键id') INT(11)"` + SendKind int `json:"send_kind" xorm:"not null default 1 comment('发送模式(1:指定群组 2:所有群组)') TINYINT(1)"` + GroupId string `json:"group_id" xorm:"not null comment('群组id(以;切割)') TEXT"` + Kind int `json:"kind" xorm:"not null default 1 comment('消息类型(0未知 1文本 2表情 3语音消息 4图片 5文件 6地理位置 7指令推送 8自定义 9撤回消息 10红包消息)') TINYINT(1)"` + Content string `json:"content" xorm:"comment('消息内容') TEXT"` + SendTime string `json:"send_time" xorm:"not null default 'CURRENT_TIMESTAMP(3)' comment('消息发送时间') DATETIME(3)"` + State int `json:"state" xorm:"not null default 0 comment('消息状态,1:正常 2:失败') TINYINT(3)"` + SendCondition string `json:"send_condition" xorm:"not null comment('发送条件') TEXT"` + NotCondition string `json:"not_condition" xorm:"not null comment('不发送条件') TEXT"` + CreateTime string `json:"create_time" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateTime string `json:"update_time" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/im_user_batch_send_message_records.go b/src/model/im_user_batch_send_message_records.go new file mode 100644 index 0000000..f3cc393 --- /dev/null +++ b/src/model/im_user_batch_send_message_records.go @@ -0,0 +1,16 @@ +package model + +type ImUserBatchSendMessageRecords struct { + Id int `json:"id" xorm:"not null pk autoincr comment('主键id') INT(11)"` + SendKind int `json:"send_kind" xorm:"not null default 1 comment('发送模式(1:所有用户 2:指定用户)') TINYINT(1)"` + Uid string `json:"uid" xorm:"not null comment('uid(以;切割)') TEXT"` + ImUid string `json:"im_uid" xorm:"not null comment('im-uid(以;切割)') TEXT"` + Kind int `json:"kind" xorm:"not null default 1 comment('消息类型(0未知 1文本 2表情 3语音消息 4图片 5文件 6地理位置 7指令推送 8自定义 9撤回消息 10红包消息)') TINYINT(1)"` + Content string `json:"content" xorm:"comment('消息内容') TEXT"` + SendTime string `json:"send_time" xorm:"not null default 'CURRENT_TIMESTAMP(3)' comment('消息发送时间') DATETIME(3)"` + State int `json:"state" xorm:"not null default 0 comment('消息状态,1:正常 2:失败') TINYINT(3)"` + SendCondition string `json:"send_condition" xorm:"not null comment('发送条件') TEXT"` + NotCondition string `json:"not_condition" xorm:"not null comment('不发送条件') TEXT"` + CreateTime string `json:"create_time" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateTime string `json:"update_time" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +}