lqmac 7 months ago
parent 5746acdc62
commit 37c328a722
  1. 61
      app/common/model/Goods.php
  2. 2
      app/store/controller/Goods.php
  3. 4
      app/store/controller/Store.php

@ -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'];
$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 == 3) {
// $sort = ['discount' => 'asc'];
// }
// if ($order == 4) {
// $sort = ['discount' => 'desc'];
// }
if ($order == 5) {
$sort = ['goods_sales' => 'asc'];
// if ($order == 5) {
// $sort = ['goods_sales' => 'asc'];
}
if ($order == 6) {
$sort = ['goods_sales' => 'desc'];
}
// }
// if ($order == 6) {
// $sort = ['goods_sales' => 'desc'];
// }
if ($order == 7) {
$sort = ['goods_sales' => 'asc'];
}
if ($order == 8) {
$sort = ['goods_sales' => 'desc'];
}
}
// if ($order == 7) {
// $sort = ['goods_sales' => 'asc'];
// }
// if ($order == 8) {
// $sort = ['goods_sales' => 'desc'];
// }
// }
$field = $this->getAliasFields($this->name, ['content']);

@ -35,7 +35,7 @@ class Goods extends Controller
// 获取列表记录
$model = new GoodsModel;
$params = $this->request->param();
//$params['channel'] = 'zy';
$params['channel'] = 'zy';
$list= $model->getList($params, (int)$this->request->param('pageSize', 15));
return $this->renderSuccess(compact('list'));
}

@ -75,8 +75,8 @@ class Store extends Controller
*/
public function platformList(): Json
{
$list = Channel::withoutGlobalScope()->where('status', 1)->whereIn('code',['jd','sn','zy','xqtx'])->select();
//$list = Channel::withoutGlobalScope()->where('status', 1)->whereIn('code',['zy'])->select();
//$list = Channel::withoutGlobalScope()->where('status', 1)->whereIn('code',['jd','sn','zy','xqtx'])->select();
$list = Channel::withoutGlobalScope()->where('status', 1)->whereIn('code',['zy'])->select();
$platformList = [];
foreach ($list as $key => $value) {
$platformList[$value['code']] = $value['name'];

Loading…
Cancel
Save