| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- 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);
- }
- /**
- * 删除七天之前标记软删除的数据
- */
- public function delete()
- {
- // 设置日志标题
- ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除操作日志信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
- ActionLogModel::record();
- $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
- return parent::delete();
- }
- }
|