tapi/app/controller/admin/system/LoginRecordController.php
2025-08-22 10:11:22 +08:00

34 lines
991 B
PHP

<?php
namespace app\controller\admin\system;
use app\BaseController;
use app\entity\SysLoginRecord;
use app\service\CurdService;
use think\db\exception\DbException;
use think\response\Json;
class LoginRecordController extends BaseController
{
/**
* 分页查询账号登录记录
* @return Json
* @throws DbException
*/
public function page(): Json
{
$model = SysLoginRecord::withSearch(['username', 'nickname', 'loginType', 'createTime'], [
'username' => $this->request->get('username/s', ''),
'nickname' => $this->request->get('nickname/s', ''),
'loginType' => $this->request->get('loginType/d', 0),
'createTime' => [
$this->request->get('createTimeStart/s', ''),
$this->request->get('createTimeEnd/s', '')
],
]);
$paginate = CurdService::getPaginate($this->request, $model);
return $this->writeSuccess('ok', $paginate);
}
}