<?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'));
|
}
|
|
}
|