lqmac 7 months ago
parent 5746acdc62
commit 37c328a722
  1. 69
      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); $sort = $this->setQuerySort($param);
$order = request()->get()['order'] ?? ''; $order = request()->get()['order'] ?? '';
$sort = request()->get()['sort'] ?? '';
if (!empty($order)) { if ($order && $sort) {
if ($order == 1) { $sort = [
$sort = ['goods_price_min' => 'asc']; $sort => $order,
} ];
if ($order == 2) { } else {
$sort = ['goods_price_min' => 'desc']; $sort = [
} $this->getPk() => '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'];
}
} }
// 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']); $field = $this->getAliasFields($this->name, ['content']);

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

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

Loading…
Cancel
Save