diff --git a/app/common/model/Goods.php b/app/common/model/Goods.php index 38ba52ea..9dc1b9b3 100644 --- a/app/common/model/Goods.php +++ b/app/common/model/Goods.php @@ -278,17 +278,26 @@ class Goods extends BaseModel // 设置显示的销量 goods_sales $query->field(['(sales_initial + sales_actual) as goods_sales', '(line_price_max - goods_price_min) as discount']); // 排序条件 - $sort = $this->setQuerySort($param); + $sort1 = $this->setQuerySort($param); + // var_dump($sort); + // exit(); $order = request()->get()['order'] ?? ''; $sort = request()->get()['sort'] ?? ''; + //商家端商品列表排序 if ($order && $sort) { $sort = [ $sort => $order, ]; } else { - $sort = [ - $this->getPk() => 'desc', - ]; + //小程序前台商品排序 + if ($sort1) { + $sort = $sort1; + } else { + $sort = [ + $this->getPk() => 'desc', + ]; + } + } // if (!empty($order)) { // if ($order == 1) {