@@ -29,6 +29,7 @@ func AddSettle(eg *xorm.Engine, req md.DayLuckDrawOrderJackpotReq) error { | |||||
Commission: req.Commission, | Commission: req.Commission, | ||||
Uid: zhios_day_luck_draw_utils.StrToInt(req.Uid), | Uid: zhios_day_luck_draw_utils.StrToInt(req.Uid), | ||||
CreateTime: time.Now(), | CreateTime: time.Now(), | ||||
Bili: req.Bili, | |||||
} | } | ||||
one, err := eg.InsertOne(data) | one, err := eg.InsertOne(data) | ||||
if one == 0 { | if one == 0 { | ||||
@@ -52,6 +53,7 @@ func AddSettleSess(sess *xorm.Session, req md.DayLuckDrawOrderJackpotReq) error | |||||
Commission: req.Commission, | Commission: req.Commission, | ||||
Uid: zhios_day_luck_draw_utils.StrToInt(req.Uid), | Uid: zhios_day_luck_draw_utils.StrToInt(req.Uid), | ||||
CreateTime: time.Now(), | CreateTime: time.Now(), | ||||
Bili: req.Bili, | |||||
} | } | ||||
one, err := sess.Insert(data) | one, err := sess.Insert(data) | ||||
if one == 0 { | if one == 0 { | ||||
@@ -10,6 +10,7 @@ type DayLuckDrawSettleOrder struct { | |||||
Pvd string `json:"pvd" xorm:"unique(oid_pvd) index VARCHAR(255)"` | Pvd string `json:"pvd" xorm:"unique(oid_pvd) index VARCHAR(255)"` | ||||
Amount string `json:"amount" xorm:"DECIMAL(11,6)"` | Amount string `json:"amount" xorm:"DECIMAL(11,6)"` | ||||
Commission string `json:"commission" 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)"` | Uid int `json:"uid" xorm:"index INT(11)"` | ||||
CreateTime time.Time `json:"create_time" xorm:"DATETIME"` | CreateTime time.Time `json:"create_time" xorm:"DATETIME"` | ||||
IsSend int `json:"is_send" xorm:"default 0 INT(11)"` | IsSend int `json:"is_send" xorm:"default 0 INT(11)"` | ||||
@@ -13,6 +13,9 @@ func AddSettleOrder(eg *xorm.Engine, req md.DayLuckDrawOrderJackpotReq) error { | |||||
return nil | return nil | ||||
} | } | ||||
drawSetting := db.GetDayLuckDrawSetting(eg) | drawSetting := db.GetDayLuckDrawSetting(eg) | ||||
if drawSetting.Source == "amount" { | |||||
return nil | |||||
} | |||||
req.Bili = drawSetting.CommissionBili | 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) | 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) | err := db.AddSettle(eg, req) | ||||
@@ -27,6 +30,9 @@ func AddSettleOrderSess(sess *xorm.Session, req md.DayLuckDrawOrderJackpotReq) e | |||||
return nil | return nil | ||||
} | } | ||||
drawSetting := db.GetDayLuckDrawSettingSess(sess) | drawSetting := db.GetDayLuckDrawSettingSess(sess) | ||||
if drawSetting.Source == "amount" { | |||||
return nil | |||||
} | |||||
req.Bili = drawSetting.CommissionBili | 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) | 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) | err := db.AddSettleSess(sess, req) | ||||