lqmac 8 months ago
parent 83628be5a1
commit cfd24f9988
  1. 11
      app/common/model/Goods.php

@ -278,18 +278,27 @@ 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 {
//小程序前台商品排序
if ($sort1) {
$sort = $sort1;
} else {
$sort = [
$this->getPk() => 'desc',
];
}
}
// if (!empty($order)) {
// if ($order == 1) {
// $sort = ['goods_price_min' => 'asc'];

Loading…
Cancel
Save