|
|
@ -22,6 +22,14 @@ class ArticleController extends Controller |
|
|
->orderBy('sort')->orderBy('id', 'DESC') |
|
|
->orderBy('sort')->orderBy('id', 'DESC') |
|
|
->simplePaginate()->toArray(); |
|
|
->simplePaginate()->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
//如果没有数据,且没有软删除的数据,显示默认的几条数据,主要用于新代理商入驻时显示默认文章
|
|
|
|
|
|
if (empty($list['data'])) { |
|
|
|
|
|
if (Article::withTrashed()->where('agent_id', $this->agent_id)->count() === 0 && request('page', 1) < 2) { |
|
|
|
|
|
$list = Article::select('id', 'image', 'title', 'type', 'updated_at') |
|
|
|
|
|
->orderBy('id')->simplePaginate()->toArray(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$new_data = []; |
|
|
$new_data = []; |
|
|
$prefix = Storage::disk('public')->url(''); |
|
|
$prefix = Storage::disk('public')->url(''); |
|
|
foreach ($list['data'] as $k => &$item) { |
|
|
foreach ($list['data'] as $k => &$item) { |
|
|
|