chengkun
2025-05-26 4462855c0033970c39ac8d0da704b7dc41eabbfe
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
<?php
 
class msgconfig_controller extends adminCommon{
    function index_action(){
        $cacheM     =   $this->MODEL('cache');
        $options    =   array('city');
        
        $cache      =   $cacheM -> GetCache($options);
 
 
        $this       ->  yunset($cache);
        
        $this->yuntpl(array('admin/admin_msg_config'));
        
    }
    
    //保存
    function save_action(){
 
        $configM    =    $this->MODEL('config');
         if($_POST['config']){
            
            unset($_POST['config']);
            $configM->setConfig($_POST);
 
            $this->web_config();
            
            $this->ACT_layer_msg( "短信配置设置成功!",9,1,2,1);
        
        }
    }
    
    //短信模板列表
    function tpl_action(){
        
        $this->yuntpl(array('admin/admin_msg_tpl'));
        
    }
    
    //短信模板设置
    function settpl_action(){
        
        include(CONFIG_PATH."db.tpl.php");
        
        $this->yunset("arr_tpl",$arr_tpl);
        
        $templatesM    =    $this->MODEL("templates");
        
        if($_POST['config']){
            
            $configNum    =    $templatesM->getNum(array('name'=>trim($_POST['name'])));
                
            $content    =     str_replace("amp;nbsp;","nbsp;",$_POST['content']);
            
            if($configNum>0){
                
                $templatesM->upInfo(array('name'=>trim($_POST['name'])),array('content'=>$content,'title'=>trim($_POST['title'])));
                
            }else{
                
                $templatesM->addInfo(array('name'=>trim($_POST['name']),'content'=>$content,'title'=>trim($_POST['title'])));
            
            }
            
            $this->ACT_layer_msg( "短信模版配置设置成功!",9,$_SERVER['HTTP_REFERER'],2,1);
            
        }
        
        $row    =    $templatesM->getInfo(array('name'=>$_GET['name']));
        
        $this->yunset("row",$row);
        
        $this->yuntpl(array('admin/admin_settpl'));
        
    }
    
    function get_restnum_action(){
        
 
        $returnArr['msgnum'] = $returnArr['businessnum'] = 0;
        //短信检测
        
        $url        =    'https://u.phpyun.com/feature';
        $url        .=    '?appKey='.$this->config['sy_msg_appkey'].'&appSecret='.$this->config['sy_msg_appsecret'];
        
        if (extension_loaded('curl')){
            
            $return     =     CurlGet($url);
            
        }else if(function_exists('file_get_contents')){
            
            $return     =     file_get_contents($url);
            
        }
        
        if($return){
            $msgInfo = json_decode($return,true);
            if($msgInfo['code'] == '200'){
                $returnArr['msgnum'] = $msgInfo['num'];
            }
            unset($return);
        }
        //空号检测
        $url        =    'https://u.phpyun.com/feature';
        $url        .=    '?appKey='.$this->config['sy_kh_appkey'].'&appSecret='.$this->config['sy_kh_appsecret'];
        
        if (extension_loaded('curl')){
            
            $return     =     CurlGet($url);
            
        }else if(function_exists('file_get_contents')){
            
            $return     =     file_get_contents($url);
            
        }
        
        if($return){
            $msgInfo = json_decode($return,true);
            if($msgInfo['code'] == '200'){
                $returnArr['khnum'] = $msgInfo['num'];
            }
            unset($return);
        }
        //天眼查检测
        $url        =    'https://u.phpyun.com/feature';
        $url        .=    '?appKey='.$this->config['sy_tyc_appkey'].'&appSecret='.$this->config['sy_tyc_appsecret'];
        
        if (extension_loaded('curl')){
            
            $return     =     CurlGet($url);
            
        }else if(function_exists('file_get_contents')){
            
            $return     =     file_get_contents($url);
            
        }
        if($return){
            $msgInfo = json_decode($return,true);
            if($msgInfo['code'] == '200'){
                $returnArr['businessnum'] = $msgInfo['num'];
            }
        }
 
        
        echo json_encode($returnArr);die;
    }
 
 
    function get_restnums_action(){
        $user = trim($this->config['sy_msg_appkey']);
        $pass = trim($this->config['sy_msg_appsecret']);
        $url = 'http://api.smsbao.com/query';
        $url.= '?u='.$user.'&p='.md5($pass);
        if(function_exists('file_get_contents')){
            $file_contents = file_get_contents($url);
        }else{
            $ch = curl_init();
            $timeout = 5;
            curl_setopt ($ch, CURLOPT_URL, $url);
            curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            $file_contents = curl_exec($ch);
            curl_close($ch);
        }
        $result = explode(",", $file_contents);
        echo $result['1'];
 
    }
 
}
 
?>