OperatelogController.class.php 2.7 KB

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