ActionlogController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * 操作日志
  4. * @author Mike <m@9026.com>
  5. * @version 1.0
  6. * @date 2015年10月15日
  7. *
  8. */
  9. namespace App\Http\Controllers\Admin\Base;
  10. use App\Http\Controllers\Admin\Controller;
  11. use Request;
  12. use App\Services\User\Payinfo;
  13. use App\Utils\AliLog;
  14. use Carbon\Carbon;
  15. class ActionlogController extends Controller {
  16. private $_service;
  17. private $_viewdata;
  18. private $_aTopic = [ 'action-view-log'=>'访问日志','action-operate-log'=>'操作日志'];
  19. /**
  20. * 初始化Service
  21. */
  22. public function __construct()
  23. {
  24. parent::__construct();
  25. if(!$this->_service) $this->_service = new Payinfo();
  26. $this->_viewdata = array();
  27. }
  28. /**
  29. * 列表
  30. */
  31. function index()
  32. {
  33. $obj = new AliLog();
  34. $this->_viewdata['aTopIc'] = $this->_aTopic;
  35. $this->_viewdata['topic'] = Request::input('topic','action-view-log');
  36. $this->_viewdata['aLine'] = [50=>'50行',100=>'100行',200=>'200行'];
  37. $this->_viewdata['line'] = Request::input('line',50);
  38. $this->_viewdata['start_time'] = Request::input('start_time',Carbon::yesterday());
  39. $this->_viewdata['end_time'] = Request::input('end_time',Carbon::tomorrow());
  40. $query = '';
  41. $data = $obj->listLogs('admin-operate-log',
  42. strtotime($this->_viewdata['start_time']),
  43. strtotime($this->_viewdata['end_time']),
  44. $this->_viewdata['topic'],
  45. $query,
  46. $this->_viewdata['line']
  47. );
  48. $request = Request::all();
  49. $search['keyword'] = Request::input('keyword');
  50. $orderby = array();
  51. if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
  52. $orderby[$request['sort_field']] = $request['sort_field_by'];
  53. }
  54. $this->_viewdata['data'] = $data;
  55. return view('admin.base.actionlog.index', $this->_viewdata);
  56. }
  57. }