Browse Source

更新

three
huangjiajun 1 year ago
parent
commit
d6d9a27c75
2 changed files with 7 additions and 3 deletions
  1. +4
    -3
      app/db/db_order.go
  2. +3
    -0
      consume/zhios_order_free.go

+ 4
- 3
app/db/db_order.go View File

@@ -6,7 +6,6 @@ import (
"applet/app/utils/logx"
"errors"
"fmt"
"time"
"xorm.io/xorm"
)

@@ -449,7 +448,8 @@ func OrderListCountByPvdByUidByTimeByValid(Db *xorm.Engine, provider, startTime,
func OrderListCountByPriceType(sess *xorm.Session, uid string, priceType, day int) (int64, error) {
sess = sess.Where(" uid = ? AND state != 4 AND price_type= ?", uid, priceType)
if day > 0 {
sess = sess.And("create_at>=?", time.Now().Unix()-int64(day*86400))
today := utils.GetTimeRange("today")
sess = sess.And("create_at>=?", today["end"]-int64(day*86400))
}
return sess.Count(&model.OrdList{})
}
@@ -458,7 +458,8 @@ func OrderListCountByPriceType(sess *xorm.Session, uid string, priceType, day in
func OrderListCountByItemId(sess *xorm.Session, uid string, itemId string, day int) (int64, error) {
sess = sess.Where(" uid = ? AND state != 4 AND item_id = ? and price_type>0", uid, itemId)
if day > 0 {
sess = sess.And("create_at>=?", time.Now().Unix()-int64(day*86400))
today := utils.GetTimeRange("today")
sess = sess.And("create_at>=?", today["end"]-int64(day*86400))
}
return sess.Count(&model.OrdList{})
}


+ 3
- 0
consume/zhios_order_free.go View File

@@ -288,6 +288,9 @@ func orderFreeCheck(eg *xorm.Engine, sess *xorm.Session, canalMsg *md.ZhiosOrder
if mt.NeedUseQuan == 1 {
// 更新剩余次数
isNeed := 1
if mt.NeedQuan == 0 {
isNeed = 0
}
if mt.NeedQuan > profile.FreeRemainTime {
auth, perm := svc2.CheckNewOrderAuth(eg, utils.StrToInt(canalMsg.Uid), mt)
if perm.AuthType == "all" || auth == false {


Loading…
Cancel
Save