You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\admin\model\Ip as IpModel;
|
|
use think\response\Json;
|
|
|
|
class Ip extends ApiController
|
|
{
|
|
|
|
public function getList(): Json
|
|
{
|
|
if (!$this->request->isPost()) {
|
|
return $this->renderError('不支持GET请求');
|
|
}
|
|
$data = $this->postData();
|
|
$page = isset($data['page']) && !empty($data['page']) ? $data['page'] : 1;
|
|
$limit = isset($data['limit']) && !empty($data['limit']) ? $data['limit'] : 20;
|
|
|
|
$IpModel = new IpModel();
|
|
$where = ['status' => 1];
|
|
$list = $IpModel->withoutField('update_time, delete_time, create_time, status')
|
|
->where($where)
|
|
->order('id desc')
|
|
->page($page, $limit)
|
|
->select()
|
|
->each(function ($item) {
|
|
$item['expire_time'] = $item['expire_time'] ? date('Y-m-d H:i:s', $item['expire_time']) : '-';
|
|
return $item;
|
|
});
|
|
return $this->renderSuccess($list->toArray());
|
|
}
|
|
|
|
}
|
|
|