From 15d0fb9f373e66cd161cb9b1a2b8223363ad8b67 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 26 Nov 2024 17:15:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=BF=E5=91=8A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/advertising_space_dao.go | 1 + src/implement/advertising_space_implement.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/dao/advertising_space_dao.go b/src/dao/advertising_space_dao.go index ebf7d69..03e2dce 100644 --- a/src/dao/advertising_space_dao.go +++ b/src/dao/advertising_space_dao.go @@ -5,4 +5,5 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" type AdvertisingSpaceDao interface { AdvertisingSpaceAll() (*[]model.AdvertisingSpace, error) GetAdvertisingSpace(id string) (m *model.AdvertisingSpace, err error) + FindUserFeedbackCateAndTotal(page, limit string) (*[]model.AdvertisingSpace, int64, error) } diff --git a/src/implement/advertising_space_implement.go b/src/implement/advertising_space_implement.go index b7a07c3..93705d9 100644 --- a/src/implement/advertising_space_implement.go +++ b/src/implement/advertising_space_implement.go @@ -3,6 +3,7 @@ package implement import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" "xorm.io/xorm" ) @@ -33,3 +34,13 @@ func (a AdvertisingSpaceDb) GetAdvertisingSpace(id string) (m *model.Advertising } return m, nil } +func (a AdvertisingSpaceDb) FindUserFeedbackCateAndTotal(page, limit string) (*[]model.AdvertisingSpace, int64, error) { + var m []model.AdvertisingSpace + sess := a.Db.Where("1=1") + start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) + count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id desc").FindAndCount(&m) + if err != nil { + return nil, count, zhios_order_relate_logx.Error(err) + } + return &m, count, nil +}