修改
This commit is contained in:
parent
9f73670aa8
commit
5b4ead9979
@ -1,6 +1,7 @@
|
|||||||
package dao
|
package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/jinzhu/copier"
|
||||||
"micro-bundle/internal/model"
|
"micro-bundle/internal/model"
|
||||||
"micro-bundle/pb/bundle"
|
"micro-bundle/pb/bundle"
|
||||||
@ -59,12 +60,16 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse,
|
|||||||
|
|
||||||
count := *query
|
count := *query
|
||||||
|
|
||||||
if err = query.Find(&bundles).Error; err != nil {
|
if err = query.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize)).Find(&bundles).Error; err != nil {
|
||||||
return res, commonErr.ReturnError(err, msg.ErrorGetBundleList, "获取套餐列表失败: ")
|
return res, commonErr.ReturnError(err, msg.ErrorGetBundleList, "获取套餐列表失败: ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("bundles %+v\n", bundles)
|
||||||
|
|
||||||
_ = copier.CopyWithOption(&res.Bundles, bundles, copier.Option{DeepCopy: true})
|
_ = copier.CopyWithOption(&res.Bundles, bundles, copier.Option{DeepCopy: true})
|
||||||
|
|
||||||
|
fmt.Printf("res.Bundles %+v\n", res.Bundles)
|
||||||
|
|
||||||
var total int64
|
var total int64
|
||||||
|
|
||||||
count.Count(&total)
|
count.Count(&total)
|
||||||
|
Loading…
Reference in New Issue
Block a user