feature/main20240421
guojia 9 months ago
parent 256e2a077e
commit 95bff5a215
  1. 3
      app/api/controller/Merchant.php
  2. 4
      app/common/model/Merchant.php

@ -130,7 +130,8 @@ class Merchant extends Controller
public function list(): Json {
$model = new MerchantModel;
$pageSize = $this->request->param('pageSize') ?? 15;
$list = $model->getList($this->request->param(), intval($pageSize))->toArray();
$sort = $this->request->param('sort') ?? "merchant_id";
$list = $model->getList($this->request->param(), intval($pageSize), $sort)->toArray();
foreach ($list['data'] as $kr => $r) {
$res[$kr]['licenseImg'] = [];

@ -84,12 +84,12 @@ class Merchant extends BaseModel
* @return \think\Paginator
* @throws \think\db\exception\DbException
*/
public function getList(array $param = [], int $pageSize = 15): \think\Paginator
public function getList(array $param = [], int $pageSize = 15, $sortField): \think\Paginator
{
$res = $this->with(['logoImage'])
->where($this->getFilter($param))
->where('is_delete', '=', 0)
->order(['sort' => 'asc', $this->getPk()])
->order(['sort' => 'desc', $sortField])
->paginate($pageSize);
return $res;

Loading…
Cancel
Save