quanwei
2025-12-31 48d31672b4d88900080093cd1632f9d2eb978d4d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
 
namespace app\api\controller\plus\article;
 
use app\api\controller\Controller;
use app\api\model\plus\article\Article as ArticleModel;
use app\api\model\plus\article\Category as CategoryModel;
 
/**
 * 文章控制器
 */
class Article extends Controller
{
    /**
     *获取分类
     */
    public function category()
    {
        // 文章分类
        $category = CategoryModel::getAll();
        return $this->renderSuccess('', compact('category'));
    }
 
    /**
     * 文章列表
     */
    public function index($category_id = 0)
    {
        $model = new ArticleModel;
        $data = $this->postData();
        $shop_supplier_id = $data['shop_supplier_id']??-1;
        $list = $model->getList($category_id, $this->postData(),$shop_supplier_id,$shop_supplier_id);
        return $this->renderSuccess('', compact('list'));
    }
 
    /**
     *文章详情
     */
    public function detail($article_id)
    {
        $detail = ArticleModel::detail($article_id);
        return $this->renderSuccess('', compact('detail'));
    }
 
}