diff --git a/service/repositories/order.go b/service/repositories/order.go index c9c9e97a..31b935aa 100644 --- a/service/repositories/order.go +++ b/service/repositories/order.go @@ -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{