chengkun
2025-05-12 c49b17b9588306c14ad4b30e6a2c4b8644f3233b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
 
class admin_loginlog_controller extends adminCommon{
  function  set_search(){
    $ad_time                        =            array('1'=>'今天','3'=>'最近三天','7'=>'最近七天','15'=>'最近半月','30'=>'最近一个月');
        $search_list[]                    =            array("param"=>"end","name"=>'操作时间',"value"=>$ad_time);
        $this->yunset("search_list",$search_list);
  }
    function index_action(){
 
    $this -> set_search();
        $logM                            =            $this->MODEL('log');
        $memberM                        =            $this->MODEL('userinfo');
 
        if($_GET['utype']){
            $utype                        =            $_GET['utype'];
            $where['usertype']             =             trim($_GET['utype']);
            $urlarr['utype']            =            $_GET['utype'];
        }else{
            $utype                        =            1;
            $where['usertype']             =             1;
            $urlarr['utype']            =            $_GET['utype'];
        }
        if(intval($_GET['uid'])){
            $where['uid']                 =             intval($_GET['uid']);
            $urlarr['uid']                =            $_GET['uid'];
        }
        if($_GET['end']){
            if($_GET['end']=='1'){
                $where['ctime'][]         =             array('>=',strtotime(date("Y-m-d 00:00:00")));
            }else{
                $where['ctime'][]         =             array('>=',strtotime('-'.(int)$_GET['end'].'day'));
            }
            $urlarr['end']                =            $_GET['end'];
        }
        if(trim($_GET['keyword'])){
            if($_GET['type']==1){
                $member                    =            $memberM->getList(array('username'=>array('like',trim($_GET['keyword']))),array('field'=>'`uid`,`username`'));
                foreach($member as $v){
                    $uid[]                =            $v['uid'];
                }
                $where['uid']            =            array('in',pylode(",",$uid));
            }elseif($_GET['type']==2){
 
                $where['content']        =            array('like',trim($_GET['keyword']));
 
            }elseif($_GET['type']==3){
 
                $where['uid']            =            trim($_GET['keyword']);
 
            }
            $urlarr['keyword']            =    $_GET['keyword'];
 
            $urlarr['type']                =    $_GET['type'];
        }
        if($_GET['time']){
            $time                        =            @explode('~',$_GET['time']);
            $where['ctime'][]             =             array('>=',strtotime($time[0]."00:00:00"));
            $where['ctime'][]             =             array('<=',strtotime($time[1]."23:59:59"));
            $urlarr['time']                =            $_GET['time'];
        }
 
 
        //内容搜索
        if(trim($_GET['content'])){
            $content = $_GET['content'];
            $where['content'] = array('like',trim($_GET['content']));
            $urlarr['content'] = $_GET['content'];
        }
        $urlarr                            =               $_GET;
        $urlarr['page']                     =            '{{page}}';
        $pageurl                         =            Url($_GET['m'],$urlarr,'admin');
        $pageM                             =            $this  -> MODEL('page');
        $pages                             =            $pageM -> pageList('login_log',$where,$pageurl,$_GET['page']);
 
        if($pages['total'] > 0){
 
            if($_GET['order']){
 
                $where['orderby']        =            $_GET['t'].','.$_GET['order'];
                $urlarr['order']        =            $_GET['order'];
                $urlarr['t']            =            $_GET['t'];
 
            }else{
 
                $where['orderby']        =            array('id,desc');
 
            }
            $where['limit']                   =              $pages['limit'];
 
            $List                          =              $logM -> getLoginlogList($where,array('utype'=>'admin'));
 
            $this -> yunset(array('rows'=>$List));
        }
        $this->yuntpl(array('admin/admin_loginlog'));
    }
    /**
     * @desc 会员-登录日志-列表:(统计数量)
     */
    function loginlogNum_action(){
        $logM = $this->MODEL('log');
        $num = $logM->getLoginlogNum(array('usertype'=>$_GET['usertype']));
        echo $num;
    }
 
    function dellog_action(){
        $this->check_token();
        $logM = $this->MODEL('log');
 
        if($_GET['del']=='allcom'){
            $where['usertype']            =            '2';
 
            $logM->delLoginlog('',$where);
 
            $this->layer_msg('已清空企业日志!',9,0,$_SERVER['HTTP_REFERER']);
        }elseif($_GET['del']=='alluser'){
            $where['usertype']            =            '1';
 
            $logM->delLoginlog('',$where);
 
            $this->layer_msg('已清空个人日志!',9,0,$_SERVER['HTTP_REFERER']);
        }elseif($_GET['del']=='alllt'){
            $where['usertype']            =            '3';
 
            $logM->delLoginlog('',$where);
 
            $this->layer_msg('已清空猎头日志!',9,0,$_SERVER['HTTP_REFERER']);
        }elseif($_GET['del']=='alltrain'){
            $where['usertype']            =            '4';
 
            $logM->delLoginlog('',$where);
 
            $this->layer_msg('已清空培训日志!',9,0,$_SERVER['HTTP_REFERER']);
 
        }elseif($_GET['del']){
            $del=$_GET['del'];
 
            if($del){
                if(is_array($del)){
                    $layer_type=1;
                    $where['id'] = array('in',pylode(',',$del));
                    $logM->delLoginlog('',$where);
 
                }else{
 
                    $logM->delLoginlog('',array('id' => $del));
 
                    $layer_type=0;
 
                }
                $this->layer_msg('登录日志(ID:'.pylode(',',$del).')删除成功!',9,$layer_type,$_SERVER['HTTP_REFERER']);
            }else{
                $this->layer_msg('请选择您要删除的信息!',8,0,$_SERVER['HTTP_REFERER']);
            }
        }
    }
}
?>