Explorar el Código

add batch send message

master
shenjiachi hace 1 semana
padre
commit
1959e539cc
Se han modificado 8 ficheros con 147 adiciones y 0 borrados
  1. +9
    -0
      src/dao/im_group_batch_send_message_records_dao.go
  2. +9
    -0
      src/dao/im_user_batch_send_message_records_dao.go
  3. +1
    -0
      src/dao/user_dao.go
  4. +39
    -0
      src/implement/im_group_batch_send_message_records_implement.go
  5. +39
    -0
      src/implement/im_user_batch_send_message_records_implement.go
  6. +19
    -0
      src/implement/user_implement.go
  7. +15
    -0
      src/model/im_group_batch_send_message_records.go
  8. +16
    -0
      src/model/im_user_batch_send_message_records.go

+ 9
- 0
src/dao/im_group_batch_send_message_records_dao.go Ver fichero

@@ -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)
}

+ 9
- 0
src/dao/im_user_batch_send_message_records_dao.go Ver fichero

@@ -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)
}

+ 1
- 0
src/dao/user_dao.go Ver fichero

@@ -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)
}

+ 39
- 0
src/implement/im_group_batch_send_message_records_implement.go Ver fichero

@@ -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
}

+ 39
- 0
src/implement/im_user_batch_send_message_records_implement.go Ver fichero

@@ -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
}

+ 19
- 0
src/implement/user_implement.go Ver fichero

@@ -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
}

+ 15
- 0
src/model/im_group_batch_send_message_records.go Ver fichero

@@ -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"`
}

+ 16
- 0
src/model/im_user_batch_send_message_records.go Ver fichero

@@ -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"`
}

Cargando…
Cancelar
Guardar