From 964b9a42a9221a78ad9f1af09d823c655625de7f Mon Sep 17 00:00:00 2001 From: duyu Date: Thu, 18 Jul 2024 15:40:32 +0800 Subject: [PATCH] fix --- app/models/merchant/merchant.go | 2 +- app/models/orders/orders.go | 2 +- app/models/product/product.go | 4 +++- app/models/whitelist/whitelist.go | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/merchant/merchant.go b/app/models/merchant/merchant.go index 4ab1a40..7919627 100644 --- a/app/models/merchant/merchant.go +++ b/app/models/merchant/merchant.go @@ -78,7 +78,7 @@ func (m *merchantModel) Search(id int64, name string, startTime string, endTime sql += " and created_at >= ? and created_at <= ?" args = append(args, startTime, endTime) } - err = m.GetDb().Where(sql, args...).OrderBy("created_at").Desc().Limit(limit, page).Find(&merchant) + err = m.GetDb().Where(sql, args...).OrderBy("created_at desc").Limit(limit, page).Find(&merchant) return } diff --git a/app/models/orders/orders.go b/app/models/orders/orders.go index 1327f03..82f5aca 100644 --- a/app/models/orders/orders.go +++ b/app/models/orders/orders.go @@ -145,7 +145,7 @@ func (m *ordersModel) Search( sql += " and created_at >= ? and created_at <= ?" args = append(args, startTime, endTime) } - err = m.GetDb().Where(sql, args...).OrderBy("created_at").Desc().Limit(limit, page).Find(&orders) + err = m.GetDb().Where(sql, args...).OrderBy("created_at desc").Limit(limit, page).Find(&orders) return } diff --git a/app/models/product/product.go b/app/models/product/product.go index bc0de6e..07f319e 100644 --- a/app/models/product/product.go +++ b/app/models/product/product.go @@ -1,6 +1,7 @@ package product import ( + "fmt" "sync" "time" @@ -80,7 +81,8 @@ func (m *productModel) Search(id int64, name string, startTime string, endTime s sql += " and created_at >= ? and created_at <= ?" args = append(args, startTime, endTime) } - err = m.GetDb().Where(sql, args...).OrderBy("created_at").Desc().Limit(limit, page).Find(&product) + err = m.GetDb().Where(sql, args...).OrderBy("created_at desc").Limit(limit, page).Find(&product) + fmt.Println(err) return } diff --git a/app/models/whitelist/whitelist.go b/app/models/whitelist/whitelist.go index c4724bf..f7ed567 100644 --- a/app/models/whitelist/whitelist.go +++ b/app/models/whitelist/whitelist.go @@ -91,7 +91,7 @@ func (m *whitelistModel) Search(id int64, merchant_id int64, ip string, startTim sql += " and created_at >= ? and created_at <= ?" args = append(args, startTime, endTime) } - err = m.GetDb().Where(sql, args...).OrderBy("created_at").Desc().Limit(limit, page).Find(&whitelist) + err = m.GetDb().Where(sql, args...).OrderBy("created_at desc").Limit(limit, page).Find(&whitelist) return }