From 27042dbc26dae6529f030356353021307cde81aa Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Mon, 25 Nov 2024 14:47:37 +0800 Subject: [PATCH] add withdraw --- src/dao/fin_withdraw_apply_dao.go | 6 +++ src/dao/fin_withdraw_setting_dao.go | 10 ++++ src/implement/fin_withdraw_apply_implement.go | 14 +++++ .../fin_withdraw_setting_implement.go | 52 +++++++++++++++++++ src/model/fin_withdraw_apply.go | 18 +++++++ src/model/fin_withdraw_setting.go | 18 +++++++ 6 files changed, 118 insertions(+) create mode 100644 src/dao/fin_withdraw_apply_dao.go create mode 100644 src/dao/fin_withdraw_setting_dao.go create mode 100644 src/implement/fin_withdraw_apply_implement.go create mode 100644 src/implement/fin_withdraw_setting_implement.go create mode 100644 src/model/fin_withdraw_apply.go create mode 100644 src/model/fin_withdraw_setting.go diff --git a/src/dao/fin_withdraw_apply_dao.go b/src/dao/fin_withdraw_apply_dao.go new file mode 100644 index 0000000..6498cac --- /dev/null +++ b/src/dao/fin_withdraw_apply_dao.go @@ -0,0 +1,6 @@ +package dao + +type FinWithdrawApplyDao interface { + //TODO:: You can add specific method definitions here + +} diff --git a/src/dao/fin_withdraw_setting_dao.go b/src/dao/fin_withdraw_setting_dao.go new file mode 100644 index 0000000..b92be80 --- /dev/null +++ b/src/dao/fin_withdraw_setting_dao.go @@ -0,0 +1,10 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type FinWithdrawSettingDao interface { + //TODO:: You can add specific method definitions here + FinWithdrawSettingGetOne() (*model.FinWithdrawSetting, error) + FinWithdrawSettingInsert(m *model.FinWithdrawSetting) (int64, error) + FinWithdrawSettingUpdate(id interface{}, finWithdrawSetting *model.FinWithdrawSetting, forceColumns ...string) (int64, error) +} diff --git a/src/implement/fin_withdraw_apply_implement.go b/src/implement/fin_withdraw_apply_implement.go new file mode 100644 index 0000000..d99bab6 --- /dev/null +++ b/src/implement/fin_withdraw_apply_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewFinWithdrawApplyDb(engine *xorm.Engine) dao.FinWithdrawApplyDao { + return &FinWithdrawApplyDb{Db: engine} +} + +type FinWithdrawApplyDb struct { + Db *xorm.Engine +} diff --git a/src/implement/fin_withdraw_setting_implement.go b/src/implement/fin_withdraw_setting_implement.go new file mode 100644 index 0000000..e7d77db --- /dev/null +++ b/src/implement/fin_withdraw_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 NewFinWithdrawSettingDb(engine *xorm.Engine) dao.FinWithdrawSettingDao { + return &FinWithdrawSettingDb{Db: engine} +} + +type FinWithdrawSettingDb struct { + Db *xorm.Engine +} + +func (f FinWithdrawSettingDb) FinWithdrawSettingGetOne() (*model.FinWithdrawSetting, error) { + var m model.FinWithdrawSetting + get, err := f.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 (f FinWithdrawSettingDb) FinWithdrawSettingInsert(m *model.FinWithdrawSetting) (int64, error) { + _, err := f.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (f FinWithdrawSettingDb) FinWithdrawSettingUpdate(id interface{}, finWithdrawSetting *model.FinWithdrawSetting, forceColumns ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColumns != nil { + affected, err = f.Db.Where("id=?", id).MustCols(forceColumns...).Update(finWithdrawSetting) + } else { + affected, err = f.Db.Where("id=?", id).Update(finWithdrawSetting) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/model/fin_withdraw_apply.go b/src/model/fin_withdraw_apply.go new file mode 100644 index 0000000..b6647b9 --- /dev/null +++ b/src/model/fin_withdraw_apply.go @@ -0,0 +1,18 @@ +package model + +type FinWithdrawApply struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Uid int `json:"uid" xorm:"not null default 0 comment('用户ID') index INT(10)"` + AdmId int `json:"adm_id" xorm:"not null default 0 comment('审核人ID,0为系统自动') INT(10)"` + Amount string `json:"amount" xorm:"not null default 0.00 comment('提现金额') DECIMAL(10,2)"` + Type int `json:"type" xorm:"not null default 1 comment('提现类型;1:手动;2:自动') TINYINT(1)"` + WithdrawAccount string `json:"withdraw_account" xorm:"not null default '' comment('提现账号') VARCHAR(64)"` + WithdrawName string `json:"withdraw_name" xorm:"not null default '' comment('提现人姓名') VARCHAR(12)"` + Reason int `json:"reason" xorm:"not null default 0 comment('审核失败(驳回理由);1:当前账号不满足提现规则;2:账号异常;3:资金异常') TINYINT(1)"` + 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)"` + 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"` +} diff --git a/src/model/fin_withdraw_setting.go b/src/model/fin_withdraw_setting.go new file mode 100644 index 0000000..75560b6 --- /dev/null +++ b/src/model/fin_withdraw_setting.go @@ -0,0 +1,18 @@ +package model + +type FinWithdrawSetting struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + FrequencySet string `json:"frequency_set" xorm:"not null comment('频率设置') TEXT"` + WithdrawType int `json:"withdraw_type" xorm:"not null default 1 comment('提现方式(1:支付宝 2:微信)') TINYINT(1)"` + VipLevelLimit int `json:"vip_level_limit" xorm:"not null default 0 comment('提现等级限制') INT(11)"` + IsRealName int `json:"is_real_name" xorm:"not null default 0 comment('是否实名(0:否 1:是)') TINYINT(1)"` + WithdrawNumsLimit int `json:"withdraw_nums_limit" xorm:"not null default 0 comment('提现次数限制(对应上方设置周期,0为不限制,失败、驳回不计数 )') TINYINT(3)"` + WithdrawAmountLimit string `json:"withdraw_amount_limit" xorm:"not null comment('提现金额限制(0为不限制,大于等于该金额才可以申请提现 )') DECIMAL(10,2)"` + WithdrawMultipleLimit string `json:"withdraw_multiple_limit" xorm:"not null comment('提现倍数限制(0为不限制,金额限制倍数才可以申请提现 )') DECIMAL(10,2)"` + IsSupportDecimalPoint int `json:"is_support_decimal_point" xorm:"not null default 0 comment('是否支持小数点(0:否 1:是)') TINYINT(1)"` + IsAuto int `json:"is_auto" xorm:"not null default 0 comment('是否开启自动提现(0:否 1:是)') TINYINT(1)"` + WithdrawTimeInterval string `json:"withdraw_time_interval" xorm:"not null default '' comment('提现时段') VARCHAR(255)"` + WithdrawFeeSet string `json:"withdraw_fee_set" xorm:"comment('提现手续费设置') TEXT"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('申请时间') TIMESTAMP"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('处理时间') TIMESTAMP"` +}