From f12b0c0ee0c08519451c08b5868d08b243981fe2 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Wed, 7 Aug 2024 20:59:32 +0800 Subject: [PATCH] update --- src/dao/honey_dividend_basic_dao.go | 5 ++++ .../super_cloud_issuance_copy_writing_dao.go | 1 + src/dao/super_cloud_issuance_goods_dao.go | 2 ++ ...oud_issuance_user_robot_bind_circle_dao.go | 1 + .../super_cloud_issuance_user_robot_dao.go | 1 + src/implement/honey_dividend_basic_db.go | 14 +++++++++++ .../super_cloud_issuance_copy_writing_db.go | 13 ++++++++++ .../super_cloud_issuance_goods_db.go | 25 +++++++++++++++++-- ...loud_issuance_user_robot_bind_circle_db.go | 13 ++++++++-- .../super_cloud_issuance_user_robot_db.go | 8 ++++++ src/models/honey_dividend_basic.go | 16 ++++++++++++ src/models/honey_dividends_records.go | 16 ++++++++++++ .../honey_dividends_records_with_flow.go | 10 ++++++++ 13 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 src/dao/honey_dividend_basic_dao.go create mode 100644 src/implement/honey_dividend_basic_db.go create mode 100644 src/models/honey_dividend_basic.go create mode 100644 src/models/honey_dividends_records.go create mode 100644 src/models/honey_dividends_records_with_flow.go diff --git a/src/dao/honey_dividend_basic_dao.go b/src/dao/honey_dividend_basic_dao.go new file mode 100644 index 0000000..de92f85 --- /dev/null +++ b/src/dao/honey_dividend_basic_dao.go @@ -0,0 +1,5 @@ +package dao + +type HoneyDividendBasicDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/dao/super_cloud_issuance_copy_writing_dao.go b/src/dao/super_cloud_issuance_copy_writing_dao.go index 7b4e8da..0ffb4dc 100644 --- a/src/dao/super_cloud_issuance_copy_writing_dao.go +++ b/src/dao/super_cloud_issuance_copy_writing_dao.go @@ -4,4 +4,5 @@ import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" type SuperCloudIssuanceCopyWritingDao interface { FindSuperCloudIssuanceCopyWriting() (mm *[]models.SuperCloudIssuanceCopyWriting, err error) + GetSuperCloudIssuanceCopyWriting(pvd string) (m *models.SuperCloudIssuanceCopyWriting, err error) } diff --git a/src/dao/super_cloud_issuance_goods_dao.go b/src/dao/super_cloud_issuance_goods_dao.go index da109a9..b73167c 100644 --- a/src/dao/super_cloud_issuance_goods_dao.go +++ b/src/dao/super_cloud_issuance_goods_dao.go @@ -4,4 +4,6 @@ import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" type SuperCloudIssuanceGoodsDao interface { FindSuperCloudIssuanceGoods(id string, cid, start, limit int) (mm *[]models.SuperCloudIssuanceGoods, err error) + GetSuperCloudIssuanceGoodByCategory(categoryId int) (m *models.SuperCloudIssuanceGoods, err error) + DeleteCloudIssuanceGoods(id interface{}) (affected int64, err error) } diff --git a/src/dao/super_cloud_issuance_user_robot_bind_circle_dao.go b/src/dao/super_cloud_issuance_user_robot_bind_circle_dao.go index fffcaeb..975db2c 100644 --- a/src/dao/super_cloud_issuance_user_robot_bind_circle_dao.go +++ b/src/dao/super_cloud_issuance_user_robot_bind_circle_dao.go @@ -4,4 +4,5 @@ import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" type SuperCloudIssuanceUserRobotBindCircleDao interface { GetSuperCloudIssuanceUserRobotBindCircle(uid, robotId int) (mm *models.SuperCloudIssuanceUserRobotBindCircle) + GetSuperCloudIssuanceUserRobotBindCircleByCategory(uid, categoryId int) (mm *models.SuperCloudIssuanceUserRobotBindCircle) } diff --git a/src/dao/super_cloud_issuance_user_robot_dao.go b/src/dao/super_cloud_issuance_user_robot_dao.go index 78dd8bc..932b596 100644 --- a/src/dao/super_cloud_issuance_user_robot_dao.go +++ b/src/dao/super_cloud_issuance_user_robot_dao.go @@ -10,4 +10,5 @@ type SuperCloudIssuanceUserRobotDao interface { SaveSuperCloudIssuanceUserRobot(id interface{}, m *models.SuperCloudIssuanceUserRobot, forceColums ...string) (affected int64, err error) GetCloudIssuanceUserFreeRobot() (m *models.SuperCloudIssuanceUserRobot, err error) InsertCloudIssuanceUserRobot(m *models.SuperCloudIssuanceUserRobot, officialDb *xorm.Engine) (id int, err error) + FindOnLineCloudIssuanceUserRobot() (m []*models.SuperCloudIssuanceUserRobot, err error) } diff --git a/src/implement/honey_dividend_basic_db.go b/src/implement/honey_dividend_basic_db.go new file mode 100644 index 0000000..e822066 --- /dev/null +++ b/src/implement/honey_dividend_basic_db.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" + "xorm.io/xorm" +) + +type HoneyDividendBasicDb struct { + Db *xorm.Engine +} + +func NewHoneyDividendBasicDb(engine *xorm.Engine) dao.HoneyDividendBasicDao { + return &HoneyDividendBasicDb{Db: engine} +} diff --git a/src/implement/super_cloud_issuance_copy_writing_db.go b/src/implement/super_cloud_issuance_copy_writing_db.go index f183c8a..5807a84 100644 --- a/src/implement/super_cloud_issuance_copy_writing_db.go +++ b/src/implement/super_cloud_issuance_copy_writing_db.go @@ -14,6 +14,19 @@ type SuperCloudIssuanceCopyWritingDb struct { func NewSuperCloudIssuanceCopyWritingDb(engine *xorm.Engine) dao.SuperCloudIssuanceCopyWritingDao { return &SuperCloudIssuanceCopyWritingDb{Db: engine} } + +func (h SuperCloudIssuanceCopyWritingDb) GetSuperCloudIssuanceCopyWriting(pvd string) (m *models.SuperCloudIssuanceCopyWriting, err error) { + m = new(models.SuperCloudIssuanceCopyWriting) + has, err := h.Db.Where("provider = ?", pvd).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + func (h SuperCloudIssuanceCopyWritingDb) FindSuperCloudIssuanceCopyWriting() (mm *[]models.SuperCloudIssuanceCopyWriting, err error) { var m []models.SuperCloudIssuanceCopyWriting if err := h.Db.Where("1=1").Find(&m); err != nil { diff --git a/src/implement/super_cloud_issuance_goods_db.go b/src/implement/super_cloud_issuance_goods_db.go index 0287a23..20b0d76 100644 --- a/src/implement/super_cloud_issuance_goods_db.go +++ b/src/implement/super_cloud_issuance_goods_db.go @@ -7,13 +7,34 @@ import ( "xorm.io/xorm" ) +func NewSuperCloudIssuanceGoodsDb(engine *xorm.Engine) dao.SuperCloudIssuanceGoodsDao { + return &SuperCloudIssuanceGoodsDb{Db: engine} +} + type SuperCloudIssuanceGoodsDb struct { Db *xorm.Engine } -func NewSuperCloudIssuanceGoodsDb(engine *xorm.Engine) dao.SuperCloudIssuanceGoodsDao { - return &SuperCloudIssuanceGoodsDb{Db: engine} +func (h SuperCloudIssuanceGoodsDb) DeleteCloudIssuanceGoods(id interface{}) (affected int64, err error) { + _, err = h.Db.Where("id=?", id).Delete(models.SuperCloudIssuanceGoods{}) + if err != nil { + return 0, err + } + return 1, nil } + +func (h SuperCloudIssuanceGoodsDb) GetSuperCloudIssuanceGoodByCategory(categoryId int) (m *models.SuperCloudIssuanceGoods, err error) { + m = new(models.SuperCloudIssuanceGoods) + has, err := h.Db.Where("cloud_issuance_category_id = ?", categoryId).OrderBy("id ASC").Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + func (h SuperCloudIssuanceGoodsDb) FindSuperCloudIssuanceGoods(id string, cid, start, limit int) (mm *[]models.SuperCloudIssuanceGoods, err error) { var m []models.SuperCloudIssuanceGoods sess := h.Db.Where("1=1") diff --git a/src/implement/super_cloud_issuance_user_robot_bind_circle_db.go b/src/implement/super_cloud_issuance_user_robot_bind_circle_db.go index 991b7de..0f4d05c 100644 --- a/src/implement/super_cloud_issuance_user_robot_bind_circle_db.go +++ b/src/implement/super_cloud_issuance_user_robot_bind_circle_db.go @@ -6,13 +6,22 @@ import ( "xorm.io/xorm" ) +func NewSuperCloudIssuanceUserRobotBindCircleDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindCircleDao { + return &SuperCloudIssuanceUserRobotBindCircleDb{Db: engine} +} + type SuperCloudIssuanceUserRobotBindCircleDb struct { Db *xorm.Engine } -func NewSuperCloudIssuanceUserRobotBindCircleDb(engine *xorm.Engine) dao.SuperCloudIssuanceUserRobotBindCircleDao { - return &SuperCloudIssuanceUserRobotBindCircleDb{Db: engine} +func (h SuperCloudIssuanceUserRobotBindCircleDb) GetSuperCloudIssuanceUserRobotBindCircleByCategory(uid, categoryId int) (mm *models.SuperCloudIssuanceUserRobotBindCircle) { + var m models.SuperCloudIssuanceUserRobotBindCircle + if has, err := h.Db.Where("uid =? AND goods_category_id =? AND state =1", uid, categoryId).Get(&m); err != nil || has == false { + return nil + } + return &m } + func (h SuperCloudIssuanceUserRobotBindCircleDb) GetSuperCloudIssuanceUserRobotBindCircle(uid, robotId int) (mm *models.SuperCloudIssuanceUserRobotBindCircle) { var m models.SuperCloudIssuanceUserRobotBindCircle if has, err := h.Db.Where("robot_id=? and uid=?", robotId, uid).Get(&m); err != nil || has == false { diff --git a/src/implement/super_cloud_issuance_user_robot_db.go b/src/implement/super_cloud_issuance_user_robot_db.go index 7714b96..4c6d36a 100644 --- a/src/implement/super_cloud_issuance_user_robot_db.go +++ b/src/implement/super_cloud_issuance_user_robot_db.go @@ -26,6 +26,14 @@ type SuperCloudIssuanceUserRobotDb struct { MasterId string `json:"master_id"` } +func (superCloudIssuanceUserRobotDb *SuperCloudIssuanceUserRobotDb) FindOnLineCloudIssuanceUserRobot() (m []*models.SuperCloudIssuanceUserRobot, err error) { + err = superCloudIssuanceUserRobotDb.Db.Where("login_status =? AND is_enabled =0", 1).OrderBy("id ASC").Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return m, nil +} + func (superCloudIssuanceUserRobotDb *SuperCloudIssuanceUserRobotDb) InsertCloudIssuanceUserRobot(m *models.SuperCloudIssuanceUserRobot, officialDb *xorm.Engine) (id int, err error) { _, err = superCloudIssuanceUserRobotDb.Db.InsertOne(m) if err != nil { diff --git a/src/models/honey_dividend_basic.go b/src/models/honey_dividend_basic.go new file mode 100644 index 0000000..06477d5 --- /dev/null +++ b/src/models/honey_dividend_basic.go @@ -0,0 +1,16 @@ +package models + +type HoneyDividendBasic struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + IsOpen int `json:"is_open" xorm:"not null default 1 comment('是否开启(1:开启 2:关闭)') TINYINT(1)"` + NowHoneyValues string `json:"now_honey_values" xorm:"not null default 0.0000 comment('现有蜂蜜数量') DECIMAL(10,4)"` + DestroyHoneyValues string `json:"destroy_honey_values" xorm:"not null default 0.0000 comment('销毁蜂蜜数量') DECIMAL(10,4)"` + DividendVipLevel int `json:"dividend_vip_level" xorm:"not null default 0 comment('分红会员等级(大于等于)') INT(11)"` + OneYuanAmountProduceHoneyValues string `json:"one_yuan_amount_produce_honey_values" xorm:"not null default 0.0000 comment('一元销售额产生x蜂蜜') DECIMAL(10,4)"` + RecommendOnePersonProduceHoneyValues string `json:"recommend_one_person_produce_honey_values" xorm:"not null default 0.0000 comment('推荐一人产生x蜂蜜') DECIMAL(10,4)"` + UserRegisterProduceHoneyValues string `json:"user_register_produce_honey_values" xorm:"not null default 0.0000 comment('新用户注册产生x蜂蜜') DECIMAL(10,4)"` + EveryMonthExchangeOneCashDestroyHoneyValues string `json:"every_month_exchange_one_cash_destroy_honey_values" xorm:"not null default 0.0000 comment('每月兑换一次现金销毁x蜂蜜') DECIMAL(10,4)"` + CoinId int `json:"coin_id" xorm:"not null default 0 comment('虚拟币id(作用于蜂蜜)') INT(11)"` + 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/src/models/honey_dividends_records.go b/src/models/honey_dividends_records.go new file mode 100644 index 0000000..42cb086 --- /dev/null +++ b/src/models/honey_dividends_records.go @@ -0,0 +1,16 @@ +package models + +import ( + "time" +) + +type HoneyDividendsRecords struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Amount string `json:"amount" xorm:"not null default 0.00000000 comment('分红值') DECIMAL(10,8)"` + UserNums int `json:"user_nums" xorm:"not null default 0 comment('参与分红人数') INT(11)"` + TotalHoneyValues string `json:"total_honey_values" xorm:"not null default 0.0000 comment('现场蜂蜜数') DECIMAL(10,4)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + State int32 `json:"state" xorm:"not null default 0 comment('状态(0:待分红 1:分红已完成)') TINYINT(1)"` + CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/models/honey_dividends_records_with_flow.go b/src/models/honey_dividends_records_with_flow.go new file mode 100644 index 0000000..653d057 --- /dev/null +++ b/src/models/honey_dividends_records_with_flow.go @@ -0,0 +1,10 @@ +package models + +type HoneyDividendsRecordsWithFlow struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + RecordsId int `json:"records_id" xorm:"not null default 0 comment('记录id') INT(11)"` + Uid int `json:"uid" xorm:"not null default 0 comment('uid') INT(11)"` + Amount string `json:"amount" xorm:"not null default 0.0000 comment('金额') DECIMAL(10,4)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +}