51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\mall;
|
|
|
|
use app\admin\service\annotation\ControllerAnnotation;
|
|
use app\admin\service\annotation\MiddlewareAnnotation;
|
|
use app\admin\service\annotation\NodeAnnotation;
|
|
use app\common\controller\AdminController;
|
|
use app\Request;
|
|
use think\App;
|
|
use think\response\Json;
|
|
|
|
#[ControllerAnnotation(title: 'IP黑名单管理')]
|
|
class Blackip extends AdminController
|
|
{
|
|
|
|
#[NodeAnnotation(ignore: ['export'])] // 过滤不需要生成的权限节点 默认 CURD 中会自动生成部分节点 可以在此处过滤
|
|
protected array $ignoreNode;
|
|
|
|
public function __construct(App $app)
|
|
{
|
|
parent::__construct($app);
|
|
self::$model = new \app\admin\model\BlackIp();
|
|
}
|
|
|
|
#[NodeAnnotation(title: '列表', auth: true)]
|
|
public function index(Request $request): Json|string
|
|
{
|
|
if ($request->isAjax()) {
|
|
if (input('selectFields')) return $this->selectList();
|
|
list($page, $limit, $where) = $this->buildTableParams();
|
|
$count = self::$model::where($where)->count();
|
|
$list = self::$model::where($where)->page($page, $limit)->order($this->sort)->select()->toArray();
|
|
$data = [
|
|
'code' => 0,
|
|
'msg' => '',
|
|
'count' => $count,
|
|
'data' => $list,
|
|
];
|
|
return json($data);
|
|
}
|
|
return $this->fetch();
|
|
}
|
|
|
|
#[MiddlewareAnnotation(ignore: MiddlewareAnnotation::IGNORE_LOGIN)]
|
|
public function no_check_login(Request $request): string
|
|
{
|
|
return '这里演示方法不需要经过登录验证';
|
|
}
|
|
|
|
} |