42 lines
1.2 KiB
PHP
Executable File
42 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Controller\admin;
|
|
|
|
use App\Controller\AbstractController;
|
|
use App\Model\AppNews;
|
|
use Hyperf\HttpServer\Annotation\Controller;
|
|
use Hyperf\HttpServer\Annotation\RequestMapping;
|
|
use Hyperf\View\RenderInterface;
|
|
|
|
#[Controller(prefix: 'admin/news')]
|
|
class NewsController extends AbstractController
|
|
{
|
|
#[RequestMapping(path: '', methods: 'get')]
|
|
public function index(RenderInterface $render): \Psr\Http\Message\ResponseInterface
|
|
{
|
|
return $render->render('news/index');
|
|
}
|
|
|
|
/**
|
|
* 查看新闻详情
|
|
* @url /admin/news/view
|
|
*/
|
|
#[RequestMapping(path: 'view', methods: 'get')]
|
|
public function view(RenderInterface $render): \Psr\Http\Message\ResponseInterface
|
|
{
|
|
$id = $this->request->query('id');
|
|
$query = AppNews::where('id', $id)->first()->toArray();
|
|
|
|
return $render->render('news/view');
|
|
}
|
|
|
|
/**
|
|
* 新增新闻页面
|
|
* @url /admin/news/insert
|
|
*/
|
|
#[RequestMapping(path: 'insert', methods: 'get')]
|
|
public function insert(RenderInterface $render): \Psr\Http\Message\ResponseInterface
|
|
{
|
|
return $render->render('news/insert');
|
|
}
|
|
} |