chengkun
2025-04-27 a0402d122fee696e2b7684ef7edfc504ade12640
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<?php
 
class emailconfiglist_controller extends adminCommon{
    function index_action(){
        
        $msgM    =    $this->MODEL('email');
        
        $where['del']        =    array('<>',1);
 
        if($_GET['state']=="1"){
            
            $where['state']        =    '1';
            
            $urlarr['state']    =    '1';
            
        }elseif($_GET['state']=="2"){
            
            $where['state']        =    '2';
            
            $urlarr['state']    =    '2';
        }
        
        if(trim($_GET['keyword'])){
            
            $_GET['keyword']        =     trim($_GET['keyword']);
 
            if ($_GET['type']=='1'){
                
                $where['email']        =    array('like',$_GET['keyword']);
                
            }else if($_GET['type']=='2'){
 
                if($_GET['keyword']=='系统'){
 
                    $where['cuid']    =    0;
 
                }else{
                    $mwhere=array(
                        '1'=>array(
                            'name'        =>    array('like',$_GET['keyword']),
                            'limit'        =>    '50'
                        ),
                        '2'=>array(
                            'name'        =>    array('like',$_GET['keyword']),
                            'limit'        =>    '50'
                        ),
                        '3'=>array(
                            'realname'    =>    array('like',$_GET['keyword']),
                            'limit'        =>    '50'
                        ),
                        '4'=>array(
                            'name'        =>    array('like',$_GET['keyword']),
                            'limit'        =>    '50'
                        )
                    );
                    $userinfoM        =    $this        ->    MODEL('userinfo');
                    $muids            =    $userinfoM    ->    getUidsByWhere($mwhere);
                    $where['PHPYUNBTWSTART_A']  =   '';
                    $where['cuid'][] =   array('in',  pylode(',', $muids));
                    $where['cuid'][] =   array('<>', '0');
                    $where['PHPYUNBTWEND_A']    =   '';
                }
                
                 
            }else if($_GET['type']=='3'){
 
                if($_GET['keyword']=='系统'){
 
                    $where['uid']    =    0;
 
                }else{
                    $mwhere=array(
                        '1'=>array(
                            'name'        =>    array('like',$_GET['keyword']),
                            'limit'        =>    '50'
                        ),
                        '2'=>array(
                            'name'        =>    array('like',$_GET['keyword']),
                            'limit'        =>    '50'
                        ),
                        '3'=>array(
                            'realname'    =>    array('like',$_GET['keyword']),
                            'limit'        =>    '50'
                        ),
                        '4'=>array(
                            'name'        =>    array('like',$_GET['keyword']),
                            'limit'        =>    '50'
                        )
                    );
                    $userinfoM        =    $this        ->    MODEL('userinfo');
                    $muids            =    $userinfoM    ->    getUidsByWhere($mwhere);
                    $where['PHPYUNBTWSTART_A']  =   '';
                    $where['cuid'][] =   array('in',  pylode(',', $muids));
                    $where['cuid'][] =   array('<>', '0');
                    $where['PHPYUNBTWEND_A']    =   '';
                }
                
                 
            }else if($_GET['type']=='4'){
                
                $where['smtpserver']=    array('like',$_GET['keyword']);
                 
            }
            
            $urlarr['type']            =    $_GET['type'];
            
            $urlarr['keyword']        =    $_GET['keyword'];
        }
        
        if(($_GET['date'])&&$_GET['time']<1){
            $times                    =    @explode('~',$_GET['date']);
            $where['ctime'][0]        =    array('>=',strtotime($times[0]." 00:00:00"));
            $where['ctime'][1]        =    array('<=',strtotime($times[1]." 23:59:59"));
            $urlarr['date']            =    $_GET['date'];
        }
        
        if($_GET['time']){
            
            if($_GET['time']=='1'){
                
                $where['ctime'][2]        =    array('>=',strtotime(date("Y-m-d 00:00:00")));
                
            }else{
                
                $where['ctime'][3]        =    array('>=',strtotime('-'.$_GET['time'].'day'));
            
            }
            unset($_GET['sdate']);
            
            unset($_GET['edate']); 
            
            $urlarr['time']    =    $_GET['time'];
        }
        
        if($_GET['order']=="asc"){
            
            $this->yunset("order","desc");
            
        }else{
            
            $this->yunset("order","asc");
            
        }
 
        //分页链接
        $urlarr            =   $_GET;
        $urlarr['page']    =    '{{page}}';
        $urlarr['c']    =    $_GET['c']; 
        $pageurl        =    Url($_GET['m'],$urlarr,'admin');
        
        //提取分页
        $pageM            =    $this  -> MODEL('page');
        $pages            =    $pageM -> pageList('email_msg',$where,$pageurl,$_GET['page']);
        
        //分页数大于0的情况下 执行列表查询
        if($pages['total'] > 0){
            
            //limit order 只有在列表查询时才需要
            
            if($_GET['order']){
            
                if($_GET['order']=="desc"){
                    
                    $where['orderby']    =    $_GET['t'].',desc';
                    
                }else{
                    
                    $where['orderby']    =    $_GET['t'].',asc';
                    
                }
                
            }else{
                
                $where['orderby']        =    'id,desc';
        
            }
            
            $where['limit']            =    $pages['limit'];
            
            $urlarr['order']        =    $_GET['order'];
                
            $urlarr['t']            =    $_GET['t'];
            
            $List    =    $msgM -> getEmsgList($where);
            
            $this->yunset("rows",$List['list']);
        }
        
        $search_list[]    =    array("param"=>"state","name"=>'发送状态',"value"=>array("1"=>"发送成功","2"=>"发送失败"));
        $lo_time        =    array('1'=>'今天','3'=>'最近三天','7'=>'最近七天','15'=>'最近半月','30'=>'最近一个月'); 
        $search_list[]    =    array("param"=>"time","name"=>'发送时间',"value"=>$lo_time);
        
        $this->yunset("search_list",$search_list);
        $this->yunset("get_type", $_GET);
        $this->yuntpl(array('admin/admin_emailmsg'));
    }
    
    function del_action(){ 
        
        $msgM    =    $this->MODEL('email');
        
        if(is_array($_POST['del'])){
            
            $where['id']    =    array('in',pylode(',',$_POST['del']));
            
            $del            =    $msgM->delEmailMsg($where,array('type'=>'all'));
            
            $layer_type        =    1;
            
            $delid            =    pylode(',',$_POST['del']);
            
        }else{
            
            $this->check_token();
            
            $where['id']    =    (int)$_GET['id'];
            
            $del            =    $msgM->delEmailMsg($where,array('type'=>'one'));
            
            $layer_type        =    0;
            
            $delid            =    (int)$_GET['id'];
        }
    
        if(!$delid){
            
            $this->layer_msg('请选择要删除的内容!',8);
        
        }
        $del?$this->layer_msg('邮件记录(ID:'.$delid.')删除成功!',9,$layer_type,$_SERVER['HTTP_REFERER']):$this->layer_msg('删除失败!',8,$layer_type,$_SERVER['HTTP_REFERER']);
    }
 
    //失败邮件重发
    function repeat_action()
    {
 
        if ($_POST['id']) {
 
            $emailM =   $this->MODEL('email');
            $msg    =   $emailM->repeat($_POST['id']);
            echo $msg;
        } else {
            echo "请选择需要重发的邮件!";
        }
    }
 
}
 
?>