|
|
|
@ -274,37 +274,46 @@ class Goods extends BaseModel |
|
|
|
|
// 排序条件 |
|
|
|
|
$sort = $this->setQuerySort($param); |
|
|
|
|
$order = request()->get()['order'] ?? ''; |
|
|
|
|
|
|
|
|
|
if (!empty($order)) { |
|
|
|
|
if ($order == 1) { |
|
|
|
|
$sort = ['goods_price_min' => 'asc']; |
|
|
|
|
} |
|
|
|
|
if ($order == 2) { |
|
|
|
|
$sort = ['goods_price_min' => 'desc']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($order == 3) { |
|
|
|
|
$sort = ['discount' => 'asc']; |
|
|
|
|
} |
|
|
|
|
if ($order == 4) { |
|
|
|
|
$sort = ['discount' => 'desc']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($order == 5) { |
|
|
|
|
$sort = ['goods_sales' => 'asc']; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if ($order == 6) { |
|
|
|
|
$sort = ['goods_sales' => 'desc']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($order == 7) { |
|
|
|
|
$sort = ['goods_sales' => 'asc']; |
|
|
|
|
} |
|
|
|
|
if ($order == 8) { |
|
|
|
|
$sort = ['goods_sales' => 'desc']; |
|
|
|
|
} |
|
|
|
|
$sort = request()->get()['sort'] ?? ''; |
|
|
|
|
if ($order && $sort) { |
|
|
|
|
$sort = [ |
|
|
|
|
$sort => $order, |
|
|
|
|
]; |
|
|
|
|
} else { |
|
|
|
|
$sort = [ |
|
|
|
|
$this->getPk() => 'desc', |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
// if (!empty($order)) { |
|
|
|
|
// if ($order == 1) { |
|
|
|
|
// $sort = ['goods_price_min' => 'asc']; |
|
|
|
|
// } |
|
|
|
|
// if ($order == 2) { |
|
|
|
|
// $sort = ['goods_price_min' => 'desc']; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// if ($order == 3) { |
|
|
|
|
// $sort = ['discount' => 'asc']; |
|
|
|
|
// } |
|
|
|
|
// if ($order == 4) { |
|
|
|
|
// $sort = ['discount' => 'desc']; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// if ($order == 5) { |
|
|
|
|
// $sort = ['goods_sales' => 'asc']; |
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
// if ($order == 6) { |
|
|
|
|
// $sort = ['goods_sales' => 'desc']; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// if ($order == 7) { |
|
|
|
|
// $sort = ['goods_sales' => 'asc']; |
|
|
|
|
// } |
|
|
|
|
// if ($order == 8) { |
|
|
|
|
// $sort = ['goods_sales' => 'desc']; |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$field = $this->getAliasFields($this->name, ['content']); |
|
|
|
|