pull/1/head
wanghousheng 10 months ago
parent 99fcd882d8
commit ca5ce3f1e5
  1. 27
      app/admin/controller/Goods.php

@ -12,8 +12,8 @@ declare (strict_types=1);
namespace app\admin\controller; namespace app\admin\controller;
use think\response\Json;
use think\facade\Db; use think\facade\Db;
use think\response\Json;
/** /**
* 商城管理 * 商城管理
@ -61,24 +61,17 @@ class Goods extends Controller
if (isset($params['max_price']) && $params['max_price']) { if (isset($params['max_price']) && $params['max_price']) {
$where[] = ['net_price', '<=', $params['max_price']]; $where[] = ['net_price', '<=', $params['max_price']];
} }
$list = Db::connect("dataCenterMysql")->table('goods_sku') $list = Db::connect("dataCenterMysql")->table('goods_sku')
->where($where) ->where($where)
->order($sort." ".$order) ->order($sort, $order)
->paginate($this->request->param('per_page', 15))->each(function ($item, $key){ ->paginate($this->request->param('per_page', 15))->each(function ($item, $key) {
$item['create_time'] = date("Y-m-d H:i:s", $item['create_time']); $item['create_time'] = date("Y-m-d H:i:s", $item['create_time']);
$item['update_time'] = date("Y-m-d H:i:s", $item['update_time']); $item['update_time'] = date("Y-m-d H:i:s", $item['update_time']);
$item['channel'] = config('app.platformList')[$item['channel']] ?? ""; $item['channel'] = config('app.platformList')[$item['channel']] ?? "";
return $item; return $item;
}); });
return $this->renderSuccess(compact('list')); return $this->renderSuccess(compact('list'));
} }
} }

Loading…
Cancel
Save