chengkun
2025-05-20 f6f7bd25619ad0c0dfb5e609332e9fa1db419386
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
<?php
 
class integral_controller extends adminCommon{
    function index_action()
    {
        $this->yuntpl(array('admin/admin_integral_config'));
    }
    function user_action()
    {
        $this->yuntpl(array('admin/admin_integral_user'));
    }
    function com_action()
    {
        $this->yuntpl(array('admin/admin_integral_com'));
    }
    function lt_action()
    {
        $this->yuntpl(array('admin/admin_integral_lt'));
    }
    function train_action()
    {
        $this->yuntpl(array('admin/admin_integral_train'));
    }
 
    function save_action(){
 
        $configM    =   $this->   MODEL("config");
    
         if($_POST["config"]){
      
            unset($_POST["config"]);
      
            foreach($_POST as $key=>$v){
         
                $where['name']      =  $key;
         
                $config = $configM   ->getNum($where);
 
                if($config==false){
           
                    $data      =  array(
                
                        'name'    =>  $key,
                    
                        'config'  =>  $v,
                    );
          
                    $configM  ->  addInfo($data);
           
                }else{
           
                    $where['name']  =   $key;
                  
                    $data           =   array(
                
                        'config'        =>  $v
                
                    );
           
                    $configM  ->  upInfo($where,$data);
  
                }
            }
            
            $this->cache_action();
            $this->web_config();
            $this->ACT_layer_msg($this->config['integral_pricename']."配置修改成功!",9,1,2,1);
        }
    }
    function class_action(){
        $integralM        =    $this->MODEL('integral');
        
        $list            =    $integralM->getIntClass(array('id'=>array('>',0) , 'orderby'=>'integral,asc' ));
        
        $this->yunset("list",$list);
        $this->yuntpl(array('admin/admin_integral_class'));
    }
    //添加
    function add_action(){
        $integralM        =    $this->MODEL('integral');
        
        $_POST            =    $this->post_trim($_POST);
        
        
        $list            =    $integralM->getIntClass(array('integral'=>(int)$_POST['integral']));
        
        if(empty($list)){ 
        
            $data        =    array(
            
                'integral'    =>    (int)$_POST['integral'],
                
                'discount'    =>    $_POST['discount'],
                
                'state'        =>    (int)$_POST['state']
            
            );
            
            $add        =    $integralM->addIntClass($data);   
            
            $msg        =    $add    ?    2    :    3;
            
            $this->cache_action();
             
            $this->MODEL('log')->addAdminLog($this->config['integral_pricename']."类型(ID:".$add.")添加成功!");
        }else{
            
            $msg        =    1;
            
        }
        
        echo $msg;die;
    }
 
    //删除
    function del_action()
    {
        $integralM            =    $this->MODEL('integral');
        
        
        
        if((int)$_GET['delid'])
        {
            $this->check_token();
            
            $del            =    $_GET['delid'];
            
            $ids            =    $_GET['delid'];
            
            $type            =    2;
            
        }
        if($_POST['del'])//批量删除
        {
            $del            =    pylode(",",$_POST['del']);
            
            $ids            =    $_POST['del'];
            
            $type            =    1;
        }
 
        $id                    =    $integralM->delIntClass($ids);
        
        if($id)
        {
            $this->layer_msg('删除成功!',9,$type,$_SERVER['HTTP_REFERER']);
        }else{
            $this->layer_msg("删除失败!",8,$type,$_SERVER['HTTP_REFERER']);
        }
        
        $this->cache_action();
        
        $this->yuntpl(array('admin/admin_integral_class'));
    }
    
    function cache_action()
    {
        include(LIB_PATH."cache.class.php");
        $cacheclass        =     new cache(PLUS_PATH,$this->obj);
        $makecache        =    $cacheclass->integralclass_cache("integralclass.cache.php");
    }
    
    function ajax_action(){
        $integralM        =    $this->MODEL('integral');
        
        if((int)$_GET['id']&&$_GET['type']){
            
            $state        =    (int)$_GET['rec']==1 ? 1:2;
            
            $nid        =    $integralM->upIntClass(array('id' =>(int)$_GET['id']) , array($_GET['type']=>$state));
            
            $this->MODEL('log')->addAdminLog($this->config['integral_pricename']."类型(ID:".$_GET['id'].")修改状态!");
            
        }
        
        if($_POST['integral']){
            
            $integralclass        =    $integralM->getIntClass(array('integral'=>(int)$_POST['integral'] , 'id'=>array('<>',$_POST['id']) ));
        
            if($integralclass){
                
                echo 2;die;
                
            }
            
            $nid                =    $integralM->upIntClass(array('id' =>(int)$_POST['id']) , array('integral'=>$_POST['integral']));
            
            $this->MODEL('log')->addAdminLog($this->config['integral_pricename']."充值类型(ID:".$_POST['id'].")修改数量!");
        }
        
        if($_POST['discount']>=0){
 
            $nid                =    $integralM->upIntClass(array('id' =>(int)$_POST['id']) , array('discount'=>$_POST['discount']));
            
            $this->MODEL('log')->addAdminLog($this->config['integral_pricename']."充值类型(ID:".$_POST['id'].")修改折扣!");
        }
        
        $this->cache_action();
        
        echo $nid?1:0;
    }
}
 
?>