From 94cbf0dfb7bd5297db65c41b53cfe59437a25d84 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Fri, 30 Aug 2024 17:33:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=9C=82=E8=9C=9C=E5=88=86=E7=BA=A2-=E5=85=91?= =?UTF-8?q?=E6=8D=A2=E8=B4=A1=E7=8C=AE=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...honey_contribution_exchange_records_dao.go | 7 +++++ ...ribution_exchange_records_with_flow_dao.go | 10 ++++++ .../honey_contribution_exchange_records_db.go | 31 +++++++++++++++++++ ...tribution_exchange_records_with_flow_db.go | 23 ++++++++++++++ .../honey_contribution_exchange_records.go | 13 ++++++++ ...contribution_exchange_records_with_flow.go | 11 +++++++ src/models/honey_dividend_basic.go | 2 ++ 7 files changed, 97 insertions(+) create mode 100644 src/dao/honey_contribution_exchange_records_dao.go create mode 100644 src/dao/honey_contribution_exchange_records_with_flow_dao.go create mode 100644 src/implement/honey_contribution_exchange_records_db.go create mode 100644 src/implement/honey_contribution_exchange_records_with_flow_db.go create mode 100644 src/models/honey_contribution_exchange_records.go create mode 100644 src/models/honey_contribution_exchange_records_with_flow.go diff --git a/src/dao/honey_contribution_exchange_records_dao.go b/src/dao/honey_contribution_exchange_records_dao.go new file mode 100644 index 0000000..5f0843b --- /dev/null +++ b/src/dao/honey_contribution_exchange_records_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + +type HoneyContributionExchangeRecordsDao interface { + UpdateHoneyContributionExchangeRecords(m *models.HoneyContributionExchangeRecords, forceColums ...string) (int64, error) +} diff --git a/src/dao/honey_contribution_exchange_records_with_flow_dao.go b/src/dao/honey_contribution_exchange_records_with_flow_dao.go new file mode 100644 index 0000000..a0eb45d --- /dev/null +++ b/src/dao/honey_contribution_exchange_records_with_flow_dao.go @@ -0,0 +1,10 @@ +package dao + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + "xorm.io/xorm" +) + +type HoneyContributionExchangeRecordsWithFlowDao interface { + HoneyContributionExchangeRecordsWithFlowInsert(session *xorm.Session, honeyContributionExchangeRecordsWithFlow *models.HoneyContributionExchangeRecordsWithFlow) (int64, error) +} diff --git a/src/implement/honey_contribution_exchange_records_db.go b/src/implement/honey_contribution_exchange_records_db.go new file mode 100644 index 0000000..0384bad --- /dev/null +++ b/src/implement/honey_contribution_exchange_records_db.go @@ -0,0 +1,31 @@ +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" + "xorm.io/xorm" +) + +type HoneyContributionExchangeRecordsDb struct { + Db *xorm.Engine +} + +func NewHoneyContributionExchangeRecordsDb(engine *xorm.Engine) dao.HoneyContributionExchangeRecordsDao { + return &HoneyContributionExchangeRecordsDb{Db: engine} +} + +func (h HoneyContributionExchangeRecordsDb) UpdateHoneyContributionExchangeRecords(m *models.HoneyContributionExchangeRecords, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = h.Db.Where("id=?", m.Id).Cols(forceColums...).Update(m) + } else { + affected, err = h.Db.Where("id=?", m.Id).Update(m) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/implement/honey_contribution_exchange_records_with_flow_db.go b/src/implement/honey_contribution_exchange_records_with_flow_db.go new file mode 100644 index 0000000..563d0d5 --- /dev/null +++ b/src/implement/honey_contribution_exchange_records_with_flow_db.go @@ -0,0 +1,23 @@ +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" + "xorm.io/xorm" +) + +type HoneyContributionExchangeRecordsWithFlowDb struct { + Db *xorm.Engine +} + +func NewHoneyContributionExchangeRecordsWithFlowDb(engine *xorm.Engine) dao.HoneyContributionExchangeRecordsWithFlowDao { + return &HoneyContributionExchangeRecordsWithFlowDb{Db: engine} +} + +func (h HoneyContributionExchangeRecordsWithFlowDb) HoneyContributionExchangeRecordsWithFlowInsert(session *xorm.Session, honeyContributionExchangeRecordsWithFlow *models.HoneyContributionExchangeRecordsWithFlow) (int64, error) { + _, err := session.InsertOne(honeyContributionExchangeRecordsWithFlow) + if err != nil { + return 0, err + } + return honeyContributionExchangeRecordsWithFlow.Id, nil +} diff --git a/src/models/honey_contribution_exchange_records.go b/src/models/honey_contribution_exchange_records.go new file mode 100644 index 0000000..afa97af --- /dev/null +++ b/src/models/honey_contribution_exchange_records.go @@ -0,0 +1,13 @@ +package models + +type HoneyContributionExchangeRecords 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)"` + TotalContributionValues string `json:"total_contribution_values" xorm:"not null default 0.0000 comment('现场贡献值数') DECIMAL(10,4)"` + TotalExchangeHoneyValues string `json:"total_exchange_honey_values" xorm:"not null default 0.0000 comment('兑换蜂蜜数') DECIMAL(10,4)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 0 comment('状态(0:待兑换 1:兑换已完成)') TINYINT(1)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/models/honey_contribution_exchange_records_with_flow.go b/src/models/honey_contribution_exchange_records_with_flow.go new file mode 100644 index 0000000..8daff64 --- /dev/null +++ b/src/models/honey_contribution_exchange_records_with_flow.go @@ -0,0 +1,11 @@ +package models + +type HoneyContributionExchangeRecordsWithFlow 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)"` + DestroyValues string `json:"destroy_values" 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"` +} diff --git a/src/models/honey_dividend_basic.go b/src/models/honey_dividend_basic.go index c59dabb..d9469c3 100644 --- a/src/models/honey_dividend_basic.go +++ b/src/models/honey_dividend_basic.go @@ -8,6 +8,8 @@ type HoneyDividendBasic struct { DividendVipLevel int `json:"dividend_vip_level" xorm:"not null default 0 comment('分红会员等级(大于等于)') INT(11)"` 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)"` + CoinIdForContribution int `json:"coin_id_for_contribution" xorm:"not null default 0 comment('虚拟币id(作用于贡献值)') INT(11)"` + ContributionExchangeLowerLimit int `json:"contribution_exchange_lower_limit" xorm:"not null default 0 comment('贡献值最低兑换数量') 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"` }