From a1c001a7936dc9115b959e5a777493d67390891d Mon Sep 17 00:00:00 2001 From: howell <2827207845@qq.com> Date: Fri, 18 Feb 2022 10:58:57 +0800 Subject: [PATCH] fix:invitation_no --- internal/api/mobile/users/register.go | 2 ++ internal/api/mobile/wallet/withdraw.go | 20 +++++++++++--------- internal/model/user/user_withdraw.go | 11 +++++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/internal/api/mobile/users/register.go b/internal/api/mobile/users/register.go index 7dc21a0..a048118 100755 --- a/internal/api/mobile/users/register.go +++ b/internal/api/mobile/users/register.go @@ -437,6 +437,8 @@ func MobileRegisterH5(c *gin.Context) { var login user.Login var info user.Information + info.InvitationNo = p.InvitationNo + // 开始添加用户 if err = registerUser.UserAdd(c, &login, &info, p.Mobile); err != nil { back.Fail(c, "add error:"+err.Error()) diff --git a/internal/api/mobile/wallet/withdraw.go b/internal/api/mobile/wallet/withdraw.go index 6debb41..4cd6e51 100644 --- a/internal/api/mobile/wallet/withdraw.go +++ b/internal/api/mobile/wallet/withdraw.go @@ -91,15 +91,17 @@ func SubmitWithdraw(c *gin.Context) { } tx := dbc.DB.Begin() err := tx.Create(&user.Withdraw{ - UserId: p.UserID, - UserName: userInfo.RealName, - Type: t, - Amount: p.Amount, - Alipay: p.Alipay, - BankAccount: p.BankAccount, - BankName: p.BankName, - AuditTime: formatime.NewSecondFrom(getNextTenOrTwentyFive()), - Status: user.UndoneWithdrawStatus, + UserId: p.UserID, + UserName: userInfo.RealName, + Type: t, + Amount: p.Amount, + Alipay: p.Alipay, + BankAccount: p.BankAccount, + BankName: p.BankName, + AuditTime: formatime.NewSecondFrom(getNextTenOrTwentyFive()), + Status: user.UndoneWithdrawStatus, + TaxFee: decimal.Zero, + ActualAmount: decimal.Zero, }).Error if err != nil { diff --git a/internal/model/user/user_withdraw.go b/internal/model/user/user_withdraw.go index fa5d4d7..2be9594 100644 --- a/internal/model/user/user_withdraw.go +++ b/internal/model/user/user_withdraw.go @@ -2,6 +2,7 @@ package user import ( "github.com/golangkit/formatime" + "github.com/shopspring/decimal" ) type Withdraw struct { @@ -18,10 +19,12 @@ type Withdraw struct { DoneTime formatime.Second `gorm:"column:done_time" json:"doneTime"` CreatedAt formatime.Second `gorm:"column:created_at" json:"created_at" form:"createdAt"` WaitStatus int64 - UserTrueName string `gorm:"-" json:"user_true_name"` - UserTrueNo string `gorm:"-" json:"user_true_no"` - UserPhone string `gorm:"-" json:"user_phone"` - FailReason string `gorm:"fail_reason" json:"failReason"` + UserTrueName string `gorm:"-" json:"user_true_name"` + UserTrueNo string `gorm:"-" json:"user_true_no"` + UserPhone string `gorm:"-" json:"user_phone"` + FailReason string `gorm:"fail_reason" json:"failReason"` + TaxFee decimal.Decimal `json:"tax_fee"` + ActualAmount decimal.Decimal `json:"actual_amount"` } const (