From 45aac72682d8eb9097fe0334be97c28995628cb8 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 17 Jun 2024 16:09:10 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E8=B6=85=E7=BA=A7=E4=BA=91=E5=8F=91?= =?UTF-8?q?=E5=8D=95=E7=9B=B8=E5=85=B3=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/super_cloud_issuance_basic_dao.go | 7 ++ .../super_cloud_issuance_package_ord_dao.go | 4 +- .../super_cloud_issuance_robot_package_dao.go | 4 +- ...ud_issuance_user_free_robot_records_dao.go | 10 +++ ...loud_issuance_user_robot_bind_group_dao.go | 32 +++++++- .../super_cloud_issuance_user_robot_dao.go | 7 +- .../super_cloud_issuance_basic_db.go | 28 +++++++ .../super_cloud_issuance_robot_package_db.go | 35 +++++++- ...oud_issuance_user_free_robot_records_db.go | 59 +++++++++++++ ...cloud_issuance_user_robot_bind_group_db.go | 82 ++++++++++++++++++- .../super_cloud_issuance_user_robot_db.go | 76 ++++++++++++++++- src/models/super_cloud_issuance_basic.go | 3 +- ..._cloud_issuance_user_free_robot_records.go | 11 +++ .../enum_super_cloud_issuance_user_robot.go | 49 +++++++++++ 14 files changed, 392 insertions(+), 15 deletions(-) create mode 100644 src/dao/super_cloud_issuance_basic_dao.go create mode 100644 src/dao/super_cloud_issuance_user_free_robot_records_dao.go create mode 100644 src/implement/super_cloud_issuance_basic_db.go create mode 100644 src/implement/super_cloud_issuance_user_free_robot_records_db.go create mode 100644 src/models/super_cloud_issuance_user_free_robot_records.go create mode 100644 super_cloud_issuance/enum/enum_super_cloud_issuance_user_robot.go diff --git a/src/dao/super_cloud_issuance_basic_dao.go b/src/dao/super_cloud_issuance_basic_dao.go new file mode 100644 index 0000000..84585f6 --- /dev/null +++ b/src/dao/super_cloud_issuance_basic_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + +type SuperCloudIssuanceBasicDao interface { + GetSuperCloudIssuanceBasic() (m *models.SuperCloudIssuanceBasic, err error) +} diff --git a/src/dao/super_cloud_issuance_package_ord_dao.go b/src/dao/super_cloud_issuance_package_ord_dao.go index 96eae0f..8eee63c 100644 --- a/src/dao/super_cloud_issuance_package_ord_dao.go +++ b/src/dao/super_cloud_issuance_package_ord_dao.go @@ -1,5 +1,7 @@ package dao +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + type SuperCloudIssuancePackageOrdDao interface { - //TODO:: You can add specific method definitions here + GetCloudIssuancePackageOrd(ordNo string) (m *models.SuperCloudIssuancePackageOrd, err error) } diff --git a/src/dao/super_cloud_issuance_robot_package_dao.go b/src/dao/super_cloud_issuance_robot_package_dao.go index 11722cc..b3619a4 100644 --- a/src/dao/super_cloud_issuance_robot_package_dao.go +++ b/src/dao/super_cloud_issuance_robot_package_dao.go @@ -1,5 +1,7 @@ package dao +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + type SuperCloudIssuanceRobotPackageDao interface { - //TODO:: You can add specific method definitions here + FindSuperCloudIssuanceRobotPackage(params map[string]interface{}) (m []*models.SuperCloudIssuanceRobotPackage, err error) } diff --git a/src/dao/super_cloud_issuance_user_free_robot_records_dao.go b/src/dao/super_cloud_issuance_user_free_robot_records_dao.go new file mode 100644 index 0000000..c25022f --- /dev/null +++ b/src/dao/super_cloud_issuance_user_free_robot_records_dao.go @@ -0,0 +1,10 @@ +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + +type SuperCloudIssuanceUserFreeRobotRecordsDao interface { + GetCloudIssuanceUserFreeRobotRecord() (m *models.SuperCloudIssuanceUserFreeRobotRecords, err error) + GetCloudIssuanceUserFreeRobotRecordByRobotId(robotId int) (m *models.SuperCloudIssuanceUserFreeRobotRecords, err error) + InsertCloudIssuanceUserFreeRobotRecord(m *models.SuperCloudIssuanceUserFreeRobotRecords) (id int, err error) + SaveCloudIssuanceUserFreeRobotRecord(id interface{}, m *models.SuperCloudIssuanceUserFreeRobotRecords, forceColums ...string) (affected int64, err error) +} 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 920cf4c..fe46c43 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 @@ -1,5 +1,33 @@ -package dao +package dao + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + "time" +) type SuperCloudIssuanceUserRobotBindGroupDao interface { - //TODO:: You can add specific method definitions here + GetSuperCloudIssuanceUserRobotBindGroup(id int) (m *models.SuperCloudIssuanceUserRobotBindGroup, err error) + GetSuperCloudIssuanceUserRobotBindGroupByChatRoomId(chatRoomId string) (m *models.SuperCloudIssuanceUserRobotBindGroup, err error) + InsertSuperCloudIssuanceUserRobotBindGroup(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) + 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"` } diff --git a/src/dao/super_cloud_issuance_user_robot_dao.go b/src/dao/super_cloud_issuance_user_robot_dao.go index 043b008..11dde92 100644 --- a/src/dao/super_cloud_issuance_user_robot_dao.go +++ b/src/dao/super_cloud_issuance_user_robot_dao.go @@ -1,5 +1,10 @@ package dao +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + type SuperCloudIssuanceUserRobotDao interface { - //TODO:: You can add specific method definitions here + GetSuperCloudIssuanceUserRobot() (m *models.SuperCloudIssuanceUserRobot, err error) + SaveSuperCloudIssuanceUserRobot(id interface{}, m *models.SuperCloudIssuanceUserRobot, forceColums ...string) (affected int64, err error) + GetCloudIssuanceUserFreeRobot() (m *models.SuperCloudIssuanceUserRobot, err error) + InsertCloudIssuanceUserRobot(m *models.SuperCloudIssuanceUserRobot) (id int, err error) } diff --git a/src/implement/super_cloud_issuance_basic_db.go b/src/implement/super_cloud_issuance_basic_db.go new file mode 100644 index 0000000..d3ce7a9 --- /dev/null +++ b/src/implement/super_cloud_issuance_basic_db.go @@ -0,0 +1,28 @@ +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 NewSuperCloudIssuanceBasicDb(engine *xorm.Engine) dao.SuperCloudIssuanceBasicDao { + return &SuperCloudIssuanceBasicDb{Db: engine} +} + +type SuperCloudIssuanceBasicDb struct { + Db *xorm.Engine +} + +func (s SuperCloudIssuanceBasicDb) GetSuperCloudIssuanceBasic() (m *models.SuperCloudIssuanceBasic, err error) { + m = new(models.SuperCloudIssuanceBasic) + has, err := s.Db.Where("id >= 1").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_robot_package_db.go b/src/implement/super_cloud_issuance_robot_package_db.go index 52b8da0..00e7c92 100644 --- a/src/implement/super_cloud_issuance_robot_package_db.go +++ b/src/implement/super_cloud_issuance_robot_package_db.go @@ -2,13 +2,44 @@ 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_utils "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" + "fmt" + "reflect" "xorm.io/xorm" ) +func NewSuperCloudIssuanceRobotPackageDb(engine *xorm.Engine) dao.SuperCloudIssuanceRobotPackageDao { + return &SuperCloudIssuanceRobotPackageDb{Db: engine} +} + type SuperCloudIssuanceRobotPackageDb struct { Db *xorm.Engine } -func NewSuperCloudIssuanceRobotPackageDb(engine *xorm.Engine) dao.SuperCloudIssuanceRobotPackageDao { - return &SuperCloudIssuanceRobotPackageDb{Db: engine} +func (s SuperCloudIssuanceRobotPackageDb) FindSuperCloudIssuanceRobotPackage(params map[string]interface{}) (m []*models.SuperCloudIssuanceRobotPackage, err error) { + if params["key"] == nil { + //查询全部数据 + err := s.Db.OrderBy("sort DESC").Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return m, nil + } else { + if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { + //指定In查询 + if err := s.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Warn(err) + } + return m, nil + } else { + var query = fmt.Sprintf("%s =?", params["key"]) + err := s.Db.Where(query, params["value"]).Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return m, nil + } + } } diff --git a/src/implement/super_cloud_issuance_user_free_robot_records_db.go b/src/implement/super_cloud_issuance_user_free_robot_records_db.go new file mode 100644 index 0000000..072f2c4 --- /dev/null +++ b/src/implement/super_cloud_issuance_user_free_robot_records_db.go @@ -0,0 +1,59 @@ +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 NewSuperCloudIssuanceUserFreeRobotRecordsDb(engine *xorm.Engine, uid int) dao.SuperCloudIssuanceUserFreeRobotRecordsDao { + return &SuperCloudIssuanceUserFreeRobotRecordsDb{Db: engine, Uid: uid} +} + +type SuperCloudIssuanceUserFreeRobotRecordsDb struct { + Db *xorm.Engine `json:"model"` + Uid int `json:"uid"` +} + +func (s SuperCloudIssuanceUserFreeRobotRecordsDb) GetCloudIssuanceUserFreeRobotRecord() (m *models.SuperCloudIssuanceUserFreeRobotRecords, err error) { + m = new(models.SuperCloudIssuanceUserFreeRobotRecords) + has, err := s.Db.Where("uid = ?", s.Uid).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (s SuperCloudIssuanceUserFreeRobotRecordsDb) GetCloudIssuanceUserFreeRobotRecordByRobotId(robotId int) (m *models.SuperCloudIssuanceUserFreeRobotRecords, err error) { + m = new(models.SuperCloudIssuanceUserFreeRobotRecords) + has, err := s.Db.Where("robot_id = ?", robotId).And("uid = ?", s.Uid).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (s SuperCloudIssuanceUserFreeRobotRecordsDb) InsertCloudIssuanceUserFreeRobotRecord(m *models.SuperCloudIssuanceUserFreeRobotRecords) (id int, err error) { + _, err = s.Db.InsertOne(m) + if err != nil { + return 0, err + } + id = m.Id + return id, nil +} + +func (s SuperCloudIssuanceUserFreeRobotRecordsDb) SaveCloudIssuanceUserFreeRobotRecord(id interface{}, m *models.SuperCloudIssuanceUserFreeRobotRecords, 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 +} 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 c1db23f..21a40fb 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 @@ -1,14 +1,88 @@ -package implement +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 NewSuperCloudIssuanceUserRobotBindGroupDb(engine *xorm.Engine, uid int) dao.SuperCloudIssuanceUserRobotBindGroupDao { + return &SuperCloudIssuanceUserRobotBindGroupDb{ + Db: engine, + Uid: uid, + } +} + type SuperCloudIssuanceUserRobotBindGroupDb struct { - Db *xorm.Engine + Db *xorm.Engine `json:"model"` + Uid int `json:"uid"` +} + +func (s SuperCloudIssuanceUserRobotBindGroupDb) GetSuperCloudIssuanceUserRobotBindGroup(id int) (m *models.SuperCloudIssuanceUserRobotBindGroup, err error) { + m = new(models.SuperCloudIssuanceUserRobotBindGroup) + 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 SuperCloudIssuanceUserRobotBindGroupDb) GetSuperCloudIssuanceUserRobotBindGroupByChatRoomId(chatRoomId string) (m *models.SuperCloudIssuanceUserRobotBindGroup, err error) { + m = new(models.SuperCloudIssuanceUserRobotBindGroup) + has, err := s.Db.Where("chat_room_id =?", chatRoomId).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (s SuperCloudIssuanceUserRobotBindGroupDb) InsertSuperCloudIssuanceUserRobotBindGroup(m *models.SuperCloudIssuanceUserRobotBindGroup) (id int, err error) { + _, err = s.Db.InsertOne(m) + if err != nil { + return 0, err + } + id = m.Id + return id, nil +} + +func (s SuperCloudIssuanceUserRobotBindGroupDb) SaveSuperCloudIssuanceUserRobotBindGroup(id interface{}, m *models.SuperCloudIssuanceUserRobotBindGroup, 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 SuperCloudIssuanceUserRobotBindGroupDb) DeleteSuperCloudIssuanceUserRobotBindGroup(id interface{}) (affected int64, err error) { + _, err = s.Db.Where("id=?", id).Delete(models.SuperCloudIssuanceUserRobotBindGroup{}) + if err != nil { + return 0, err + } + 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"). + 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"). + FindAndCount(&resp) + return } -func NewSuperCloudIssuanceUserRobotBindGroupDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindGroupDao { - return &SuperCloudIssuanceUserRobotBindGroupDb{Db: engine} +func (s SuperCloudIssuanceUserRobotBindGroupDb) FindSuperCloudIssuanceUserRobotBindGroupByCategory(categoryId int) (m []*models.SuperCloudIssuanceUserRobotBindGroup, err error) { + err = s.Db.Where("uid =? AND goods_category_id =? AND state =1", s.Uid, categoryId).OrderBy("id ASC").Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return m, nil } diff --git a/src/implement/super_cloud_issuance_user_robot_db.go b/src/implement/super_cloud_issuance_user_robot_db.go index 2ae3bdd..4a1451c 100644 --- a/src/implement/super_cloud_issuance_user_robot_db.go +++ b/src/implement/super_cloud_issuance_user_robot_db.go @@ -2,13 +2,83 @@ 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/enum" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" + "strconv" + "time" "xorm.io/xorm" ) +func NewSuperCloudIssuanceUserRobotDb(engine *xorm.Engine, uid int, masterId string) dao.SuperCloudIssuanceUserRobotDao { + return &SuperCloudIssuanceUserRobotDb{ + Db: engine, + Uid: uid, + MasterId: masterId, + } +} + type SuperCloudIssuanceUserRobotDb struct { - Db *xorm.Engine + Db *xorm.Engine `json:"model"` + Uid int `json:"uid"` + MasterId string `json:"master_id"` +} + +func (superCloudIssuanceUserRobotDb *SuperCloudIssuanceUserRobotDb) InsertCloudIssuanceUserRobot(m *models.SuperCloudIssuanceUserRobot) (id int, err error) { + _, err = cloudIssuanceUserRobotDb.Db.InsertOne(m) + if err != nil { + return 0, err + } + id = m.Id + //顺便新增一份数据到总后台的 `cloud_issuance_robot_records` 表 + db.CloudIssuanceRobotRecordsInsert(&model2.CloudIssuanceRobotRecords{ + MasterId: cloudIssuanceUserRobotDb.MasterId, + RobotId: strconv.Itoa(m.RobotId), + Uid: cloudIssuanceUserRobotDb.Uid, + }) + return id, nil +} + +func (superCloudIssuanceUserRobotDb *SuperCloudIssuanceUserRobotDb) GetCloudIssuanceUserFreeRobot() (m *models.SuperCloudIssuanceUserRobot, err error) { + //TODO::先将所有已过期的状态改变 + timeStamp := time.Now().Unix() + sql := "update cloud_issuance_user_robot set is_enabled = ? where end_time <= ? and robot_kind =?" + _, err = superCloudIssuanceUserRobotDb.Db.Exec(sql, 3, timeStamp, enum.ShareRobot) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + + m = new(models.SuperCloudIssuanceUserRobot) + has, err := superCloudIssuanceUserRobotDb.Db.Where("uid = -1"). + And("robot_kind =?", enum.ShareRobot). + And("is_enabled = 0").Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (superCloudIssuanceUserRobotDb *SuperCloudIssuanceUserRobotDb) GetSuperCloudIssuanceUserRobot() (m *models.SuperCloudIssuanceUserRobot, err error) { + m = new(models.SuperCloudIssuanceUserRobot) + has, err := superCloudIssuanceUserRobotDb.Db.Where("uid = ?", superCloudIssuanceUserRobotDb.Uid). + And("is_enabled = 0").Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil } -func NewSuperCloudIssuanceUserRobotDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotDao { - return &SuperCloudIssuanceUserRobotDb{Db: engine} +func (superCloudIssuanceUserRobotDb *SuperCloudIssuanceUserRobotDb) SaveSuperCloudIssuanceUserRobot(id interface{}, m *models.SuperCloudIssuanceUserRobot, forceColums ...string) (affected int64, err error) { + if forceColums != nil { + affected, err = superCloudIssuanceUserRobotDb.Db.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = superCloudIssuanceUserRobotDb.Db.Where("id=?", id).Update(m) + } + return } diff --git a/src/models/super_cloud_issuance_basic.go b/src/models/super_cloud_issuance_basic.go index 5b46b82..edff875 100644 --- a/src/models/super_cloud_issuance_basic.go +++ b/src/models/super_cloud_issuance_basic.go @@ -3,7 +3,8 @@ package models type SuperCloudIssuanceBasic struct { Id int `json:"id" xorm:"not null pk autoincr INT(11)"` IsOpenFreeAccess int `json:"is_open_free_access" xorm:"not null default 0 comment('是否开启-免费使用权限') TINYINT(3)"` - FreeAccess string `json:"free_access" xorm:"not null comment('免费使用权限') TEXT"` + FreeAccess int `json:"free_access" xorm:"not null comment('免费使用天数') TINYINT(3)"` + MaxActivityGroupNums int `json:"max_activity_group_nums" xorm:"not null comment('最大激活群数量') TINYINT(3)"` UseAccess int `json:"use_access" xorm:"not null default 0 comment('使用权限(会员等级)') TINYINT(3)"` TimeIntervalIssuanceOnCircleOfFriends int `json:"time_interval_issuance_on_circle_of_friends" xorm:"not null default 10 comment('朋友圈发单时间间隔(分钟)') TINYINT(3)"` TimeIntervalIssuanceOnGroups int `json:"time_interval_issuance_on_groups" xorm:"not null default 10 comment('群发单时间间隔(分钟)') TINYINT(3)"` diff --git a/src/models/super_cloud_issuance_user_free_robot_records.go b/src/models/super_cloud_issuance_user_free_robot_records.go new file mode 100644 index 0000000..f65bebb --- /dev/null +++ b/src/models/super_cloud_issuance_user_free_robot_records.go @@ -0,0 +1,11 @@ +package models + +type SuperCloudIssuanceUserFreeRobotRecords struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int `json:"uid" xorm:"not null default 0 comment('uid') INT(11)"` + RobotId int `json:"robot_id" xorm:"not null default 0 comment('机器人id') INT(11)"` + EndTime string `json:"end_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('过期时间') DATETIME"` + 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"` +} diff --git a/super_cloud_issuance/enum/enum_super_cloud_issuance_user_robot.go b/super_cloud_issuance/enum/enum_super_cloud_issuance_user_robot.go new file mode 100644 index 0000000..f1a061b --- /dev/null +++ b/super_cloud_issuance/enum/enum_super_cloud_issuance_user_robot.go @@ -0,0 +1,49 @@ +package enum + +type CloudIssuanceUserRobotKind int + +const ( + ExclusiveRobot = 1 + ShareRobot = 2 +) + +func (gt CloudIssuanceUserRobotKind) String() string { + switch gt { + case ExclusiveRobot: + return "独享机器人" + case ShareRobot: + return "共享机器人" + default: + return "未知" + } +} + +type CloudIssuanceUserRobotType int + +const ( + IssuingRobot = 1 + ForwardRobot = 2 + RebateRobot = 3 + AllAroundRobot = 4 + SmallRobot = 5 + SendToMomentsRobot = 6 +) + +func (gt CloudIssuanceUserRobotType) String() string { + switch gt { + case IssuingRobot: + return "发单机器人" + case ForwardRobot: + return "转发机器人" + case RebateRobot: + return "返利机器人" + case AllAroundRobot: + return "全能机器人" + case SmallRobot: + return "小型机器人" + case SendToMomentsRobot: + return "发圈机器人" + default: + return "未知" + } +}