chengkun
2025-05-26 8f3df543230cd4403368b39b9bbe5726d11a0284
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
<?php
 
class admin_message_controller extends adminCommon{
    //设置高级搜索功能
    function set_search(){
        $search_list[]=array("param"=>"infotype","name"=>'意见类型',"value"=>array("1"=>"建议","2"=>"意见","3"=>"求助","4"=>"投诉"));
        
        $ad_time=array('1'=>'今天','3'=>'最近三天','7'=>'最近七天','15'=>'最近半月','30'=>'最近一个月');
        
        $status_arr=array('1'=>'未处理','2'=>'已处理');
        
        $search_list[]=array("param"=>"end","name"=>'意见时间',"value"=>$ad_time);
        
        $search_list[]=array("param"=>"status","name"=>'意见时间',"value"=>$status_arr);
        
        $this->yunset("search_list",$search_list);
    }
    function index_action(){
        $this->set_search();
        
        $adviceM=$this->MODEL('advice');
        
        if(trim($_GET['keyword'])){
            
            if($_GET["type"]==1){
                
                $where['username']    =    array('like',trim($_GET['keyword']));
            }else{
                
                $where['content']    =    array('like',trim($_GET['keyword']));
            }
            $urlarr['type']            =    $_GET['type'];
            
            $urlarr['keyword']        =    $_GET['keyword'];
        }
        if($_GET['end']){
            if($_GET['end']=='1'){
                
                $where['ctime']        =    array('>=',strtotime(date("Y-m-d 00:00:00")));
            }else{
                
                $where['ctime']        =    array('>=',strtotime('-'.$_GET['end'].'day'));
            }
            $urlarr['end']            =    $_GET['end'];
        }
        if($_GET['infotype']){
            
            $where['infotype']        =    $_GET['infotype'];
            
            $urlarr['infotype']        =    $_GET['infotype'];
        }
        if($_GET['status']){
            $where['status']        =    $_GET['status'];
            
            $urlarr['status']        =    $_GET['status'];
        }
        $urlarr            =   $_GET;
        $urlarr['page']    =    "{{page}}";
        
        $pageurl=Url($_GET['m'],$urlarr,'admin');
        
        $pageM            =    $this  -> MODEL('page');
        
        $pages            =    $pageM -> pageList('advice_question',$where,$pageurl,$_GET['page']);
        
        //分页数大于0的情况下 执行列表查询
        
        if($pages['total'] > 0){
            
            if($_GET['order'])
            {
                $where['orderby']    =    $_GET['t'].','.$_GET['order'];
                
                $urlarr['order']    =    $_GET['order'];
                
                $urlarr['t']        =    $_GET['t'];
            }else{
                
                $where['orderby']    =    'ctime,desc';
            }
            
            $where['limit']    =    $pages['limit'];
        
            $List        =    $adviceM -> getList($where);
            
        }
        
        $this->yunset('rows',$List);
        
        $this->yunset("get_type", $_GET);
        
        $this->yuntpl(array('admin/admin_message'));
    }
    function del_action(){
        if($_GET['del']){
            $this->check_token();
            
            $del=$_GET['del'];
            
            if($del){
                
                $return    =    $this -> MODEL('advice') -> delInfo($del);
                
                $this->layer_msg($return['msg'],$return['errcode'],$return['layertype'],$_SERVER['HTTP_REFERER']);
            }else{
                $this->layer_msg('非法操作!',8);
            }
        }
    }
    function content_action(){
        $con=$this -> MODEL('advice') -> getInfo(array('id'=>intval($_GET['id'])));
        
        if($con['infotype']==1){
            $con['type']='建议';
        }elseif($con['infotype']==2){
            $con['type']='意见';
        }elseif($con['infotype']==3){
            $con['type']='求助';
        }elseif($con['infotype']==4){
            $con['type']='投诉';
        }
        $con['name']=$con['username'];
        $con['ctime']=date('Y-m-d H:i:s',$con['ctime']);
        echo json_encode($con);die;
    }
    
    function handlecontent_action(){
        $adviceM    =    $this -> MODEL('advice');
        $row        =    $adviceM -> getInfo(array('id'=>$_GET['id']));
        echo trim($row['handlecontent']);die;
    }
    
    function status_action(){
        $adviceM    =    $this -> MODEL('advice');
        
        $post       =  array(
            'status'     =>  intval($_POST['status']),
            'handlecontent'  =>  trim($_POST['handlecontent'])
        );
        
        $return     =  $adviceM -> statusInfo($post,array('id'=>$_POST['mid']));
        
        $this->ACT_layer_msg($return['msg'],$return['errcode'],$_SERVER['HTTP_REFERER'],2,1);
    }
    
}