From d6d9a27c758b887dc1e48af0147705b93454e208 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 28 Dec 2023 08:57:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/db/db_order.go | 7 ++++--- consume/zhios_order_free.go | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) 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 {