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

@ -278,17 +278,26 @@ class Goods extends BaseModel
// 设置显示的销量 goods_sales // 设置显示的销量 goods_sales
$query->field(['(sales_initial + sales_actual) as goods_sales', '(line_price_max - goods_price_min) as discount']); $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'] ?? ''; $order = request()->get()['order'] ?? '';
$sort = request()->get()['sort'] ?? ''; $sort = request()->get()['sort'] ?? '';
//商家端商品列表排序
if ($order && $sort) { if ($order && $sort) {
$sort = [ $sort = [
$sort => $order, $sort => $order,
]; ];
} else { } else {
$sort = [ //小程序前台商品排序
$this->getPk() => 'desc', if ($sort1) {
]; $sort = $sort1;
} else {
$sort = [
$this->getPk() => 'desc',
];
}
} }
// if (!empty($order)) { // if (!empty($order)) {
// if ($order == 1) { // if ($order == 1) {

Loading…
Cancel
Save