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
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
<?php
 
class trainmessage_controller extends adminCommon{
    //时间区间
    public $timeSection    =    array(
        '1'        =>    '今天',
        '3'        =>    '最近三天',
        '7'        =>    '最近七天',
        '15'    =>    '最近半月',
        '30'    =>    '最近一个月'
    );
    /**
     * 设置高级搜索功能
     * 高级搜索参数
     */
    public function set_search(){
        $search_list[]    =    array(
            'param'        =>    'end',
            'name'        =>    '咨询时间',
            'value'        =>    $this -> timeSection
        );
        $this -> yunset('search_list', $search_list);
    }
    /**
     * 会员 - 培训 - 咨询留言
     * 2019-06-06 hjy
     */
    public function index_action(){
 
        $this->set_search();        
 
        $pxWhereData                        =    array();
 
        $endStr                                =    intval($_GET['end']);
        //咨询时间条件
        if(!empty($endStr)){
            if($endStr == 1){
                $pxWhereData['ctime']        =    array('>=', strtotime(date("Y-m-d")));
            }else{
                $pxWhereData['ctime']        =    array('>=', strtotime('-'.$endStr.'day'));
            }
        }
        $rtStr                                =    intval($_GET['r_time']);
        //回复时间条件
        if(!empty($rtStr)){
            if($rtStr == 1){
                $pxWhereData['reply_time']    =    array('>=', strtotime(date("Y-m-d")));
            }else{
                $pxWhereData['reply_time']    =    array('>=', strtotime('-'.$rtStr.'day'));
            }
        }
 
        $keywordStr                            =    trim($_GET['keyword']);
        $typeStr                            =    trim($_GET['type']);
 
        //咨询内容条件
        if(!empty($keywordStr) && $typeStr == 3){
            $pxWhereData['content']            =    array('like', $keywordStr);
        }
        
        //回复内容条件
        if(!empty($keywordStr) && $typeStr == 4){
            $pxWhereData['reply']            =    array('like', $keywordStr);
        }
 
        //咨询人条件
        $resumeM                            =    $this -> MODEL('resume');
        $userId                                =    array();
        if(!empty($keywordStr) && $typeStr == 1){
            $reWhere                        =    array('name' => array('like', $keywordStr));
            $member                            =    $resumeM -> getResumeList($reWhere, array('field' => '`uid`,`name`'));
            if(!empty($member)){
                foreach($member as $v){
                    $userId[]                =    $v['uid'];
                }
            }else{
                $userId                        =    array(0);
            }
        }
        if(!empty($userId)){
            $pxWhereData['uid']                =    array('in', pylode(',', $userId));
        }
 
        $urlarr                             =    $_GET;
        $urlarr['page']                        =    "{{page}}";
        $pageurl                            =    Url($_GET['m'], $urlarr, 'admin');
        //提取分页
        $pageM                                =    $this  -> MODEL('page');
        $pxM                                =    $this  -> MODEL('train');
        $pages                                =    $pageM -> pageList('px_zixun', $pxWhereData, $pageurl, $_GET['page']);
        //分页数大于0的情况下 执行列表查询
        $List                                =    array();
        if($pages['total'] > 0){
            //limit order 只有在列表查询时才需要
            if(!empty($_GET['order']) && !empty($_GET['t'])){
                $pxWhereData['orderby']        =    $_GET['t'].','.$_GET['order'];
            }else{
                $pxWhereData['orderby']        =    'id';
            }
 
            $pxWhereData['limit']            =    $pages['limit'];        
            $List                            =    $pxM -> getPxzxList($pxWhereData);
        }
 
        if(!empty($List)){
            $pxuid    =    $comuid                =    array();
            foreach($List as $lv){
                $pxuid[]                     =    $lv['s_uid'];
                $comuid[]                    =    $lv['uid'];
            }            
            //补充培训用户相关的信息
            $bcWhereData                    =    array('uid' => array('in', pylode(',', $pxuid)));
            $pxField                        =    '`uid`, `name`';
            $pxList                            =    $pxM -> getList($bcWhereData, array('field' => $pxField));
            $pxListIndex                    =    array();
            if(!empty($pxList)){
                foreach ($pxList as $pxV) {
                    $pxListIndex[$pxV['uid']]    =    $pxV;
                }
            }
            //补充个人用户相关的信息
            $reWhereData                    =    array('uid' => array('in', pylode(',', $comuid)));
            $reList                            =    $resumeM -> getResumeList($reWhereData, array('field' => '`uid`, `name`'));
            $reListIndex                    =    array();
            if(!empty($reList)){
                foreach ($reList as $reV) {
                    $reListIndex[$reV['uid']]    =    $reV;
                }
            }
            //补充企业用户相关的信息
            $comM                                =    $this -> MODEL('company');
            $comList                            =    $comM -> getList($reWhereData, array('field' => '`uid`, `name`'));
            $comListIndex                        =    array();
            if(!empty($comList)){
                foreach ($comList['list'] as $comV) {
                    $comListIndex[$comV['uid']]    =    $comV;
                }
            }
            //补充猎头用户相关的信息
            $ltM                                =    $this -> MODEL('lietou');
            $ltList                                =    $ltM -> getList($reWhereData, array('field' => '`uid`, `realname`'));
            $ltListIndex                        =    array();
            if(!empty($ltList)){
                foreach ($ltList as $ltV) {
                    $ltListIndex[$ltV['uid']]    =    $ltV;
                }
            }
            //补充进相关信息
            foreach($List as $Lk => $Lv){
                $List[$Lk]['content']         =    str_replace('"', "", $Lv['content']);
                $List[$Lk]['reply']         =    str_replace('"', "", $Lv['reply']);
                if(isset($pxListIndex[$Lv['s_uid']])){
                    $List[$Lk]['pxname']    =    $pxListIndex[$Lv['s_uid']]['name'];
                }
                if(isset($reListIndex[$Lv['uid']])&&$Lv['usertype']==1){
                    $List[$Lk]['zname']        =    $reListIndex[$Lv['uid']]['username_n'];
                }
                if(isset($comListIndex[$Lv['uid']])&&$Lv['usertype']==2){
                    $List[$Lk]['zname']        =    $comListIndex[$Lv['uid']]['name'];
                }
                if(isset($ltListIndex[$Lv['uid']])&&$Lv['usertype']==3){
                    $List[$Lk]['zname']        =    $ltListIndex[$Lv['uid']]['realname'];
                }
            }
        }
        $this -> yunset('get_type', $_GET);
        $this -> yunset('mes_list', $List);
        $this -> yuntpl(array('admin/admin_trainmessage'));
    }
    /**
     * 会员 - 培训 - 咨询留言
     * 删除咨询留言
     * 2019-06-06 hjy
     */
    function del_action(){
        $this -> check_token();
        $del            =    $_GET['del'];
        if(!empty($del) && is_array($del)){
 
            $linkid        =    $del;
        }else{
            
            $linkid        =    $_GET['id'];
        }
        $pxM            =    $this  -> MODEL('train');
        $return            =    $pxM -> delPxzx($linkid);
        $this->layer_msg($return['msg'],$return['errcode'],$return['layertype'],$_SERVER['HTTP_REFERER']);
    }
}
?>