chengkun
2025-04-30 6ab292fb7415be124651e312ec4f21c594568f17
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
<?php
 
class comtpl_controller extends company{
    //个性化模板列表
    function index_action() {
        $comM    =    $this -> MODEL('company');
        
        $tplM    =    $this -> MODEL('tpl');
        
        $statis    =    $this -> company_satic();
        
        $where['status']            =    '1' ;
        
        $where['PHPYUNBTWSTART_A']    =    '' ;
 
        $where['service_uid'][]        =    array('findin', $this->uid) ;
        
        $where['service_uid'][]        =    array('=', '0', 'OR') ;
        
        $where['PHPYUNBTWEND_A']    =    '' ;
        
        $where['orderby']            =    'id,desc' ;
        
        $list        =    $tplM -> getComtplList($where);
        
        $bannernum    =    $comM -> getBannerNum(array('uid'=>$this->uid));
        
        $this -> public_action();
        $this -> yunset("list", $list);
        if(!empty($statis['comtpl_all'])){
            $buytpl    =    @explode(",", $statis['comtpl_all']);
            foreach($buytpl as $key=>$val){
                $buytpl_arr[]    =    trim($val);
            }
            
        }else{
            $buytpl_arr    =    array();
        }
        $this -> yunset("buytpl", $buytpl_arr);
        $this -> yunset("bannernum", $bannernum);
        $this -> com_tpl('comtpl');
    }
    //个性化模板设置应用
    function settpl_action(){
        $IntegralM    =    $this -> MODEL('integral');
        
        $statisM    =    $this -> MODEL('statis');
        
        $logM        =    $this -> MODEL('log');
        
        $tplM        =    $this -> MODEL('tpl');
        
        $comM        =    $this -> MODEL('company');
        
        $bannernum    =    $comM -> getBannerNum(array('uid'=>$this->uid));
        
        if($_POST['savetpl']){
            
            $where    =   array();
            
            $where['status']            =    '1' ;
            
            $where['PHPYUNBTWSTART_A']    =    '' ;
 
            $where['service_uid'][]        =    array('findin', $this->uid) ;
            
            $where['service_uid'][]        =    array('=', '0', 'OR') ;
            
            $where['PHPYUNBTWEND_A']    =    '' ;
            
            $where['orderby']            =    'id,desc' ;
            
            $list    =    $tplM -> getComtplList($where);
            
            foreach($list as $v){
                
                $tplid[]=$v['id'];
                
            }
            
            $statis        =    $this -> company_satic();
            
            if(in_array($_POST['tpl'],$tplid)){
                
                $row    =    $tplM -> getComtpl(array('id'=>(int)$_POST['tpl']));
                
                if(strstr($statis['comtpl_all'],$row['url'])==false){
                    
                    if($row['type']==1){
                        
                        if($statis['integral']<$row['price']){
                            $this->ACT_layer_msg("您的".$this->config['integral_pricename']."不足,请先充值!",8,"index.php?c=pay");
                        }
                        
                        $nid        =    $IntegralM->company_invtal($this->uid,$this -> usertype, $row['price'],false,"购买企业模板",true,2,'integral',15);
                    }
                    else{
                        if($statis['integral']<$row['price']){
                            $this    ->    ACT_layer_msg("您的余额不够购买,请先充值!",8,"index.php?c=pay");
                        }
                        $nid        =    $IntegralM->company_invtal($this->uid,$this -> usertype, $row['price'],false,"购买企业模板",true,2,"integral",15);//积分操作记录
                    
                    }
                    if($statis['comtpl_all']==''){
                        $statisM->upInfo(array("comtpl_all"=>$row['url']),array("uid"=>$this->uid,'usertype'=>2));
                    }else{
                        $statisM->upInfo(array("comtpl_all"=>array('concat',$row['url'])),array("uid"=>$this->uid,'usertype'=>2));
                    }
                }
                
                $oid    =    $statisM->upInfo(array("comtpl"=>$row['url']),array("uid"=>$this->uid,'usertype'=>2));
                if($oid){
                    if($bannernum==0){
                        $this->ACT_layer_msg("设置成功!",9,"index.php?c=comtpl");
                    }else{
                        $this->ACT_layer_msg("恭喜您设置成功,您还可以上传横幅广告!",9,"index.php?c=comtpl");
                    }
                    $logM->addMemberLog($this->uid,$this->usertype,"设置企业模版",16,1);//会员日志
                }else{
                    $this->ACT_layer_msg("设置失败,请稍后再试!",8,$_SERVER['HTTP_REFERER']);
                }
            }else{
                 $this->ACT_layer_msg("请正确选择模版!",8,"index.php?c=comtpl");
            }
        }
    }
}
?>