56 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
| <?php
 | |
| 
 | |
| namespace app\controller\manager;
 | |
| 
 | |
| use app\model\Log as LogModel;
 | |
| use Exception;
 | |
| use think\response\Json;
 | |
| use think\response\View;
 | |
| 
 | |
| /**
 | |
|  * 日志
 | |
|  *
 | |
|  * Class Feedback
 | |
|  * @package app\controller\manager
 | |
|  */
 | |
| class Log extends Base
 | |
| {
 | |
|     /**
 | |
|      * 列表
 | |
|      *
 | |
|      * @return View|Json
 | |
|      * @throws Exception
 | |
|      */
 | |
|     public function index()
 | |
|     {
 | |
|         if ($this->request->isPost()) {
 | |
|             $page         = input('page/d', 1);
 | |
|             $limit        = input('size/d', 20);
 | |
|             $searchParams = input('searchParams');
 | |
|             $search       = [];
 | |
|             if ($searchParams) {
 | |
|                 foreach ($searchParams as $key => $param) {
 | |
|                     if ($param) {
 | |
|                         if ($key == 'begin_time') {
 | |
|                             $begin    = strtotime($param.' 00:00:00');
 | |
|                             $search[] = ['create_time', '>', $begin];
 | |
|                         } elseif ($key == 'end_time') {
 | |
|                             $end      = strtotime($param.' 23:59:59');
 | |
|                             $search[] = ['create_time', '<', $end];
 | |
|                         } else {
 | |
|                             $search[] = [$key, 'like', '%'.$param.'%'];
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             $items = LogModel::findList($search, [], $page, $limit, function ($q) {
 | |
|                 return $q->with(['memberName'])->order('create_time', 'desc');
 | |
|             });
 | |
| 
 | |
|             return $this->json(0, '操作成功', $items);
 | |
|         }
 | |
| 
 | |
|         return $this->view();
 | |
|     }
 | |
| } |