chengkun
2025-04-24 5d55579fd424e024c52e62265b72e24c38a45004
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
 
/**
 * $Author :PHPYUN开发团队
 *
 * 官网: http://www.phpyun.com
 *
 * 版权所有 2009-2021 宿迁鑫潮信息技术有限公司,并保留所有权利。
 *
 * 软件声明:未经授权前提下,不得用于商业运营、二次开发以及任何形式的再次发布。
 */
 
class admin_weblog_controller extends adminCommon
{
 
    function set_search()
    {
        $search_list[]  =   array("param" => "usertype", "name" => '用户类型', "value" => array("1" => "个人用户", "2" => "企业用户"));
        $search_list[]  =   array("param" => "times", "name" => '行为日期', "value" => array("1" => "今天", "2" => "昨天", "3" => "最近3天", "4" => "最近7天"));
        $this->yunset("search_list", $search_list);
    }
 
    function index_action()
    {
 
        $webLogM    =   $this->MODEL('weblog');
        $UserinfoM  =   $this->MODEL('userinfo');
        $this->set_search();
 
        $where['usertype']  =   array('in', '1,2');
 
        if (trim($_GET['keyword'])) {
            if ($_GET['type'] == 1) {
 
                $username   =   $UserinfoM->getList(array('username' => array('like', trim($_GET['keyword']))), array('field' => '`uid`,`username`'));
                if ($username && is_array($username)) {
                    foreach ($username as $val) {
                        $muids[]    =   $val['uid'];
                    }
                    $where['uid']   =   array('in', pylode(',', $muids));
                }
            }
            $urlarr["keyword"]  =   $_GET["keyword"];
            $urlarr["type"]     =   $_GET["type"];
        }
        if ($_GET['usertype']) {
 
            $where['usertype']  =   $_GET['usertype'];
            $urlarr['usertype'] =   $_GET['usertype'];
        }
 
        if ($_GET['times']) {
 
            $today  =   strtotime(date('Y-m-d'));
            if ($_GET['times'] == 1) {
 
                $where['time']  =   array('>=', $today, 'AND');
            } else if ($_GET['times'] == 2) {
 
                $where['PHPYUNBTWSTART_A']  =   '';
                $where['time']  =   array('>=', strtotime('-1 day', $today), 'AND');
                $where['time']  =   array('<', $today, 'AND');
                $where['PHPYUNBTWEND_A']    =   '';
            } else if ($_GET['times'] == 3) {
 
                $where['time']  =   array('>=', strtotime('-3 day', $today), 'AND');
            } else if ($_GET['times'] == 4) {
 
                $where['time']  =   array('>=', strtotime('-7 day', $today), 'AND');
            }
            $urlarr['times']    =   $_GET['times'];
        }
 
        if ($_GET['time']) {
            $times              =   @explode('~', $_GET['time']);
            $where['PHPYUNBTWSTART_A']  =   '';
            $where['time'][]    =   array('>=', strtotime($times[0] . "00:00:00"), 'AND');
            $where['time'][]    =   array('<=', strtotime($times[1] . "23:59:59"), 'AND');
            $where['PHPYUNBTWEND_A']  =   '';
            $urlarr['time']     =   $_GET['time'];
        }
        $urlarr            =   $_GET;
        $urlarr['page'] = "{{page}}";
        $pageurl    =   Url($_GET['m'], $urlarr, 'admin');
        $pageM      =   $this->MODEL('page');
        $pages      =   $pageM->pageList('web_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']   =   'id';
            }
            $where['limit'] =   $pages['limit'];
            $rows           =   $webLogM->getWebLogList($where, array('utype' => 'admin'));
        }
        $this->yunset("rows", $rows);
        $this->yuntpl(array('admin/admin_weblog'));
    }
 
 
    function tj_action()
    {
 
        if ($_GET['uid'] && $_GET['usertype']) {
 
            $this->yunset("uid", $_GET['uid']);
            $this->yunset("usertype", $_GET['usertype']);
        }
        $this->yuntpl(array('admin/admin_weblogtj'));
    }
 
 
    function getloglist_action()
    {
 
        if ($_POST['uid']) {
 
            $webLogM        =   $this->MODEL('weblog');
 
            $where['uid']   =   intval($_POST['uid']);
 
            //默认取当天数据
            $today          =   strtotime(date('Y-m-d'));
            if ($_POST['time'] == 1) {
 
                $where['time']  =   array('>=', $today, 'AND');
            } else if ($_POST['time'] == 2) {
 
                $where['PHPYUNBTWSTART_A']  =   '';
                $where['time'][]            =   array('>=', strtotime('-1 day', $today), 'AND');
                $where['time'][]            =   array('<', $today, 'AND');
                $where['PHPYUNBTWEND_A']    =   '';
            } else if ($_POST['time'] == 3) {
 
                $where['time']  =   array('>=', strtotime('-3 day', $today), 'AND');
            } else if ($_POST['time'] == 4) {
 
                $where['time']  =   array('>=', strtotime('-7 day', $today), 'AND');
            }
 
            if ($_POST['times']) {
                $times              =   @explode('~', $_POST['times']);
                $where['PHPYUNBTWSTART_B']  =   '';
                $where['time'][]    =   array('>=', strtotime($times[0] . "00:00:00"), 'AND');
                $where['time'][]    =   array('<=', strtotime($times[1] . "23:59:59"), 'AND');
                $where['PHPYUNBTWEND_B']  =   '';
                $urlarr['time']     =   $_GET['time'];
            }
 
            $pagenav            =   $_POST['pagenav'] > 0 ? $_POST['pagenav'] : 0;
 
            $where['limit']     =   array($pagenav * $this->config['sy_listnum'], $this->config['sy_listnum']);
 
            $where['orderby']   =   'id';
 
            $rows               =   $webLogM->getWebLogList($where);
 
            if (!empty($rows)) {
 
                $List['code']       =   1;
                $List['list']       =   $rows;
                $List['pagenav']    =   $pagenav + 1;
            } else {
 
                $List['code']       =   2;
            }
            echo json_encode($List);
        }
    }
 
    function getlogtj_action()
    {
 
        if ($_POST['uid']) {
 
            $webLogM    =   $this->MODEL('weblog');
            $logCount   =   $webLogM->logCount(array('uid' => $_POST['uid'], 'time' => $_POST['time'], 'times' => $_POST['times'], 'usertype' => $_POST['usertype']));
            echo json_encode($logCount);
        }
    }
 
 
}
 
?>