// +---------------------------------------------------------------------- namespace App\Services\Common; use App\Models\ActionLogModel; use App\Services\BaseService; /** * 行为日志-服务类 * @author laravel开发员 * @since 2020/11/12 * Class ActionLogService * @package App\Services\Common */ class ActionLogService extends BaseService { public static $instance = null; /** * 构造函数 * @author laravel开发员 * @since 2020/11/12 * ActionLogService constructor. */ public function __construct() { $this->model = new ActionLogModel(); } /** * 获取城市列表 * @return array * @since 2020/11/11 * @author laravel开发员 */ public function getList() { $param = request()->all(); // 查询条件 $map = []; // 城市名称 $name = getter($param, "username"); if ($name) { $map[] = ['username', 'like', "%{$name}%"]; } $list = $this->model->getList($map, [['create_time', 'desc']]); if (!empty($list)) { foreach ($list as &$val) { $val['create_time'] = $val['create_time']? strtotime($val['create_time']) : time(); } } return message("操作成功", true, $list); } }