chengkun
2025-05-23 0d8e263c22903234efea68fd13a27d8b7b59aac1
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
<?php
 
class advice_model extends model{
    
    /**
     * 获取意见反馈列表
     * $whereData     查询条件
     * $data         自定义处理数组
     */
     
    public function getList($whereData,$data=array()){
        
        $List        =    $this -> select_all('advice_question',$whereData);
 
        return    $List;
    }
    /**
     * 获取单条意见反馈
     * $whereData     查询条件
     * $data         自定义处理数组
     */
    function getInfo($whereData,$data=array()){
        
        $field  =    empty($data['field']) ? '*' : $data['field'];
        if (!empty($whereData)) {
            
            $List  =  $this -> select_once('advice_question',$whereData, $field);
            return $List;
        }
    }
    public function addInfo($data=array()){
        
        if($data['infotype']==''){
            return array('msg'=>'请选择意见类型','errcode'=>8);
        }elseif($data['username']==''){
            return array('msg'=>'请填写联系人姓名','errcode'=>8);
        }elseif($data['mobile']==''){
            return array('msg'=>'请填写联系手机','errcode'=>8);
        }elseif($data['content']==''){
            return array('msg'=>'请填写反馈内容','errcode'=>8);
        }
 
        require ('notice.model.php');
        $noticeM  =  new notice_model($this->db, $this->def);
 
        if($data['utype'] != 'wxapp' && $this->config['sy_advice_mobilecode']!=1){
 
            $result      =     $noticeM->jycheck($data['authcode'],'意见反馈');
 
            if(!empty($result)){
 
                return array('msg'=>$result['msg'],'errcode'=>'8');
 
            }
        }
        
 
        if($this->config['sy_msg_isopen'] && $this->config['sy_msg_login'] && $this->config['sy_advice_mobilecode']==1){    
 
            if($data['advice_code']==''){
 
                return array('msg'=>'请填写手机验证码','errcode'=>8);
 
            }else{
 
                $companywhere['check']        =        $data['mobile'];
                $companywhere['type']        =        2;
                $companywhere['orderby']    =        array('ctime,desc');
                
                include_once ('company.model.php');
                $CompanyM                    =        new company_model($this->db, $this->def);    
                $cert_arr                    =        $CompanyM->getCertInfo($companywhere);                    
                if (is_array($cert_arr)) {
                    $checkTime                 =         $noticeM->checkTime($cert_arr['ctime']);
                    if($checkTime){
                        $res                 =         $data['advice_code'] == $cert_arr['check2'] ? true : false;
                        if($res == false){
                            return array('msg'=>'短信验证码错误!','errcode'=>'8'); 
                        }                        
                    }else {        
                        return array('msg'=>'验证码验证超时,请重新点击发送验证码!','errcode'=>'8');             
                    }                    
                }else {        
                    return array('msg'=>'验证码发送不成功,请重新点击发送短信验证码!','errcode'=>'8');             
                }
            }
        }
        
        $arr        =    array(
            'username'    =>    $data['username'],
            'ctime'        =>    time(),
            'infotype'    =>    $data['infotype'],
            'content'    =>    $data['content'],
            'mobile'    =>    $data['mobile']
        );
        $nid        =    $this -> insert_into("advice_question",$arr);
        
        if($data['utype']=='pc'){
            $url    =    Url('advice');
        }
        if($data['utype']=='wap'){
            $url    =    Url('wap',array('c'=>'advice'));
        }
        if($nid){
            return array('msg'=>'提交成功,感谢你的反馈!','errcode'=>9,'url'=>$url);
        }else{
            return array('msg'=>'提交失败,请重新填写!','errcode'=>8,'url'=>$url);
        }
        
    }
    /**
     * 删除意见反馈
     * $whereData     查询条件
     */
    public function delInfo($delId)
    {
 
        $return['layertype']    =    0;
        
        if($delId){
        
            if(is_array($delId)){
                $delId    =    pylode(',', $delId);
 
                $return['layertype']    =    1;
            }
         
            $return['id']        =    $this->delete_all('advice_question',array('id'=>array('in',$delId)),"");
            
            $return['msg']        =    '意见反馈(ID:'.$delId.')';
            $return['errcode']    =    $return['id'] ? '9' :'8';
            $return['msg']        =    $return['id'] ? $return['msg'].'删除成功!' : $return['msg'].'删除失败!';
        }else{
            $return['msg']        =    '请选择您要删除的意见反馈';
            $return['errcode']    =    '8';
        }
        return $return;
    }
    
    public function statusInfo($data=array() , $whereData=array()){
        if(!empty($data)){
            $nid                          =    $this->update_once('advice_question',$data,$whereData);
            
            $return['msg']                =    '意见反馈(ID:'.$whereData['id'].')';
            $return['errcode']            =    $nid ? '9' :'8';
            $return['msg']                =    $nid ? $return['msg'].'处理成功!' : $return['msg'].'处理失败!';
        }else{
            $return['msg']              =    '请选择您要处理的意见反馈';
            $return['errcode']          =    '8';
        }
        return $return;
    }
}
?>