From ece7da66a9f5850a6197792accd0e021ac3d1b1e Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Mon, 25 Nov 2024 19:14:33 +0800 Subject: [PATCH] add Contribution Value Basic Setting --- .../contribution_value_basic_setting_dao.go | 10 ++++ src/dao/fin_withdraw_apply_dao.go | 2 +- ...tribution_value_basic_setting_implement.go | 52 +++++++++++++++++++ src/implement/fin_withdraw_apply_implement.go | 6 +-- src/model/contribution_value_basic_setting.go | 9 ++++ src/model/fin_withdraw_apply.go | 1 + 6 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 src/dao/contribution_value_basic_setting_dao.go create mode 100644 src/implement/contribution_value_basic_setting_implement.go create mode 100644 src/model/contribution_value_basic_setting.go diff --git a/src/dao/contribution_value_basic_setting_dao.go b/src/dao/contribution_value_basic_setting_dao.go new file mode 100644 index 0000000..19645ea --- /dev/null +++ b/src/dao/contribution_value_basic_setting_dao.go @@ -0,0 +1,10 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type ContributionValueBasicSettingDao interface { + //TODO:: You can add specific method definitions here + ContributionValueBasicSettingGetOne() (*model.ContributionValueBasicSetting, error) + ContributionValueBasicSettingInsert(m *model.ContributionValueBasicSetting) (int, error) + ContributionValueBasicSettingUpdate(id interface{}, contributionValueBasicSetting *model.ContributionValueBasicSetting, forceColumns ...string) (int64, error) +} diff --git a/src/dao/fin_withdraw_apply_dao.go b/src/dao/fin_withdraw_apply_dao.go index d3d3af1..7e1f6e6 100644 --- a/src/dao/fin_withdraw_apply_dao.go +++ b/src/dao/fin_withdraw_apply_dao.go @@ -7,5 +7,5 @@ import ( type FinWithdrawApplyDao interface { //TODO:: You can add specific method definitions here - FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawSetting, error) + FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) } diff --git a/src/implement/contribution_value_basic_setting_implement.go b/src/implement/contribution_value_basic_setting_implement.go new file mode 100644 index 0000000..c5d9708 --- /dev/null +++ b/src/implement/contribution_value_basic_setting_implement.go @@ -0,0 +1,52 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "xorm.io/xorm" +) + +func NewContributionValueBasicSettingDb(engine *xorm.Engine) dao.ContributionValueBasicSettingDao { + return &ContributionValueBasicSettingDb{Db: engine} +} + +type ContributionValueBasicSettingDb struct { + Db *xorm.Engine +} + +func (c ContributionValueBasicSettingDb) ContributionValueBasicSettingGetOne() (*model.ContributionValueBasicSetting, error) { + var m model.ContributionValueBasicSetting + get, err := c.Db.Where("id > 1").Desc("create_at").Get(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if !get { + return nil, nil + } + return &m, nil +} + +func (c ContributionValueBasicSettingDb) ContributionValueBasicSettingInsert(m *model.ContributionValueBasicSetting) (int, error) { + _, err := c.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (c ContributionValueBasicSettingDb) ContributionValueBasicSettingUpdate(id interface{}, contributionValueBasicSetting *model.ContributionValueBasicSetting, forceColumns ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColumns != nil { + affected, err = c.Db.Where("id=?", id).MustCols(forceColumns...).Update(contributionValueBasicSetting) + } else { + affected, err = c.Db.Where("id=?", id).Update(contributionValueBasicSetting) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/implement/fin_withdraw_apply_implement.go b/src/implement/fin_withdraw_apply_implement.go index 1eb0588..bc559c5 100644 --- a/src/implement/fin_withdraw_apply_implement.go +++ b/src/implement/fin_withdraw_apply_implement.go @@ -18,9 +18,9 @@ type FinWithdrawApplyDb struct { Db *xorm.Engine } -func (f FinWithdrawApplyDb) FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawSetting, error) { - var m *[]model.FinWithdrawSetting - session = session.Where("create_at > >", startAt).And("create_at < ?", endAt) +func (f FinWithdrawApplyDb) FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) { + var m *[]model.FinWithdrawApply + session = session.Where("create_at > ?", startAt).And("create_at < ?", endAt) if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { //指定In查询 if err := session.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(m); err != nil { diff --git a/src/model/contribution_value_basic_setting.go b/src/model/contribution_value_basic_setting.go new file mode 100644 index 0000000..0c874c2 --- /dev/null +++ b/src/model/contribution_value_basic_setting.go @@ -0,0 +1,9 @@ +package model + +type ContributionValueBasicSetting struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + PostingDynamicLiked int `json:"posting_dynamic_liked" xorm:"not null comment('发布动态被官方点赞') INT(11)"` + PostingCommentLiked int `json:"posting_comment_liked" xorm:"not null comment('发布评论被官方点赞') INT(11)"` + HandOutRedPackage int `json:"hand_out_red_package" xorm:"not null comment('发红包') INT(11)"` + PublishCreation int `json:"publish_creation" xorm:"not null comment('发布创作') INT(11)"` +} diff --git a/src/model/fin_withdraw_apply.go b/src/model/fin_withdraw_apply.go index b6647b9..6440004 100644 --- a/src/model/fin_withdraw_apply.go +++ b/src/model/fin_withdraw_apply.go @@ -12,6 +12,7 @@ type FinWithdrawApply struct { PaymentDate string `json:"payment_date" xorm:"not null comment('到账时间') DATETIME"` State int `json:"state" xorm:"not null default 0 comment('0申请中,1通过,2完成,3失败,4处理中(队列)') TINYINT(1)"` WithdrawKind int `json:"withdraw_kind" xorm:"not null default 1 comment('提现方式(1:支付宝 2:微信)') TINYINT(1)"` + IsFirst int `json:"is_first" xorm:"not null default 0 comment('是否首次提现(0:否 1:是)') TINYINT(1)"` Memo string `json:"memo" xorm:"not null default '' comment('备注,失败请备注原因') VARCHAR(500)"` UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('处理时间') TIMESTAMP"` CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('申请时间') index TIMESTAMP"`