From b20394da346be8c86f29ad31dd88fd16c2eaa672 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 18 Sep 2024 16:24:42 +0800 Subject: [PATCH] 1 --- app/db/db_coupon.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/db/db_coupon.go b/app/db/db_coupon.go index 7d7da59..977ed58 100644 --- a/app/db/db_coupon.go +++ b/app/db/db_coupon.go @@ -3,6 +3,7 @@ package db import ( "applet/app/db/model" "applet/app/utils" + "time" "xorm.io/xorm" ) @@ -10,7 +11,7 @@ func GetCoupon(eg *xorm.Engine, req map[string]string) *[]model.CommunityTeamCou var data []model.CommunityTeamCoupon limit := 10 start := (utils.StrToInt(req["p"]) - 1) * limit - sess := eg.Where("uid=0 and num>0 and is_use=1").OrderBy("sort desc,id desc").Limit(limit, start) + sess := eg.Where("store_type=0 and num>0 and state=1 and ((valid_time_end>? and valid_time_type=1) or valid_time_type=2)", time.Now().Format("2006-01-02 15:04:05")).OrderBy("sort desc,id desc").Limit(limit, start) if req["name"] != "" { sess.And("name like ?", "%"+req["name"]+"%") }