Browse Source

test

master
huangjiajun 1 year ago
parent
commit
486f4ba013
8 changed files with 30 additions and 0 deletions
  1. +8
    -0
      app/db/db_master.go
  2. +1
    -0
      app/db/model/master.go
  3. +1
    -0
      app/db/model/master_amount_flow.go
  4. +1
    -0
      app/db/model/master_last_month_amount_flow.go
  5. +1
    -0
      app/db/model/master_withdrawal_flow.go
  6. +9
    -0
      app/svc/platform/svc_withdrawal.go
  7. +8
    -0
      app/task/svc/svc_master_month_settle.go
  8. +1
    -0
      app/task/svc/svc_playlet_order_settle.go

+ 8
- 0
app/db/db_master.go View File

@@ -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)


+ 1
- 0
app/db/model/master.go View File

@@ -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)"`
}

+ 1
- 0
app/db/model/master_amount_flow.go View File

@@ -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)"`
}

+ 1
- 0
app/db/model/master_last_month_amount_flow.go View File

@@ -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)"`
}

+ 1
- 0
app/db/model/master_withdrawal_flow.go View File

@@ -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)"`
}

+ 9
- 0
app/svc/platform/svc_withdrawal.go View File

@@ -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 {


+ 8
- 0
app/task/svc/svc_master_month_settle.go View File

@@ -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()


+ 1
- 0
app/task/svc/svc_playlet_order_settle.go View File

@@ -81,6 +81,7 @@ func PlayletOrderSettle() {
Oid: v.Oid,
Title: "短剧订单结算",
FlowType: "playlet_settle",
ExtendUid: master.ExtendUid,
}
masterLastMonthAmountFlowDb := db.MasterLastMonthAmountFlowDb{}
masterLastMonthAmountFlowDb.Set()


Loading…
Cancel
Save