chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
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
<?php
/* *
* $Author :PHPYUN开发团队
*
* 官网: http://www.phpyun.com
*
* 版权所有 2009-2021 宿迁鑫潮信息技术有限公司,并保留所有权利。
*
* 软件声明:未经授权前提下,不得用于商业运营、二次开发以及任何形式的再次发布。
*/
class message_controller extends train
{
    function index_action(){
 
        $TrainM        =    $this->MODEL('train');
        $UserinfoM    =    $this->MODEL('userinfo');
        
        $where['s_uid']    =    $this->uid;
        
        if($_GET['status']){
            $status                =    intval($_GET['status']);
            $where['status']    =    $status;
            $urlarr['status']    =    $status;
        }        
        $urlarr['c']        =    "message";
        $urlarr['page']        =    "{{page}}";
        $pageurl            =    Url('member',$urlarr);
        $pageM                =    $this  -> MODEL('page');
        $pages                =    $pageM -> pageList('px_zixun',$where,$pageurl,$_GET['page']);
    
        $where['limit']        =    $pages['limit'];
        $where['orderby']    =    array('id,desc');
        $rows                =    $TrainM->getPxzxList($where);
 
        if(is_array($rows)){
 
            foreach($rows as $v){
 
                $uids[]        =    $v['uid'];
            }
            $mwhere['uid']    =    array('in', pylode(',', $uids));
            $minfo            =    $UserinfoM->getList($mwhere,array('field'=>'uid,username'));        
            foreach($rows as $k=>$v){
 
                foreach($minfo as $val){
 
                    if($v['uid']==$val['uid']){
 
                        $rows[$k]['nickname']     =            $val['username'];
                    }
                }
            }
        }
        $this->yunset("rows",$rows);
        $this->train_satic();
        $this->train_tpl('message');
    }
    function reply_action(){
 
        $TrainM    =    $this->MODEL('train');
        $LogM    =    $this->MODEL('log');
 
        $id        =    (int)$_POST['id'];
        
        if($_GET['reply']){
            
            if(trim($_POST['content'])==""){
            
                $this->ACT_layer_msg("回复内容不能为空!",8);
            }
            $where['id']    =    $id;
            $where['s_uid']    =    $this->uid;
            $data    =    array(
                'reply'            =>    trim($_POST['content']),
                'reply_time'    =>    time(),
                'status'        =>    2
            );
            $nid    =    $TrainM->upPxzixun($where,$data);
            
            if($nid){
                $LogM->addMemberLog($this->uid,$this->usertype,"回复咨询留言",18,1);
                $this->ACT_layer_msg("回复成功!",9,$_SERVER['HTTP_REFERER']);
            }else{
                $this->ACT_layer_msg("回复失败!",8,$_SERVER['HTTP_REFERER']);
                
            }
        }
    }
    function del_action(){
 
        $TrainM        =    $this->MODEL('train');
        $id            =    (int)$_GET['del'];
        if($id){
            
            $return    =    $TrainM -> delPxzx($id,array('uid'=>$this->uid,'usertype'=>$this->usertype));
            $this->layer_msg($return['msg'],$return['errcode'],$return['layertype']);
        }
    }
}
?>