Bladeren bron

test

tags/v1.1.1
huangjiajun 1 jaar geleden
bovenliggende
commit
1de637ef60
5 gewijzigde bestanden met toevoegingen van 53 en 0 verwijderingen
  1. +1
    -0
      db/db_day_luck_draw_order_jackpot.go
  2. +17
    -0
      db/db_day_luck_draw_setting.go
  3. +23
    -0
      db/db_day_luck_draw_settle_order.go
  4. +1
    -0
      svc/svc_day_luck_draw_order_jackpot.go
  5. +11
    -0
      svc/svc_day_luck_draw_settle_order.go

+ 1
- 0
db/db_day_luck_draw_order_jackpot.go Bestand weergeven

@@ -30,6 +30,7 @@ func AddOrderJackpot(eg *xorm.Engine, req md.DayLuckDrawOrderJackpotReq) error {
return nil
}


func GetAllOrderOid(sess *xorm.Session) []string {
sql := `SELECT oid,uid FROM day_luck_draw_order_jackpot where period=0;`
data, _ := QueryNativeStringSess(sess, sql)


+ 17
- 0
db/db_day_luck_draw_setting.go Bestand weergeven

@@ -38,6 +38,23 @@ func CheckSetting(eg *xorm.Engine, pvd string) bool {
}
return true
}
func CheckSettingSess(sess *xorm.Session, pvd string) bool {
setting := GetDayLuckDrawSettingSess(sess)
if setting == nil {
return false
}
now := time.Now().Unix()
if setting.IsUse == 0 || setting.StartTime.IsZero() || setting.EndTime.IsZero() {
return false
}
if now < setting.StartTime.Unix() || now > setting.EndTime.Unix() {
return false
}
if setting.OrderSoruce == "mall" && pvd != "" && zhios_day_luck_draw_utils.InArr(pvd, []string{"mall_goods", "mall_group_buy", "mall_goods_user_lv", "super_group_buy", "mall_supply", "mall_group_own_buy"}) == false {
return false
}
return true
}
func GetDayLuckDrawSettingSess(sess *xorm.Session) *model.DayLuckDrawSetting {
var data model.DayLuckDrawSetting
get, err := sess.Get(&data)


+ 23
- 0
db/db_day_luck_draw_settle_order.go Bestand weergeven

@@ -36,3 +36,26 @@ func AddSettle(eg *xorm.Engine, req md.DayLuckDrawOrderJackpotReq) error {
}
return nil
}

func AddSettleSess(sess *xorm.Session, req md.DayLuckDrawOrderJackpotReq) error {
count, _ := sess.Where("oid=? and uid=? and pvd=?", req.Oid, req.Uid, req.Pvd).Count(&model.DayLuckDrawSettleOrder{})
if count > 0 {
return nil
}
var data = &model.DayLuckDrawSettleOrder{
Oid: req.Oid,
Pvd: req.Pvd,
Amount: req.Amount,
Commission: req.Commission,
Uid: zhios_day_luck_draw_utils.StrToInt(req.Uid),
CreateTime: time.Now(),
}
one, err := sess.Insert(data)
if one == 0 {
return errors.New("失败")
}
if err != nil {
return err
}
return nil
}

+ 1
- 0
svc/svc_day_luck_draw_order_jackpot.go Bestand weergeven

@@ -17,3 +17,4 @@ func AddOrderJackpot(eg *xorm.Engine, req md.DayLuckDrawOrderJackpotReq) error {
}
return nil
}


+ 11
- 0
svc/svc_day_luck_draw_settle_order.go Bestand weergeven

@@ -17,3 +17,14 @@ func AddSettleOrder(eg *xorm.Engine, req md.DayLuckDrawOrderJackpotReq) error {
}
return nil
}
func AddSettleOrderSess(sess *xorm.Session, req md.DayLuckDrawOrderJackpotReq) error {
setting := db.CheckSettingSess(sess, req.Pvd)
if setting == false {
return nil
}
err := db.AddSettleSess(sess, req)
if err != nil {
return err
}
return nil
}

Laden…
Annuleren
Opslaan