chengkun
2025-05-22 1a8aea45ebb1582c9f65d9e8dcd520002f83ae12
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
<?php
 
 
 
class recycle_controller extends adminCommon
{
 
    function set_search()
    {
 
        $lo_time    =   array(
            '1'     =>  '今天',
            '3'     =>  '最近三天',
            '7'     =>  '最近七天',
            '15'    =>  '半月之内',
            '30'    =>  '一个月之内',
            '90'    =>  '三个月之内',
            '180'   =>  '半年之内'
        );
        $search_list[]  =   array('param' => 'ctime', 'name' => '删除时间', 'value' => $lo_time);
        $this->yunset("search_list", $search_list);
    }
 
    function index_action()
    {
 
        $recycleM   =   $this->MODEL('recycle');
 
        $this->set_search();
 
        extract($_GET);
 
        if (trim($ukeyword)) {
 
            $where['username']  =   array('like', $ukeyword);
            $urlarr['ukeyword'] =   $ukeyword;
        }
        if (trim($keyword)) {
 
            $where['body']      =   array('like', $keyword);
            $urlarr['keyword']  =   $keyword;
        }
        if (trim($tkeyword)) {
 
            $where['tablename'] =   $tkeyword;
            $urlarr['type']     =   $type;
            $urlarr['tkeyword'] =   $tkeyword;
        }
        if ($_GET['ident']) {
 
            $where['ident']     =   $_GET['ident'];
            $urlarr['ident']    =   $_GET['ident'];
        }
        if ($_GET['ctime']) {
            if ($_GET['ctime'] == '1') {
 
                $where['ctime'] =   array('>=', strtotime(date("Y-m-d 00:00:00")));
            } else {
 
                $where['ctime'] =   array('>=', strtotime('-' . (int)$_GET['ctime'] . 'day'));
            }
            $urlarr['ctime']    =   $_GET['ctime'];
        }
        if ($_GET['time']) {
 
            $time                   =   @explode('~', $_GET['time']);
 
            $where['PHPYUNBTWSTART']=   '';
            $where['ctime'][]       =   array('>=', strtotime($time[0] . "00:00:00"));
            $where['ctime'][]       =   array('<=', strtotime($time[1] . "23:59:59"));
            $where['PHPYUNBTWEND']  =   '';
 
            $urlarr['time']         =   $_GET['time'];
        }
 
        $urlarr            =   $_GET;
        $urlarr['page'] =   "{{page}}";
        $pageurl        =   Url($_GET['m'], $urlarr, 'admin');
 
        $pageM          =   $this->MODEL('page');
        $pages          =   $pageM->pageList('recycle', $where, $pageurl, $_GET['page'], $this->config['sy_listnum']);
 
        if ($pages['total'] > 0) {
            if (isset($_GET['order'])) {
 
                $where['orderby']   =   $_GET['t'] . ',' . $_GET['order'];
                $urlarr['order']    =   $_GET['order'];
                $urlarr['t']        =   $_GET['t'];
            } else {
 
                $where['orderby']   =   'id';
            }
            $where['limit'] =   $pages['limit'];
 
            $List           =   $recycleM->getList($where);
 
            $this->yunset("rows", $List);
        }
        $this->yunset("get_type", $_GET);
        $this->yuntpl(array('admin/admin_recycle'));
    }
 
 
    function show_action()
    {
 
        $recycleM   =   $this->MODEL('recycle');
        $rows       =   $recycleM->getInfo(array('id' => $_GET['id']));
        $this->yunset("rows", unserialize($rows[body]));
        $this->yuntpl(array('admin/admin_recycle_show'));
    }
 
    /**
     * @desc 单表恢复
     */
    function recover_action()
    {
 
        $recycleM   =   $this->MODEL('recycle');
 
        if ($_GET['id']) {
 
            $return =   $recycleM->recoverTb(array('id' => $_GET['id']));
            $this->layer_msg($return['msg'], $return['errcode'], 0, $_SERVER['HTTP_REFERER']);
        }
    }
 
    /**
     * @desc 关联数据恢复,一键恢复
     */
    function recoverByIdent_action()
    {
 
        $recycleM   =   $this->MODEL('recycle');
 
        if ($_GET['ident']) {
 
            $return =   $recycleM->recoverByIdent(array('ident' => $_GET['ident']));
            $this->layer_msg($return['msg'], $return['errcode'], 0, $_SERVER['HTTP_REFERER']);
        }
    }
 
    function del_action()
    {
 
        $recycleM   =   $this->MODEL('recycle');
 
        $this->check_token();
 
        if ($_GET['id'] == "alldel") {
 
            $this->db->Query("TRUNCATE `" . $this->def . "recycle`");
            $this->layer_msg("已清空回收站!", 9, 0, $_SERVER['HTTP_REFERER']);
        } else if ($_GET['del']) {
 
            $del    =   $_GET['del'];
            if (is_array($del)) {
 
                $where['id']    =   array('in', pylode(',', $del));
                $return         =   $recycleM->delRecycle($where);
 
                $this->layer_msg($return['msg'], $return['errcode'], 1, $_SERVER['HTTP_REFERER']);
            } else {
 
                $this->layer_msg('请选择您要删除的信息!', 8, 1, $_SERVER['HTTP_REFERER']);
            }
        } else if ($_GET['id']) {
 
            $result =   $recycleM->delRecycle(array('id' => $_GET['id']));
 
            $this->layer_msg($result['msg'], $result['errcode'], 0, $_SERVER['HTTP_REFERER']);
        } else if ($_GET['time']) {
 
            $result =   $recycleM->delRecycle(array('ctime' => strtotime($_GET['time'])));
            $this->layer_msg($result['msg'], $result['errcode'], 0, $_SERVER['HTTP_REFERER']);
        } else {
 
            $this->layer_msg('非法操作!', 8, 0, $_SERVER['HTTP_REFERER']);
        }
    }
}
 
?>