chengkun
2025-04-27 a0402d122fee696e2b7684ef7edfc504ade12640
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
<?php
 
class data_model extends model{
    
    /*
     * 获取数据调用列表
     * $whereData     查询条件
     * $data         自定义处理数组
     */
     
    function getList($whereData,$data=array()){
        $ListNew    =    array();
        $List        =    $this -> select_all('outside',$whereData);
        
        if(!empty( $List )){
            
            $ListNew['list']    =    $List;
        }
 
        return    $ListNew;
    }
    
    /*
    * 获取数据调用详情
    * $whereData     查询条件
    * $data         自定义处理数组
    *
    */
    
 
    function getInfo($whereData, $data = array()){
        
        if($whereData){
            $data['field']  =    empty($data['field']) ? '*' : $data['field'];
        
            $List    =    $this -> select_once('outside',$whereData,$data['field']);
        }
 
        return $List;
    
    }
 
    /*
    * 创建数据调用
    * $postData        自定义处理数组
    *
    */
    
 
    function addInfo($postData){
 
        if(!empty($postData)){
            $data    =    array(
                'name'        =>    $postData['name'],
                'type'        =>    $postData['type'],
                'byorder'    =>    $postData['byorder'],
                'code'        =>    $postData['code'],
                'num'        =>    $postData['num'],
                'titlelen'    =>    $postData['titlelen'],
                'infolen'    =>    $postData['infolen'],
                'edittime'    =>    $postData['edittime'],
                'urltype'    =>    $postData['urltype'],
                'timetype'    =>    $postData['timetype'],
                'where'        =>    $postData['where']
            );
            
            $return['id']        =    $this -> insert_into('outside',$data);
            
            $return['msg']        =    '数据调用(ID:'.$return['id'].')';
            
            $return['errcode']    =    $return['id'] ? '9' :'8';
            
            $return['msg']        =    $return['id'] ? $return['msg'].'添加成功!' : $return['msg'].'添加失败!';
            
            return $return;
        }
    
    }
 
    /*
    * 更新数据调用
    * $whereData     查询条件
    * $data         自定义处理数组
    *
    */
 
    function upInfo($postData = array(),$whereData){
 
        if(!empty($whereData)){
            
            $data    =    array(
                'name'        =>    $postData['name'],
                'type'        =>    $postData['type'],
                'byorder'    =>    $postData['byorder'],
                'code'        =>    $postData['code'],
                'num'        =>    $postData['num'],
                'titlelen'    =>    $postData['titlelen'],
                'infolen'    =>    $postData['infolen'],
                'edittime'    =>    $postData['edittime'],
                'urltype'    =>    $postData['urltype'],
                'timetype'    =>    $postData['timetype'],
                'where'        =>    $postData['where']
            );
            $return['id']        =    $this -> update_once('outside',$data,$whereData);
            
            $return['msg']        =    '数据调用(ID:'.$return['id'].')';
            
            $return['errcode']    =    $return['id'] ? '9' :'8';
            
            $return['msg']        =    $return['id'] ? $return['msg'].'修改成功!' : $return['msg'].'修改成功!';
            
            return $return;
            
        }
    
    }
 
    /*
    * 删除数据调用
    * $whereData     查询条件
    *
    */
    function delData($delId)
    {
    
        if($delId)
        {
            if(is_array($delId))
            {
                $delId    =    pylode(',',$delId);
 
                $return['layertype']    =    1;
            }else{
                $return['layertype']    =    0;
            }
            $return['id']        =    $this -> delete_all('outside',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;
    }
    
    
}