diff --git a/app/admin/controller/Channel.php b/app/admin/controller/Channel.php index 6b3369bf..ebbc9cdd 100644 --- a/app/admin/controller/Channel.php +++ b/app/admin/controller/Channel.php @@ -15,7 +15,7 @@ namespace app\admin\controller; use think\response\Json; use app\admin\controller\Controller; use app\admin\model\Channel as ChannelModel; - +use app\common\model\UploadFile; /** * 商家后台菜单控制器 * Class Menu @@ -34,12 +34,12 @@ class Channel extends Controller { $model = new ChannelModel; $list = $model->getList()->toArray(); - foreach ($list['data'] as $kr => $r) { - $res[$kr]['licenseImg'] = []; + foreach ($list['data'] as $kr => &$r) { + $r['licenseImg'] = []; if ($r['license_img_id']) { $img_ids = explode(",", $r['license_img_id']); - $files = UploadFile::getFileList($img_ids); - $list['data'][$kr]['licenseImg'] = $files ?: null; + $files = UploadFile::getFileList($img_ids, 0); + $r['licenseImg'] = $files ?: null; } } return $this->renderSuccess(compact('list')); diff --git a/app/admin/model/Channel.php b/app/admin/model/Channel.php index 1c124d35..8573bdb0 100644 --- a/app/admin/model/Channel.php +++ b/app/admin/model/Channel.php @@ -21,18 +21,7 @@ use app\common\model\Channel as ChannelModel; */ class Channel extends ChannelModel { - /** - * 获取列表数据 - * @param bool $isRecycle - * @return \think\Paginator - * @throws \think\db\exception\DbException - */ - public function getList(bool $isRecycle = false): \think\Paginator - { - return $this->where('status', '=', 1) - ->order(['weigh' => 'asc', 'create_time' => 'desc']) - ->paginate(15); - } + /** diff --git a/app/common/model/Channel.php b/app/common/model/Channel.php index 446685a7..a35174ee 100644 --- a/app/common/model/Channel.php +++ b/app/common/model/Channel.php @@ -13,6 +13,7 @@ declare (strict_types=1); namespace app\common\model; use cores\BaseModel; +use think\model\relation\HasOne; /** * 文章模型 @@ -65,4 +66,18 @@ class Channel extends BaseModel is_array($where) ? $query->where($where) : $query->where('id', '=', $where); return $query->find(); } + + /** + * 获取列表数据 + * @param bool $isRecycle + * @return \think\Paginator + * @throws \think\db\exception\DbException + */ + public function getList(array $param = [], int $pageSize = 15): \think\Paginator + { + return $this->with(['logoImage']) + ->where('status', '=', 1) + ->order(['weigh' => 'asc', 'create_time' => 'desc']) + ->paginate($pageSize); + } } diff --git a/app/common/model/UploadFile.php b/app/common/model/UploadFile.php index ed23d2e7..ef6d8e6c 100644 --- a/app/common/model/UploadFile.php +++ b/app/common/model/UploadFile.php @@ -106,7 +106,7 @@ class UploadFile extends BaseModel public static function getFileList(array $fileIds, int $storeId = null) { return (new static)->where('file_id', 'in', $fileIds) - ->where('store_id', '=', $storeId ?: self::$storeId) + //->where('store_id', '=', $storeId ?: self::$storeId) ->where('is_delete', '=', 0) ->select(); } diff --git a/app/store/model/UploadFile.php b/app/store/model/UploadFile.php index e0cd65cc..bbc14d80 100644 --- a/app/store/model/UploadFile.php +++ b/app/store/model/UploadFile.php @@ -56,8 +56,7 @@ class UploadFile extends UploadFileModel // 是否在回收站 $query->where('is_recycle', '=', (int)$params['isRecycle']); // 查询列表数据 - return $query->where('channel', '=', 10) - ->where('is_delete', '=', 0) + return $query->where('is_delete', '=', 0) ->order(['file_id' => 'desc']) ->paginate(15); }