huangjiajun 2 months ago
parent
commit
b20394da34
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      app/db/db_coupon.go

+ 2
- 1
app/db/db_coupon.go View File

@@ -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"]+"%")
}


Loading…
Cancel
Save