OperatelogController.class.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fld
  12. *
  13. */
  14. namespace Seller\Controller;
  15. class OperatelogController extends CommonController{
  16. protected function _initialize(){
  17. parent::_initialize();
  18. $this->breadcrumb1='系统日志';
  19. $this->breadcrumb2='系统日志列表';
  20. $this->sellerid = SELLERUID;
  21. }
  22. /**
  23. * 系统日志列表
  24. */
  25. public function index()
  26. {
  27. $_GPC = I('request.');
  28. $this->gpc = $_GPC;
  29. $userID = SELLERUID;
  30. $condition = ' 1 ';
  31. $pindex = max(1, intval($_GPC['page']));
  32. $psize = 20;
  33. $time = $_GPC['time'];
  34. if (!empty($_GPC['keyword'])) {
  35. $_GPC['keyword'] = trim($_GPC['keyword']);
  36. $condition .= ' and ( operation_seller_name like "%'.$_GPC['keyword'].'%" or content like "%'.$_GPC['keyword'].'%" ) ';
  37. }
  38. if (isset($_GPC['operation_type']) && trim($_GPC['operation_type']) != '') {
  39. $_GPC['operation_type'] = trim($_GPC['operation_type']);
  40. $condition .= ' and operation_type = "'. $_GPC['operation_type'].'" ';
  41. }
  42. if($_GPC['searchtime'] == 'create_time'){
  43. if(!empty($time['start'])){
  44. $condition .= " and addtime <= ".strtotime($time['end'])." and addtime >=".strtotime($time['start'])." ";
  45. $this->starttime = strtotime($time['start']);
  46. $this->endtime = strtotime($time['end']);
  47. }else{
  48. $this->starttime = strtotime(date('Y-m-d').' 00:00');
  49. $this->endtime = strtotime(date('Y-m-d').' 23:59');
  50. }
  51. }else{
  52. $this->starttime = strtotime(date('Y-m-d').' 00:00');
  53. $this->endtime = strtotime(date('Y-m-d').' 23:59');
  54. }
  55. $label = M('lionfish_comshop_systemoperation_log')->where( $condition )->order(' id desc ')->limit( (($pindex - 1) * $psize) . ',' . $psize )->select();
  56. foreach($label as $key => $var){
  57. //$label[$key]['city'] = D('Seller/Operatelog')->get_ip_city( $var['ip'] );
  58. }
  59. $total = M('lionfish_comshop_systemoperation_log')->where( $condition )->count();
  60. $pager = pagination2($total, $pindex, $psize);
  61. $time = time();
  62. $this->label = $label;
  63. $this->pager = $pager;
  64. $this->display("Operatelog/index");
  65. }
  66. /**
  67. * 删除系统日志
  68. */
  69. public function delete_operatelog(){
  70. $_GPC = I('request.');
  71. $id = intval($_GPC['id']);
  72. if (empty($id)) {
  73. $id = $_GPC['ids'];
  74. }
  75. if( is_array($id) )
  76. {
  77. $items = M('lionfish_comshop_systemoperation_log')->field('id')->where( array('id' => array('in', $id)) )->select();
  78. }else{
  79. $items = M('lionfish_comshop_systemoperation_log')->field('id')->where( array('id' =>$id ) )->select();
  80. }
  81. if (empty($item)) {
  82. $item = array();
  83. }
  84. foreach ($items as $item) {
  85. M('lionfish_comshop_systemoperation_log')->where( array('id' => $item['id']) )->delete();
  86. }
  87. show_json(1, array('url' => U('operatelog/index')));
  88. }
  89. }
  90. ?>