更新blog界面
This commit is contained in:
@@ -5,14 +5,14 @@ declare(strict_types=1);
|
||||
namespace app\index\controller\Article;
|
||||
|
||||
use app\index\BaseController;
|
||||
use app\model\Articles;
|
||||
use app\model\ArticlesCategory;
|
||||
use Symfony\Component\VarDumper\VarDumper;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Request;
|
||||
use think\facade\Session;
|
||||
use think\response\Json;
|
||||
use think\db\exception\DbException;
|
||||
use app\model\Cms\Articles;
|
||||
use app\model\Cms\ArticlesCategory;
|
||||
|
||||
class ArticleController extends BaseController
|
||||
{
|
||||
@@ -102,6 +102,34 @@ class ArticleController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章分类列表
|
||||
* @return Json
|
||||
*/
|
||||
public function getArticleCategories(): Json
|
||||
{
|
||||
$tid = $this->getTenantId();
|
||||
|
||||
if (empty($tid)) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'msg' => '无法识别租户信息',
|
||||
'list' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
$articleCategories = ArticlesCategory::where('delete_time', null)
|
||||
->where('tid', $tid)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => 'success',
|
||||
'list' => $articleCategories,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 游客文章阅读量函数
|
||||
* @return Json
|
||||
|
||||
@@ -27,6 +27,9 @@ Route::get('homeData', 'app\index\controller\Index@getHomeData');
|
||||
// --- 新闻中心列表路由 ---
|
||||
Route::get('getCenterNews', 'app\index\controller\Article\NewsCenterController@getCenterNews');
|
||||
|
||||
// --- 文章分类路由 ---
|
||||
Route::get('getArticleCategories', 'app\index\controller\Article\ArticleController@getArticleCategories');
|
||||
|
||||
// --- 新闻中心互动路由 ---
|
||||
Route::post('articleViews/:id', 'app\index\controller\Article\ArticleController@articleViews');
|
||||
Route::post('articleLikes/:id', 'app\index\controller\Article\ArticleController@articleLikes');
|
||||
|
||||
Reference in New Issue
Block a user