diff --git a/app/Http/Controllers/Api/ArticleController.php b/app/Http/Controllers/Api/ArticleController.php index 75fe993..6640dbf 100644 --- a/app/Http/Controllers/Api/ArticleController.php +++ b/app/Http/Controllers/Api/ArticleController.php @@ -17,18 +17,17 @@ class ArticleController extends Controller //文章列表 public function index() { - $list = Article::where('agent_id', $this->agent_id) - ->select('id', 'image', 'title', 'type', 'updated_at') + $list = Article::select('id', 'image', 'title', 'type', 'updated_at') ->orderBy('sort')->orderBy('id', 'DESC') ->simplePaginate()->toArray(); //如果没有数据,且没有软删除的数据,显示默认的几条数据,主要用于新代理商入驻时显示默认文章 - if (empty($list['data'])) { + /*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 = []; $prefix = Storage::disk('public')->url(''); @@ -57,11 +56,12 @@ class ArticleController extends Controller { $id = (int)request()->input('id'); - if (Article::withTrashed()->where('agent_id', $this->agent_id)->count() === 0) { //演示文章 + $article = Article::find($id); + /*if (Article::withTrashed()->where('agent_id', $this->agent_id)->count() === 0) { //演示文章 $article = Article::find($id); } else { $article = Article::where('agent_id', $this->agent_id)->find($id); - } + }*/ if (!$article) { return $this->error('文章不存在或已被删除'); }