From a7a27a605b85cef5b498076e8419769974f602c8 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 28 Nov 2024 22:23:21 +0800 Subject: [PATCH] update --- src/dao/alipay_user_info_dao.go | 6 ++- src/dao/fin_withdraw_apply_dao.go | 2 +- src/dao/wx_user_info_dao.go | 11 +++++ src/implement/alipay_user_info_implement.go | 30 +++++++++++++ src/implement/fin_withdraw_apply_implement.go | 8 ++++ src/implement/wx_user_info_implement.go | 44 +++++++++++++++++++ src/model/fin_withdraw_apply.go | 4 +- src/model/wx_user_info.go | 12 +++++ 8 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 src/dao/wx_user_info_dao.go create mode 100644 src/implement/wx_user_info_implement.go create mode 100644 src/model/wx_user_info.go diff --git a/src/dao/alipay_user_info_dao.go b/src/dao/alipay_user_info_dao.go index e8eb227..c67551a 100644 --- a/src/dao/alipay_user_info_dao.go +++ b/src/dao/alipay_user_info_dao.go @@ -1,5 +1,9 @@ package dao +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + type AlipayUserInfoDao interface { - //TODO:: You can add specific method definitions here + GetAlipayUserInfo(uid int64) (m *model.AlipayUserInfo, err error) + UpdateAlipayUserInfo(m *model.AlipayUserInfo, columns ...string) (int64, error) + AlipayUserInfoInsert(m *model.AlipayUserInfo) (int, error) } diff --git a/src/dao/fin_withdraw_apply_dao.go b/src/dao/fin_withdraw_apply_dao.go index 7e1f6e6..fa643e5 100644 --- a/src/dao/fin_withdraw_apply_dao.go +++ b/src/dao/fin_withdraw_apply_dao.go @@ -6,6 +6,6 @@ import ( ) type FinWithdrawApplyDao interface { - //TODO:: You can add specific method definitions here FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) + FinWithdrawApplyInsertOneBySession(session *xorm.Session, m *model.FinWithdrawApply) (int64, error) } diff --git a/src/dao/wx_user_info_dao.go b/src/dao/wx_user_info_dao.go new file mode 100644 index 0000000..5fefd73 --- /dev/null +++ b/src/dao/wx_user_info_dao.go @@ -0,0 +1,11 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" +) + +type WxUserInfoDao interface { + GetWxUserInfo(uid int64) (m *model.WxUserInfo, err error) + UpdateWxUserInfo(m *model.WxUserInfo, columns ...string) (int64, error) + WxUserInfoInsert(m *model.WxUserInfo) (int, error) +} diff --git a/src/implement/alipay_user_info_implement.go b/src/implement/alipay_user_info_implement.go index c301179..0c0f7b9 100644 --- a/src/implement/alipay_user_info_implement.go +++ b/src/implement/alipay_user_info_implement.go @@ -2,6 +2,8 @@ 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" ) @@ -12,3 +14,31 @@ func NewAlipayUserInfoDb(engine *xorm.Engine) dao.AlipayUserInfoDao { type AlipayUserInfoDb struct { Db *xorm.Engine } + +func (a AlipayUserInfoDb) GetAlipayUserInfo(uid int64) (m *model.AlipayUserInfo, err error) { + m = new(model.AlipayUserInfo) + has, err := a.Db.Where("uid = ?", uid).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (a AlipayUserInfoDb) UpdateAlipayUserInfo(m *model.AlipayUserInfo, columns ...string) (int64, error) { + affected, err := a.Db.Where("id =?", m.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} + +func (a AlipayUserInfoDb) AlipayUserInfoInsert(m *model.AlipayUserInfo) (int, error) { + _, err := a.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} diff --git a/src/implement/fin_withdraw_apply_implement.go b/src/implement/fin_withdraw_apply_implement.go index c755067..b6830d9 100644 --- a/src/implement/fin_withdraw_apply_implement.go +++ b/src/implement/fin_withdraw_apply_implement.go @@ -18,6 +18,14 @@ type FinWithdrawApplyDb struct { Db *xorm.Engine } +func (f FinWithdrawApplyDb) FinWithdrawApplyInsertOneBySession(session *xorm.Session, m *model.FinWithdrawApply) (int64, error) { + affected, err := session.InsertOne(m) + if err != nil { + return 0, err + } + return affected, nil +} + 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) diff --git a/src/implement/wx_user_info_implement.go b/src/implement/wx_user_info_implement.go new file mode 100644 index 0000000..b1570ae --- /dev/null +++ b/src/implement/wx_user_info_implement.go @@ -0,0 +1,44 @@ +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 NewWxUserInfoDb(engine *xorm.Engine) dao.WxUserInfoDao { + return &WxUserInfoDb{Db: engine} +} + +type WxUserInfoDb struct { + Db *xorm.Engine +} + +func (w WxUserInfoDb) GetWxUserInfo(uid int64) (m *model.WxUserInfo, err error) { + m = new(model.WxUserInfo) + has, err := w.Db.Where("uid = ?", uid).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (w WxUserInfoDb) UpdateWxUserInfo(m *model.WxUserInfo, columns ...string) (int64, error) { + affected, err := w.Db.Where("id =?", m.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} + +func (w WxUserInfoDb) WxUserInfoInsert(m *model.WxUserInfo) (int, error) { + _, err := w.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} diff --git a/src/model/fin_withdraw_apply.go b/src/model/fin_withdraw_apply.go index 6440004..87e3a52 100644 --- a/src/model/fin_withdraw_apply.go +++ b/src/model/fin_withdraw_apply.go @@ -2,9 +2,11 @@ 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)"` + Uid int64 `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)"` + RealAmount string `json:"real_amount" xorm:"not null default 0.00 comment('实际到账金额') DECIMAL(10,2)"` + Fee string `json:"fee" 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)"` diff --git a/src/model/wx_user_info.go b/src/model/wx_user_info.go new file mode 100644 index 0000000..ce597ad --- /dev/null +++ b/src/model/wx_user_info.go @@ -0,0 +1,12 @@ +package model + +type WxUserInfo struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int64 `json:"uid" xorm:"not null comment('用户id') BIGINT(20)"` + UserId string `json:"user_id" xorm:"not null default '' comment('微信用户id') CHAR(100)"` + OpenId string `json:"open_id" xorm:"not null default '' comment('微信用户open_id') CHAR(100)"` + AppId string `json:"app_id" xorm:"not null default '' comment('微信应用appid') CHAR(50)"` + Ext string `json:"ext" xorm:"not null comment('拓展字段') TEXT"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +}