From 1fa71e6dfaa872e4254196c612cd9548bf7e5d0f Mon Sep 17 00:00:00 2001 From: dengbiao Date: Tue, 25 Jun 2024 14:11:08 +0800 Subject: [PATCH] update --- .../super_cloud_issuance_package_ord_dao.go | 6 +- ...oud_issuance_user_robot_bind_follow_dao.go | 10 ++- ...suance_user_robot_bind_follow_group_dao.go | 9 ++- ...ssuance_user_robot_bind_follow_user_dao.go | 10 ++- .../super_cloud_issuance_package_ord_db.go | 29 +++++++-- ...loud_issuance_user_robot_bind_follow_db.go | 62 +++++++++++++++++- ...ssuance_user_robot_bind_follow_group_db.go | 60 ++++++++++++++++- ...issuance_user_robot_bind_follow_user_db.go | 64 ++++++++++++++++++- ...r_cloud_issuance_user_robot_bind_source.go | 2 +- super_cloud_issuance/md/md_request.go | 20 ++++++ 10 files changed, 256 insertions(+), 16 deletions(-) create mode 100644 super_cloud_issuance/md/md_request.go diff --git a/src/dao/super_cloud_issuance_package_ord_dao.go b/src/dao/super_cloud_issuance_package_ord_dao.go index 8eee63c..4040857 100644 --- a/src/dao/super_cloud_issuance_package_ord_dao.go +++ b/src/dao/super_cloud_issuance_package_ord_dao.go @@ -1,7 +1,11 @@ package dao -import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/super_cloud_issuance/md" +) type SuperCloudIssuancePackageOrdDao interface { GetCloudIssuancePackageOrd(ordNo string) (m *models.SuperCloudIssuancePackageOrd, err error) + UserOrdList(uid interface{}, req md.BuyPackageRecordsRequest) (resp []*md.BuyPackageRecordsResponse, total int64, err error) } diff --git a/src/dao/super_cloud_issuance_user_robot_bind_follow_dao.go b/src/dao/super_cloud_issuance_user_robot_bind_follow_dao.go index c93e692..7227567 100644 --- a/src/dao/super_cloud_issuance_user_robot_bind_follow_dao.go +++ b/src/dao/super_cloud_issuance_user_robot_bind_follow_dao.go @@ -1,5 +1,13 @@ package dao +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + type SuperCloudIssuanceUserRobotBindFollowDao interface { - //TODO:: You can add specific method definitions here + GetCloudIssuanceUserRobotBindFollow(id int) (m *models.SuperCloudIssuanceUserRobotBindFollow, err error) + GetCloudIssuanceUserRobotBindFollowByChatRoomId(chatRoomId string, robotId int) (m *models.SuperCloudIssuanceUserRobotBindFollow, err error) + InsertCloudIssuanceUserRobotBindFollow(m *models.SuperCloudIssuanceUserRobotBindFollow) (id int, err error) + SaveCloudIssuanceUserRobotBindFollow(id interface{}, m *models.SuperCloudIssuanceUserRobotBindFollow, forceColums ...string) (affected int64, err error) + DeleteCloudIssuanceUserRobotBindFollow(id interface{}) (affected int64, err error) + CountCloudIssuanceUserRobotBindFollow(uid int) (total int64, err error) + //FindCloudIssuanceUserRobotBindFollow() (list []*CloudIssuanceUserRobotBindFollowList, err error) } diff --git a/src/dao/super_cloud_issuance_user_robot_bind_follow_group_dao.go b/src/dao/super_cloud_issuance_user_robot_bind_follow_group_dao.go index e168710..bbcb65a 100644 --- a/src/dao/super_cloud_issuance_user_robot_bind_follow_group_dao.go +++ b/src/dao/super_cloud_issuance_user_robot_bind_follow_group_dao.go @@ -1,5 +1,12 @@ package dao +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + type SuperCloudIssuanceUserRobotBindFollowGroupDao interface { - //TODO:: You can add specific method definitions here + GetCloudIssuanceUserRobotBindFollowGroup(id int) (m *models.SuperCloudIssuanceUserRobotBindFollowGroup, err error) + GetCloudIssuanceUserRobotBindFollowGroupByBindId(bandId int) (m []*models.SuperCloudIssuanceUserRobotBindFollowGroup, err error) + InsertCloudIssuanceUserRobotBindFollowGroup(m *models.SuperCloudIssuanceUserRobotBindFollowGroup) (id int, err error) + BatchAddCloudIssuanceUserRobotBindFollowGroups(data []*models.SuperCloudIssuanceUserRobotBindFollowGroup) (int64, error) + SaveCloudIssuanceUserRobotBindFollowGroup(id interface{}, m *models.SuperCloudIssuanceUserRobotBindFollowGroup, forceColums ...string) (affected int64, err error) + DeleteCloudIssuanceUserRobotBindFollowGroup(bindId interface{}) (affected int64, err error) } diff --git a/src/dao/super_cloud_issuance_user_robot_bind_follow_user_dao.go b/src/dao/super_cloud_issuance_user_robot_bind_follow_user_dao.go index 41cbd96..aaee626 100644 --- a/src/dao/super_cloud_issuance_user_robot_bind_follow_user_dao.go +++ b/src/dao/super_cloud_issuance_user_robot_bind_follow_user_dao.go @@ -1,5 +1,13 @@ package dao +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + type SuperCloudIssuanceUserRobotBindFollowUserDao interface { - //TODO:: You can add specific method definitions here + GetCloudIssuanceUserRobotBindFollowUser(id int) (m *models.SuperCloudIssuanceUserRobotBindFollowUser, err error) + GetCloudIssuanceUserRobotBindFollowUserByWxId(wxId string) (m *models.SuperCloudIssuanceUserRobotBindFollowUser, err error) + InsertCloudIssuanceUserRobotBindFollowUser(m *models.SuperCloudIssuanceUserRobotBindFollowUser) (id int, err error) + BatchAddCloudIssuanceUserRobotBindFollowUsers(data []*models.SuperCloudIssuanceUserRobotBindFollowUser) (int64, error) + SaveCloudIssuanceUserRobotBindFollowUser(id interface{}, m *models.SuperCloudIssuanceUserRobotBindFollowUser, forceColums ...string) (affected int64, err error) + DeleteCloudIssuanceUserRobotBindFollowUser(bindId interface{}) (affected int64, err error) + //FindCloudIssuanceUserRobotBindFollowUser(params map[string]interface{}) ([]*models.SuperCloudIssuanceUserRobotBindFollowUser, error) } diff --git a/src/implement/super_cloud_issuance_package_ord_db.go b/src/implement/super_cloud_issuance_package_ord_db.go index 728c28a..d02cdb2 100644 --- a/src/implement/super_cloud_issuance_package_ord_db.go +++ b/src/implement/super_cloud_issuance_package_ord_db.go @@ -3,18 +3,37 @@ package implement import ( "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/super_cloud_issuance/md" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" "xorm.io/xorm" ) +func NewSuperCloudIssuancePackageOrdDb(engine *xorm.Engine) dao.SuperCloudIssuancePackageOrdDao { + return &SuperCloudIssuancePackageOrdDb{Db: engine} +} + type SuperCloudIssuancePackageOrdDb struct { Db *xorm.Engine } -func (s SuperCloudIssuancePackageOrdDb) GetCloudIssuancePackageOrd(ordNo string) (m *models.SuperCloudIssuancePackageOrd, err error) { - //TODO implement me - panic("implement me") +func (s SuperCloudIssuancePackageOrdDb) UserOrdList(uid interface{}, req md.BuyPackageRecordsRequest) (resp []*md.BuyPackageRecordsResponse, total int64, err error) { + total, err = s.Db.Table("super_cloud_issuance_package_ord"). + Join("INNER", "super_cloud_issuance_package_ord", "super_cloud_issuance_package_ord.package_id = super_cloud_issuance_robot_package.id"). + Where("super_cloud_issuance_package_ord.uid = ?", uid). + OrderBy("super_cloud_issuance_package_ord.id DESC"). + Cols("super_cloud_issuance_package_ord.*, super_cloud_issuance_robot_package.name as package_name"). + Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&resp) + return } -func NewSuperCloudIssuancePackageOrdDb(engine *xorm.Engine) dao.SuperCloudIssuancePackageOrdDao { - return &SuperCloudIssuancePackageOrdDb{Db: engine} +func (s SuperCloudIssuancePackageOrdDb) GetCloudIssuancePackageOrd(ordNo string) (m *models.SuperCloudIssuancePackageOrd, err error) { + m = new(models.SuperCloudIssuancePackageOrd) + has, err := s.Db.Where("ord_no =?", ordNo).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil } diff --git a/src/implement/super_cloud_issuance_user_robot_bind_follow_db.go b/src/implement/super_cloud_issuance_user_robot_bind_follow_db.go index cf9b551..1f86ee7 100644 --- a/src/implement/super_cloud_issuance_user_robot_bind_follow_db.go +++ b/src/implement/super_cloud_issuance_user_robot_bind_follow_db.go @@ -2,13 +2,71 @@ package implement import ( "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" "xorm.io/xorm" ) +func NewSuperCloudIssuanceUserRobotBindFollowDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindFollowDao { + return &SuperCloudIssuanceUserRobotBindFollowDb{Db: engine} +} + type SuperCloudIssuanceUserRobotBindFollowDb struct { Db *xorm.Engine } -func NewSuperCloudIssuanceUserRobotBindFollowDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindFollowDao { - return &SuperCloudIssuanceUserRobotBindFollowDb{Db: engine} +func (s SuperCloudIssuanceUserRobotBindFollowDb) GetCloudIssuanceUserRobotBindFollow(id int) (m *models.SuperCloudIssuanceUserRobotBindFollow, err error) { + m = new(models.SuperCloudIssuanceUserRobotBindFollow) + has, err := s.Db.Where("id =?", id).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowDb) GetCloudIssuanceUserRobotBindFollowByChatRoomId(chatRoomId string, robotId int) (m *models.SuperCloudIssuanceUserRobotBindFollow, err error) { + m = new(models.SuperCloudIssuanceUserRobotBindFollow) + has, err := s.Db.Where("chat_room_id =? AND robot_id = ? AND state = 1", chatRoomId, robotId).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowDb) InsertCloudIssuanceUserRobotBindFollow(m *models.SuperCloudIssuanceUserRobotBindFollow) (id int, err error) { + _, err = s.Db.InsertOne(m) + if err != nil { + return 0, err + } + id = m.Id + return id, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowDb) SaveCloudIssuanceUserRobotBindFollow(id interface{}, m *models.SuperCloudIssuanceUserRobotBindFollow, forceColums ...string) (affected int64, err error) { + if forceColums != nil { + affected, err = s.Db.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = s.Db.Where("id=?", id).Update(m) + } + return +} + +func (s SuperCloudIssuanceUserRobotBindFollowDb) DeleteCloudIssuanceUserRobotBindFollow(id interface{}) (affected int64, err error) { + _, err = s.Db.Where("id=?", id).Delete(models.SuperCloudIssuanceUserRobotBindFollow{}) + if err != nil { + return 0, err + } + return 1, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowDb) CountCloudIssuanceUserRobotBindFollow(uid int) (total int64, err error) { + var m []*models.SuperCloudIssuanceUserRobotBindFollow + total, err = s.Db.Where("uid=?", uid).OrderBy("id DESC").FindAndCount(&m) + return } diff --git a/src/implement/super_cloud_issuance_user_robot_bind_follow_group_db.go b/src/implement/super_cloud_issuance_user_robot_bind_follow_group_db.go index 2d07114..47bf151 100644 --- a/src/implement/super_cloud_issuance_user_robot_bind_follow_group_db.go +++ b/src/implement/super_cloud_issuance_user_robot_bind_follow_group_db.go @@ -2,13 +2,69 @@ package implement import ( "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" "xorm.io/xorm" ) +func NewSuperCloudIssuanceUserRobotBindFollowGroupDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindFollowGroupDao { + return &SuperCloudIssuanceUserRobotBindFollowGroupDb{Db: engine} +} + type SuperCloudIssuanceUserRobotBindFollowGroupDb struct { Db *xorm.Engine } -func NewSuperCloudIssuanceUserRobotBindFollowGroupDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindFollowGroupDao { - return &SuperCloudIssuanceUserRobotBindFollowGroupDb{Db: engine} +func (s SuperCloudIssuanceUserRobotBindFollowGroupDb) GetCloudIssuanceUserRobotBindFollowGroup(id int) (m *models.SuperCloudIssuanceUserRobotBindFollowGroup, err error) { + m = new(models.SuperCloudIssuanceUserRobotBindFollowGroup) + has, err := s.Db.Where("id =?", id).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowGroupDb) GetCloudIssuanceUserRobotBindFollowGroupByBindId(bandId int) (m []*models.SuperCloudIssuanceUserRobotBindFollowGroup, err error) { + err = s.Db.Where("bind_id =?", bandId).Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return m, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowGroupDb) InsertCloudIssuanceUserRobotBindFollowGroup(m *models.SuperCloudIssuanceUserRobotBindFollowGroup) (id int, err error) { + _, err = s.Db.InsertOne(m) + if err != nil { + return 0, err + } + id = m.Id + return id, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowGroupDb) BatchAddCloudIssuanceUserRobotBindFollowGroups(data []*models.SuperCloudIssuanceUserRobotBindFollowGroup) (int64, error) { + affected, err := s.Db.Insert(data) + if err != nil { + return 0, err + } + return affected, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowGroupDb) SaveCloudIssuanceUserRobotBindFollowGroup(id interface{}, m *models.SuperCloudIssuanceUserRobotBindFollowGroup, forceColums ...string) (affected int64, err error) { + if forceColums != nil { + affected, err = s.Db.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = s.Db.Where("id=?", id).Update(m) + } + return +} + +func (s SuperCloudIssuanceUserRobotBindFollowGroupDb) DeleteCloudIssuanceUserRobotBindFollowGroup(bindId interface{}) (affected int64, err error) { + _, err = s.Db.Where("bind_id=?", bindId).Delete(models.SuperCloudIssuanceUserRobotBindFollowGroup{}) + if err != nil { + return 0, err + } + return 1, nil } diff --git a/src/implement/super_cloud_issuance_user_robot_bind_follow_user_db.go b/src/implement/super_cloud_issuance_user_robot_bind_follow_user_db.go index 236e0b8..6f049c7 100644 --- a/src/implement/super_cloud_issuance_user_robot_bind_follow_user_db.go +++ b/src/implement/super_cloud_issuance_user_robot_bind_follow_user_db.go @@ -2,13 +2,73 @@ package implement import ( "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" "xorm.io/xorm" ) +func NewSuperCloudIssuanceUserRobotBindFollowUserDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindFollowUserDao { + return &SuperCloudIssuanceUserRobotBindFollowUserDb{Db: engine} +} + type SuperCloudIssuanceUserRobotBindFollowUserDb struct { Db *xorm.Engine } -func NewSuperCloudIssuanceUserRobotBindFollowUserDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindFollowUserDao { - return &SuperCloudIssuanceUserRobotBindFollowUserDb{Db: engine} +func (s SuperCloudIssuanceUserRobotBindFollowUserDb) GetCloudIssuanceUserRobotBindFollowUser(id int) (m *models.SuperCloudIssuanceUserRobotBindFollowUser, err error) { + m = new(models.SuperCloudIssuanceUserRobotBindFollowUser) + has, err := s.Db.Where("id =?", id).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowUserDb) GetCloudIssuanceUserRobotBindFollowUserByWxId(wxId string) (m *models.SuperCloudIssuanceUserRobotBindFollowUser, err error) { + m = new(models.SuperCloudIssuanceUserRobotBindFollowUser) + has, err := s.Db.Where("monitor_host_wx_id =?", wxId).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowUserDb) InsertCloudIssuanceUserRobotBindFollowUser(m *models.SuperCloudIssuanceUserRobotBindFollowUser) (id int, err error) { + _, err = s.Db.InsertOne(m) + if err != nil { + return 0, err + } + id = m.Id + return id, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowUserDb) BatchAddCloudIssuanceUserRobotBindFollowUsers(data []*models.SuperCloudIssuanceUserRobotBindFollowUser) (int64, error) { + affected, err := s.Db.Insert(data) + if err != nil { + return 0, err + } + return affected, nil +} + +func (s SuperCloudIssuanceUserRobotBindFollowUserDb) SaveCloudIssuanceUserRobotBindFollowUser(id interface{}, m *models.SuperCloudIssuanceUserRobotBindFollowUser, forceColums ...string) (affected int64, err error) { + if forceColums != nil { + affected, err = s.Db.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = s.Db.Where("id=?", id).Update(m) + } + return +} + +func (s SuperCloudIssuanceUserRobotBindFollowUserDb) DeleteCloudIssuanceUserRobotBindFollowUser(bindId interface{}) (affected int64, err error) { + _, err = s.Db.Where("bind_id=?", bindId).Delete(models.SuperCloudIssuanceUserRobotBindFollowUser{}) + if err != nil { + return 0, err + } + return 1, nil } diff --git a/src/models/super_cloud_issuance_user_robot_bind_source.go b/src/models/super_cloud_issuance_user_robot_bind_source.go index 58ed28e..1342f54 100644 --- a/src/models/super_cloud_issuance_user_robot_bind_source.go +++ b/src/models/super_cloud_issuance_user_robot_bind_source.go @@ -3,7 +3,7 @@ package models type SuperCloudIssuanceUserRobotBindSource struct { Id int `json:"id" xorm:"not null pk autoincr INT(11)"` Name string `json:"name" xorm:"not null default '' comment('源头名称') VARCHAR(255)"` - ActivateGroupId string `json:"activate_group_id" xorm:"not null default '' comment('激活群id') VARCHAR(255)"` + ActivateGroupId int `json:"activate_group_id" xorm:"not null default '' comment('激活群id') VARCHAR(255)"` IsSee int `json:"is_see" xorm:"not null default 1 comment('是否可见(1可见 2不可见)') TINYINT(1)"` IsUse int `json:"is_use" xorm:"not null default 1 comment('是否可用(1正常转发 2暂停转发)') TINYINT(1)"` SendOrderNums int `json:"send_order_nums" xorm:"not null default 0 comment('发单量') INT(11)"` diff --git a/super_cloud_issuance/md/md_request.go b/super_cloud_issuance/md/md_request.go new file mode 100644 index 0000000..5e89852 --- /dev/null +++ b/super_cloud_issuance/md/md_request.go @@ -0,0 +1,20 @@ +package md + +type BuyPackageRecordsRequest struct { + Page int `json:"page"` + Limit int `json:"limit"` +} +type BuyPackageRecordsResponse struct { + Id int `json:"id"` + OrdNo string `json:"ord_no"` + TradeNo string `json:"trade_no"` + PackageId int `json:"package_id"` + Uid int `json:"uid"` + Amount string `json:"amount"` + State int `json:"state"` + PayChannel int `json:"pay_channel"` + Months int `json:"months"` + PackageName string `json:"package_name"` + CreateAt string `json:"create_at" ` + UpdateAt string `json:"update_at" ` +}