catchAdmin/application/model/LogRecordModel.php

36 lines
835 B
PHP
Raw Normal View History

2019-01-17 18:28:23 +08:00
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/1/17
* Time: 18:09
2019-01-17 18:29:35 +08:00
*/
namespace app\model;
2019-01-18 10:00:08 +08:00
use http\Env\Request;
2019-01-17 18:29:35 +08:00
class LogRecordModel extends BaseModel
{
protected $name = 'option_log';
2019-01-18 10:00:08 +08:00
/**
* 日志列表
*
* @time at 2019年01月18日
* @param array $params
* @param int $limit
* @return mixed
*/
public function getAll(array $params, $limit = self::LIMIT)
{
if (!count($params)) {
2019-01-18 14:33:54 +08:00
return $this->order('created_at', 'desc')->paginate($limit, false, ['query' => request()->param()]);
2019-01-18 10:00:08 +08:00
}
if (isset($params['name'])) {
$list = $this->whereLike('user_name', '%'.$params['name'].'%');
}
2019-01-18 14:33:54 +08:00
return $list->order('created_at', 'desc')->paginate($limit, false, ['query' => request()->param()]);
2019-01-18 10:00:08 +08:00
}
2019-01-17 18:29:35 +08:00
}