diff --git a/app/db/db_master.go b/app/db/db_master.go index 9cf3a45..0d94e1a 100644 --- a/app/db/db_master.go +++ b/app/db/db_master.go @@ -23,6 +23,14 @@ func (masterDb *MasterDb) GetMaster(mid string) *model.Master { } return &data } +func (masterDb *MasterDb) GetMasterId(id int) *model.Master { + var data model.Master + get, err := masterDb.Db.Where("id=?", id).Get(&data) + if get == false || err != nil { + return nil + } + return &data +} func (masterDb *MasterDb) MasterUpdate(data *model.Master) bool { get, err := masterDb.Db.Where("id=?", data.Id).Update(data) diff --git a/app/db/model/master.go b/app/db/model/master.go index be56c3c..e27acfb 100644 --- a/app/db/model/master.go +++ b/app/db/model/master.go @@ -17,4 +17,5 @@ type Master struct { UpdateTime time.Time `json:"update_time" xorm:"DATETIME"` Alipay string `json:"alipay" xorm:"VARCHAR(255)"` AlipayName string `json:"alipay_name" xorm:"VARCHAR(255)"` + ExtendUid string `json:"extend_uid" xorm:"VARCHAR(255)"` } diff --git a/app/db/model/master_amount_flow.go b/app/db/model/master_amount_flow.go index 6718257..5f31417 100644 --- a/app/db/model/master_amount_flow.go +++ b/app/db/model/master_amount_flow.go @@ -16,4 +16,5 @@ type MasterAmountFlow struct { Title string `json:"title" xorm:"VARCHAR(255)"` FlowType string `json:"flow_type" xorm:"VARCHAR(255)"` IncomeType int `json:"income_type" xorm:"default 0 INT(1)"` + ExtendUid string `json:"extend_uid" xorm:"VARCHAR(255)"` } diff --git a/app/db/model/master_last_month_amount_flow.go b/app/db/model/master_last_month_amount_flow.go index a4becbc..1da24d8 100644 --- a/app/db/model/master_last_month_amount_flow.go +++ b/app/db/model/master_last_month_amount_flow.go @@ -16,4 +16,5 @@ type MasterLastMonthAmountFlow struct { Title string `json:"title" xorm:"VARCHAR(255)"` FlowType string `json:"flow_type" xorm:"VARCHAR(255)"` IncomeType int `json:"income_type" xorm:"default 0 INT(1)"` + ExtendUid string `json:"extend_uid" xorm:"VARCHAR(255)"` } diff --git a/app/db/model/master_withdrawal_flow.go b/app/db/model/master_withdrawal_flow.go index 1ec5aab..d44a9b4 100644 --- a/app/db/model/master_withdrawal_flow.go +++ b/app/db/model/master_withdrawal_flow.go @@ -21,4 +21,5 @@ type MasterWithdrawalFlow struct { RealAmount string `json:"real_amount" xorm:"default 0.00 DECIMAL(20,2)"` HasInvoice int `json:"has_invoice" xorm:"default 0 comment('是否有发票') INT(1)"` InvoiceBili string `json:"invoice_bili" xorm:"comment('发票比例') VARCHAR(255)"` + ExtendUid string `json:"extend_uid" xorm:"VARCHAR(255)"` } diff --git a/app/svc/platform/svc_withdrawal.go b/app/svc/platform/svc_withdrawal.go index a20cd8e..20143a1 100644 --- a/app/svc/platform/svc_withdrawal.go +++ b/app/svc/platform/svc_withdrawal.go @@ -97,6 +97,13 @@ func WithdrawalDoing(c *gin.Context) { e.OutErr(c, 400, e.NewErr(400, "金额不正确")) return } + masterdb := db.MasterDb{} + masterdb.Set() + master := masterdb.GetMaster(mid) + if master == nil { + e.OutErr(c, 400, e.NewErr(400, "用户不存在")) + return + } amountMap := masterAmount(mid, args["type"]) leaveAmount := utils.StrToFloat64(amountMap["amount"]) - utils.StrToFloat64(args["amount"]) if leaveAmount < 0 { @@ -181,6 +188,7 @@ func WithdrawalDoing(c *gin.Context) { Oid: "", Title: "提现", FlowType: "withdrawal", + ExtendUid: master.ExtendUid, } flowInsert := db.MasterAmountFlowInsertWithSess(sess, &tmpFlow) if flowInsert == false { @@ -201,6 +209,7 @@ func WithdrawalDoing(c *gin.Context) { Status: "提现审核", HasInvoice: utils.StrToInt(args["has_invoice"]), InvoiceBili: args["invoice_bili"], + ExtendUid: master.ExtendUid, } insert := db.MasterWithdrawalFlowInsertWithSess(sess, &tmp) if insert == false { diff --git a/app/task/svc/svc_master_month_settle.go b/app/task/svc/svc_master_month_settle.go index 0279a2c..3c9d0d2 100644 --- a/app/task/svc/svc_master_month_settle.go +++ b/app/task/svc/svc_master_month_settle.go @@ -39,6 +39,12 @@ func MasterMonthSettle() { if utils.StrToFloat64(v.LastMonthAmount) <= 0 { continue } + masterDb := db.MasterDb{} + masterDb.Set() + master := masterDb.GetMasterId(v.Id) + if master == nil { + continue + } oldAmount := v.Amount oldLastMonthAmount := v.LastMonthAmount v.Amount = utils.Float64ToStr(utils.StrToFloat64(v.Amount) + utils.StrToFloat64(v.LastMonthAmount)) @@ -58,6 +64,7 @@ func MasterMonthSettle() { Title: "短剧上月结算佣金到账", FlowType: "last_month_playlet_settle", IncomeType: 0, + ExtendUid: master.ExtendUid, } masterAmountFlowDb := db.MasterAmountFlowDb{} masterAmountFlowDb.Set() @@ -74,6 +81,7 @@ func MasterMonthSettle() { Title: "短剧上月结算佣金转到余额", FlowType: "last_month_playlet_settle", IncomeType: 1, + ExtendUid: master.ExtendUid, } masterLastMonthAmountFlowDb := db.MasterLastMonthAmountFlowDb{} masterLastMonthAmountFlowDb.Set() diff --git a/app/task/svc/svc_playlet_order_settle.go b/app/task/svc/svc_playlet_order_settle.go index 5b51b7d..2330dc5 100644 --- a/app/task/svc/svc_playlet_order_settle.go +++ b/app/task/svc/svc_playlet_order_settle.go @@ -81,6 +81,7 @@ func PlayletOrderSettle() { Oid: v.Oid, Title: "短剧订单结算", FlowType: "playlet_settle", + ExtendUid: master.ExtendUid, } masterLastMonthAmountFlowDb := db.MasterLastMonthAmountFlowDb{} masterLastMonthAmountFlowDb.Set()