订单优化调整
This commit is contained in:
parent
788822db37
commit
f9380df215
|
@ -1290,7 +1290,7 @@ func (d *defaultOrder) List(ctx context.Context, in *ListReq) (res *ListRes, err
|
|||
}
|
||||
var orderDetailList []gmodel.OrderDetail
|
||||
if count > 0 {
|
||||
m := model.Scopes(handlers.Paginate(&in.CurrentPage, &in.PerPage)).Order("id desc")
|
||||
m := model.Scopes(handlers.Paginate(&in.CurrentPage, &in.PerPage)).Order("ctime desc,id desc")
|
||||
result := m.Find(&orderList)
|
||||
if result.Error != nil {
|
||||
logc.Errorf(ctx, "order list failed, err: %v", err)
|
||||
|
@ -1310,10 +1310,7 @@ func (d *defaultOrder) List(ctx context.Context, in *ListReq) (res *ListRes, err
|
|||
|
||||
var pageCount int64 = 1
|
||||
if count > in.PerPage {
|
||||
var float64Count = float64(count)
|
||||
var float64PerPage = float64(in.PerPage)
|
||||
pageCountFloat := math.Ceil(float64Count / float64PerPage)
|
||||
pageCount = int64(pageCountFloat)
|
||||
pageCount = int64(math.Ceil(float64(count) / float64(in.PerPage)))
|
||||
}
|
||||
|
||||
return &ListRes{
|
||||
|
|
Loading…
Reference in New Issue
Block a user