diff --git a/app/common/model/Merchant.php b/app/common/model/Merchant.php index 13a95954..69b03669 100644 --- a/app/common/model/Merchant.php +++ b/app/common/model/Merchant.php @@ -77,16 +77,7 @@ class Merchant extends BaseModel ->where($this->getFilter($param)) ->where('is_delete', '=', 0) ->order(['sort' => 'asc', $this->getPk()]) - ->paginate(15)->toArray(); - - foreach ($res['data'] as $kr => $r) { - $res[$kr]['licenseImg'] = []; - if ($r['license_img_id']) { - $img_ids = explode(",", $r['license_img_id']); - $files = UploadFile::getFileList($img_ids); - $res['data'][$kr]['licenseImg'] = $files ?: null; - } - } + ->paginate(15); return $res; } diff --git a/app/store/controller/Merchant.php b/app/store/controller/Merchant.php index 0615994f..939648a8 100644 --- a/app/store/controller/Merchant.php +++ b/app/store/controller/Merchant.php @@ -13,6 +13,7 @@ declare (strict_types=1); namespace app\store\controller; use app\common\model\store\StoreSettle; +use app\common\model\UploadFile; use think\response\Json; use app\store\model\Merchant as MerchantModel; use app\store\model\Style as StyleModel; @@ -111,8 +112,16 @@ class Merchant extends Controller */ public function list(): Json { $model = new MerchantModel; - $list = $model->getList($this->request->param()); - return $this->renderSuccess(compact('list')); + $list = $model->getList($this->request->param())->toArray(); + foreach ($list['data'] as $kr => $r) { + $res[$kr]['licenseImg'] = []; + if ($r['license_img_id']) { + $img_ids = explode(",", $r['license_img_id']); + $files = UploadFile::getFileList($img_ids); + $list['data'][$kr]['licenseImg'] = $files ?: null; + } + } + return $this->renderSuccess($list); }