chengkun
2025-05-20 4c1f0f659384d71ce28be1fc0343e56e75568fe1
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<?php
 
class admin_domain_controller extends adminCommon{
    function index_action(){
        $this->yunset('config',$this->config);
        
        $this->yuntpl(array('admin/admin_domain_config'));
    }
    function savecf_action(){
         if($_POST['config']){
            unset($_POST['config']);
            $_POST  =  $this->post_trim($_POST);
            // 处理默认域名,防止未携带http头
            if (!empty($_POST['sy_indexdomain'])){
                
                if (stripos($_POST['sy_indexdomain'], 'http') === false){
                    
                    if (stripos($this->config['sy_weburl'], 'https://') !== false){
                        $protocol = 'https://';
                    }else{
                        $protocol = 'http://';
                    }
                    $_POST['sy_indexdomain']  =  $protocol.$_POST['sy_indexdomain'];
                }
            }
            
            $this -> MODEL('config') -> setConfig($_POST);
            
            $this->web_config();
            
            $this->layer_msg('网站配置设置成功!',9,1);
         }
    }
    function alllist_action(){
        //查询
        $this->yunset($this -> MODEL('cache') -> GetCache(array('city','hy')));
        
        $siteM            =    $this -> MODEL('site');
        
        $urlarr['c']    =    $_GET['c'];
        $urlarr            =   $_GET;
        $urlarr['page']    =    '{{page}}';
        
        $pageurl        =    Url($_GET['m'],$urlarr,'admin');
        
        $pageM            =    $this  -> MODEL('page');
        
        $pages            =    $pageM -> pageList('domain',array(),$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']    =    'id';
            }
            
            $where['limit']    =    $pages['limit'];
        
            $List            =    $siteM -> getList($where);
            
        }
        
        $this->yunset('domain',$List);
        
        $this->yuntpl(array('admin/admin_domain'));
    }
    function AddDomain_action(){
        
        $this->yunset($this->MODEL('cache')->GetCache(array('city','hy')));
        
        include_once('model/model/style_class.php');//引用操作文件
        
        $style    =    new style($this->obj);
        
        $list    =    $style->model_list_action();
        
        $this->yunset('list',$list);
        
        $this->yuntpl(array('admin/admin_adddomain'));
    }
    function save_action(){
        $siteM    =    $this->MODEL('site');
        
        if ($this->config['sy_web_site']!=1){
            $this->layer_msg('请先开启分站!',8,1);
        }
        if($_POST['domain']){$domain = @str_replace(array('http://','https://'),'',$_POST['domain']);}
        if($_POST['fz_type']=='1'){//如果是地区分站,行业类别为空
            $_POST['hy']='';
        }else{                //如果是地区分站,行业类别为空
            $_POST['provinceid']='';
            $_POST['cityid']='';
            $_POST['three_cityid']='';
        }
        if ($_FILES['file']['tmp_name']!=''){
            
            $upArr    =  array(
                'file'  =>  $_FILES['file'],
                'dir'   =>  'logo'
            );
            
            $uploadM  =  $this->MODEL('upload');
            
            $pic      =  $uploadM->newUpload($upArr);
            if (!empty($pic['msg'])){
                
                $this->ACT_layer_msg($pic['msg'],8);
                
            }elseif (!empty($pic['picurl'])){
                
                $_POST['weblogo']  =  $pic['picurl'];
            }
        }
 
        if($_POST['id']){
            if(($domain!='' || $_POST['indexdir']!='') && $_POST['title']!='' ){
                
                $whereData['id'] = array('<>',$_POST['id']);
 
                $whereData['PHPYUNBTWSTART1']  =  'AND';
                if($domain!=''){
                    
                    $whereData['domain']             =  array('=',$domain);
                    if($_POST['indexdir']!=''){
                    
                        $whereData['indexdir']       =  array('=',$_POST['indexdir'],'OR');
                        
                    }
                }else{
                
                    $whereData['indexdir']           =  array('=',$_POST['indexdir']);
                }
                $whereData['PHPYUNBTWEND1']    =  '';
 
                $domain_list    =    $siteM -> getInfo($whereData);
                if(is_array($domain_list)){
                    $this->ACT_layer_msg('该域名已经被绑定!',8);
                }else{
                    
                    $siteM -> addInfo($_POST,array('id'=>$_POST['id']));
                    
                    $this->DomainArr();
                    
                    $this->ACT_layer_msg('分站(ID:'.$_POST['id'].')修改成功!',9,'index.php?m=admin_domain&c=alllist',2,1);
                }
            }else{
                $this->ACT_layer_msg('信息填写不完整!',8);
            }
        }else{
            
            if(($domain!='' || $_POST['indexdir']!='')  && $_POST['title']!='' ){
 
                if($domain!=''){
                    
                    $whereData['domain']             =  array('=',$domain);
                    if($_POST['indexdir']!=''){
                    
                        $whereData['indexdir']             =  array('=',$_POST['indexdir'],'OR');
                        
                    }
                }else{
                
                    $whereData['indexdir']             =  array('=',$_POST['indexdir']);
                }
 
                
 
                $domain_list = $siteM -> getInfo($whereData);
                if(is_array($domain_list)){
                    $this->ACT_layer_msg('该域名已经被绑定!',8);
                }else{
                    
                    $id    =    $siteM -> addInfo($_POST);
                    
                    $this->DomainArr();
                    
                    $this->ACT_layer_msg('分站(ID'.$id.')创建成功!',9,'index.php?m=admin_domain&c=alllist',2,1);
                }
            }else{
                $this->ACT_layer_msg('信息填写不完整!',8);
            }
        }
    }
 
    function Modify_action(){
        if($_GET['siteid']){
            $this->yunset($this->MODEL('cache')->GetCache(array('city','hy')));
            
            include_once('model/model/style_class.php');//引用操作文件
            
            $style    =    new style($this->obj);
            
            $list    =    $style->model_list_action();
            
            $this->yunset('list',$list);
            
            $site    =    $this -> MODEL('site') -> getInfo(array('id'=>$_GET['siteid']));
            
            $this->yunset('site',$site);
        }
        $this->yuntpl(array('admin/admin_adddomain'));
    }
    function AjaxCity_action(){
        if($_GET['keyid']){
            
            $city=$this->MODEL('category')->getCityClassList(array('keyid'=>$_GET['keyid']));
            
            $html='';
            if(is_array($city)){
                
                foreach($city as $key=>$value){
                    
                    $html.='<option value="'.$value['id'].'">'.$value['name'].'</option>';
                }
            }
            echo $html;die;
        }
    }
    function DelDomain_action(){
        $this->check_token();
        if($_GET['delid']){
            
            $return    =    $this -> MODEL('site') -> delDomain($_GET['delid']);
            
            $this->DomainArr();
            
            $this->layer_msg($return['msg'],$return['errcode'],0,'index.php?m=admin_domain&c=alllist');
        }
    }
    function allDelDomain_action(){
        $this->check_token();
        if($_GET['del']){
            
            $del=$_GET['del'];
            
            if(is_array($del)){
                
                $return    =    $this -> MODEL('site') -> delDomain($del);
                
                 $this->layer_msg($return['msg'],$return['errcode'],1,$_SERVER['HTTP_REFERER']);
            }else{
                $this->layer_msg('请选择您要删除的分站!',8,1,$_SERVER['HTTP_REFERER']);
            }
        }
    }
    function DomainArr(){
        include(LIB_PATH.'cache.class.php');
        
        $cacheclass= new cache(PLUS_PATH,$this->obj);
        
        $makecache=$cacheclass->domain_cache('domain_cache.php');
    }
 
    function checkType_action(){
        if($_POST['id'] && $_POST['type']){
            
            $this -> MODEL('site') -> upInfo(array('type'=>$_POST['type']),array('id'=>$_POST['id']));
            
            $this->DomainArr();
        }
        echo 1;
    }
 
}
?>