feature/main20240421
lqmac 6 months ago
parent ef37149815
commit dc4e107c5a
  1. 10
      app/admin/controller/Channel.php
  2. 13
      app/admin/model/Channel.php
  3. 15
      app/common/model/Channel.php
  4. 2
      app/common/model/UploadFile.php
  5. 3
      app/store/model/UploadFile.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'));

@ -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);
}
/**

@ -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);
}
}

@ -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();
}

@ -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);
}

Loading…
Cancel
Save