diff --git a/app/db/db_order.go b/app/db/db_order.go index a71a591..dc732fa 100644 --- a/app/db/db_order.go +++ b/app/db/db_order.go @@ -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{}) } diff --git a/consume/zhios_order_free.go b/consume/zhios_order_free.go index daa8364..e94454a 100644 --- a/consume/zhios_order_free.go +++ b/consume/zhios_order_free.go @@ -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 {