From c20294d59eed1acb951446ef9f8e50a7aa2d111f Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 12 Dec 2022 11:40:53 +0800 Subject: [PATCH] test --- db/db_day_luck_draw_settle_order.go | 2 ++ db/model/day_luck_draw_settle_order.go | 1 + svc/svc_day_luck_draw_settle_order.go | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/db/db_day_luck_draw_settle_order.go b/db/db_day_luck_draw_settle_order.go index e5df648..916b659 100644 --- a/db/db_day_luck_draw_settle_order.go +++ b/db/db_day_luck_draw_settle_order.go @@ -29,6 +29,7 @@ func AddSettle(eg *xorm.Engine, req md.DayLuckDrawOrderJackpotReq) error { Commission: req.Commission, Uid: zhios_day_luck_draw_utils.StrToInt(req.Uid), CreateTime: time.Now(), + Bili: req.Bili, } one, err := eg.InsertOne(data) if one == 0 { @@ -52,6 +53,7 @@ func AddSettleSess(sess *xorm.Session, req md.DayLuckDrawOrderJackpotReq) error Commission: req.Commission, Uid: zhios_day_luck_draw_utils.StrToInt(req.Uid), CreateTime: time.Now(), + Bili: req.Bili, } one, err := sess.Insert(data) if one == 0 { diff --git a/db/model/day_luck_draw_settle_order.go b/db/model/day_luck_draw_settle_order.go index 229144d..590e87f 100644 --- a/db/model/day_luck_draw_settle_order.go +++ b/db/model/day_luck_draw_settle_order.go @@ -10,6 +10,7 @@ type DayLuckDrawSettleOrder struct { Pvd string `json:"pvd" xorm:"unique(oid_pvd) index VARCHAR(255)"` Amount string `json:"amount" xorm:"DECIMAL(11,6)"` Commission string `json:"commission" xorm:"DECIMAL(11,6)"` + Bili string `json:"commission" xorm:"DECIMAL(11,6)"` Uid int `json:"uid" xorm:"index INT(11)"` CreateTime time.Time `json:"create_time" xorm:"DATETIME"` IsSend int `json:"is_send" xorm:"default 0 INT(11)"` diff --git a/svc/svc_day_luck_draw_settle_order.go b/svc/svc_day_luck_draw_settle_order.go index 1426139..f0c9440 100644 --- a/svc/svc_day_luck_draw_settle_order.go +++ b/svc/svc_day_luck_draw_settle_order.go @@ -13,6 +13,9 @@ func AddSettleOrder(eg *xorm.Engine, req md.DayLuckDrawOrderJackpotReq) error { return nil } drawSetting := db.GetDayLuckDrawSetting(eg) + if drawSetting.Source == "amount" { + return nil + } req.Bili = drawSetting.CommissionBili req.Commission = zhios_day_luck_draw_utils.Float64ToStrByPrec(zhios_day_luck_draw_utils.StrToFloat64(req.Commission)*(zhios_day_luck_draw_utils.StrToFloat64(req.Bili)/100), 7) err := db.AddSettle(eg, req) @@ -27,6 +30,9 @@ func AddSettleOrderSess(sess *xorm.Session, req md.DayLuckDrawOrderJackpotReq) e return nil } drawSetting := db.GetDayLuckDrawSettingSess(sess) + if drawSetting.Source == "amount" { + return nil + } req.Bili = drawSetting.CommissionBili req.Commission = zhios_day_luck_draw_utils.Float64ToStrByPrec(zhios_day_luck_draw_utils.StrToFloat64(req.Commission)*(zhios_day_luck_draw_utils.StrToFloat64(req.Bili)/100), 7) err := db.AddSettleSess(sess, req)