From ba6655ac9bfa2f6426d240a27d3a8c82ababcd00 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 4 Jul 2024 16:17:41 +0800 Subject: [PATCH] 1 --- ...loud_issuance_user_robot_bind_group_dao.go | 37 ++++++++++--------- ...cloud_issuance_user_robot_bind_group_db.go | 16 ++++---- super_cloud_issuance/md/md_request.go | 9 +++++ 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/dao/super_cloud_issuance_user_robot_bind_group_dao.go b/src/dao/super_cloud_issuance_user_robot_bind_group_dao.go index fe46c43..7447c4d 100644 --- a/src/dao/super_cloud_issuance_user_robot_bind_group_dao.go +++ b/src/dao/super_cloud_issuance_user_robot_bind_group_dao.go @@ -2,32 +2,35 @@ import ( "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" - "time" + "xorm.io/xorm" ) type SuperCloudIssuanceUserRobotBindGroupDao interface { GetSuperCloudIssuanceUserRobotBindGroup(id int) (m *models.SuperCloudIssuanceUserRobotBindGroup, err error) GetSuperCloudIssuanceUserRobotBindGroupByChatRoomId(chatRoomId string) (m *models.SuperCloudIssuanceUserRobotBindGroup, err error) - InsertSuperCloudIssuanceUserRobotBindGroup(m *models.SuperCloudIssuanceUserRobotBindGroup) (id int, err error) + InsertSuperCloudIssuanceUserRobotBindGroup(sess *xorm.Session, m *models.SuperCloudIssuanceUserRobotBindGroup) (id int, err error) SaveSuperCloudIssuanceUserRobotBindGroup(id interface{}, m *models.SuperCloudIssuanceUserRobotBindGroup, forceColums ...string) (affected int64, err error) DeleteSuperCloudIssuanceUserRobotBindGroup(id interface{}) (affected int64, err error) - FindSuperCloudIssuanceUserRobotBindGroup() (resp []*FindCloudIssuanceUserRobotBindGroupResponse, total int64, err error) + FindSuperCloudIssuanceUserRobotBindGroup(page, pageSize int) (resp []*FindCloudIssuanceUserRobotBindGroupResponse, total int64, err error) FindSuperCloudIssuanceUserRobotBindGroupByCategory(categoryId int) (m []*models.SuperCloudIssuanceUserRobotBindGroup, err error) } type FindCloudIssuanceUserRobotBindGroupResponse struct { - Id int `json:"id" ` - Uid int `json:"uid"` - Name string `json:"name"` - RobotId int `json:"robot_id"` - ChatRoomId string `json:"chat_room_id"` - ChatRoomOwner string `json:"chat_room_owner"` - MemberCount int `json:"member_count"` - BigHeadImgUrl string `json:"big_head_img_url"` - SmallHeadImgUrl string `json:"small_head_img_url"` - GoodsCategoryId int `json:"goods_category_id"` - State int `json:"state"` - GoodsCategoryName string `json:"goods_category_name"` - CreateAt time.Time `json:"create_at"` - UpdateAt time.Time `json:"update_at"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int `json:"uid" xorm:"not null default 0 comment('uid') INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('群名称') VARCHAR(255)"` + RobotId int `json:"robot_id" xorm:"not null default 0 comment('机器人id') INT(11)"` + ChatRoomId string `json:"chat_room_id" xorm:"not null default '' comment('微信群id') VARCHAR(255)"` + ChatRoomOwnerWxNickname string `json:"chat_room_owner_wx_nickname" xorm:"not null default '' comment('群所有者微信昵称') VARCHAR(255)"` + ChatRoomOwnerWxHeadUrl string `json:"chat_room_owner_wx_head_url" xorm:"not null default '' comment('群所有者微信头像') VARCHAR(255)"` + ChatRoomOwner string `json:"chat_room_owner" xorm:"not null default '' comment('群所有者') VARCHAR(255)"` + MemberCount int `json:"member_count" xorm:"not null default 0 comment('群成员数') INT(11)"` + BigHeadImgUrl string `json:"big_head_img_url" xorm:"not null default '' comment('大的群头像') VARCHAR(255)"` + SmallHeadImgUrl string `json:"small_head_img_url" xorm:"not null default '' comment('小的群头像') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1正常 2暂停)') TINYINT(1)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"` + + GoodsCategoryId int `json:"goods_category_id"` + GoodsCategoryName string `json:"goods_category_name"` } diff --git a/src/implement/super_cloud_issuance_user_robot_bind_group_db.go b/src/implement/super_cloud_issuance_user_robot_bind_group_db.go index 21a40fb..e42524e 100644 --- a/src/implement/super_cloud_issuance_user_robot_bind_group_db.go +++ b/src/implement/super_cloud_issuance_user_robot_bind_group_db.go @@ -43,8 +43,8 @@ func (s SuperCloudIssuanceUserRobotBindGroupDb) GetSuperCloudIssuanceUserRobotBi return m, nil } -func (s SuperCloudIssuanceUserRobotBindGroupDb) InsertSuperCloudIssuanceUserRobotBindGroup(m *models.SuperCloudIssuanceUserRobotBindGroup) (id int, err error) { - _, err = s.Db.InsertOne(m) +func (s SuperCloudIssuanceUserRobotBindGroupDb) InsertSuperCloudIssuanceUserRobotBindGroup(sess *xorm.Session, m *models.SuperCloudIssuanceUserRobotBindGroup) (id int, err error) { + _, err = sess.InsertOne(m) if err != nil { return 0, err } @@ -69,12 +69,14 @@ func (s SuperCloudIssuanceUserRobotBindGroupDb) DeleteSuperCloudIssuanceUserRobo return 1, nil } -func (s SuperCloudIssuanceUserRobotBindGroupDb) FindSuperCloudIssuanceUserRobotBindGroup() (resp []*dao.FindCloudIssuanceUserRobotBindGroupResponse, total int64, err error) { - total, err = s.Db.Table("super_cloud_issuance_user_robot_bind_group"). +func (s SuperCloudIssuanceUserRobotBindGroupDb) FindSuperCloudIssuanceUserRobotBindGroup(page, pageSize int) (resp []*dao.FindCloudIssuanceUserRobotBindGroupResponse, total int64, err error) { + total, err = s.Db.Table("super_cloud_issuance_user_robot_with_activate_group"). + Join("LEFT", "super_cloud_issuance_user_robot_bind_group", "super_cloud_issuance_user_robot_with_activate_group.id = super_cloud_issuance_user_robot_bind_group.activate_group_id"). Join("LEFT", "super_cloud_issuance_goods_category", "super_cloud_issuance_user_robot_bind_group.goods_category_id = super_cloud_issuance_goods_category.id"). - Where("super_cloud_issuance_user_robot_bind_group.uid = ?", s.Uid). - OrderBy("super_cloud_issuance_user_robot_bind_group.id DESC"). - Cols("super_cloud_issuance_user_robot_bind_group.*, super_cloud_issuance_goods_category.name as goods_category_name"). + Where("super_cloud_issuance_user_robot_with_activate_group.uid = ?", s.Uid). + OrderBy("super_cloud_issuance_user_robot_with_activate_group.id DESC"). + Cols("super_cloud_issuance_user_robot_with_activate_group.*, super_cloud_issuance_user_robot_bind_group.activate_group_id, super_cloud_issuance_goods_category.name as goods_category_name"). + Limit(pageSize, (page-1)*pageSize). FindAndCount(&resp) return } diff --git a/super_cloud_issuance/md/md_request.go b/super_cloud_issuance/md/md_request.go index 394fb1e..8f0c02a 100644 --- a/super_cloud_issuance/md/md_request.go +++ b/super_cloud_issuance/md/md_request.go @@ -193,3 +193,12 @@ type GroupManageWhiteWithUserSaveRequest struct { ActivateGroupId int `json:"activate_group_id"` WxIds []string `json:"wc_ids"` } + +type OneClickGroupSendIndexRequest struct { + Page int `json:"page"` + Limit int `json:"limit"` +} +type OneClickGroupSendBindCategoryRequest struct { + ActivateGroupId int `json:"activate_group_id"` + CategoryId int `json:"category_id"` +}