chengkun
2025-04-27 ecc546d7df6ad021bfbc531674b10c2ffd224637
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
<?php
 
 
class hotkey_model extends model
{
 
    /**
     * 引用log类,添加用户日志
     */
    private function addAdminLog($content, $opera = '', $type = '', $opera_id = '')
    {
        require_once ('log.model.php');
 
        $LogM = new log_model($this->db, $this->def);
 
        return $LogM->addAdminLog($content, $opera = '', $type = '', $opera_id = '');
    }
 
    function getHotkeyOne($Where = array(), $data = array())
    {
        $field = $data['field'] ? $data['field'] : '*';
 
        $info = $this->select_once('hot_key', $Where, $field);
        return $info;
    }
 
    function upHotkey($Where = array(), $data = array())
    {
        $nid = $this->update_once('hot_key', $data, $Where);
 
        return $nid;
    }
 
    function getList($whereData, $data = array())
    {
        $field  =  !empty($data['field']) ? $data['field'] : '*';
        $List = $this->select_all('hot_key', $whereData, $field);
 
        return $List;
    }
 
    function addInfo($setData)
    {
        $nid = $this->insert_into('hot_key', $setData);
        
        return $nid;
    }
 
    public function delHotkey($whereData = array())
    {
        
        $return =   array('layertype' => 0);
        
        if (! empty($whereData)) {
        
            if (! empty($whereData['id']) && $whereData['id'][0] == 'in') {
            
                $return['layertype']    =   1;
            }
            $return['id']       =   $this->delete_all('hot_key', $whereData, '');
 
            $return['msg']      =   '关键字';
            $return['errcode']  =   $return['id'] ? '9' : '8';
            $return['msg']      =   $return['id'] ? $return['msg'] . '删除成功!' : $return['msg'] . '删除失败!';
        } else {
            
            $return['msg']      =   '请选择要删除的内容!';
            $return['errcode']  =   8;
        }
        
        return $return;
    }
 
    public function recupHotkey($setData = array())
    {
        if (! empty($setData)) {
            
            $type   =   $setData['type'];
            
            $nid    =   $this -> upHotkey(array('id' => $setData['id']), array($type => $setData['rec']));
            
            $row    =   $this -> getHotkeyOne(array('id' => $setData['id']));
            
            if ($type == "bold") {
            
                $this->addAdminLog("对关键字 " . $row['name'] . " 是否加粗进行设置");
            } elseif ($type == "tuijian") {
                
                $this->addAdminLog("对关键字 " . $row['name'] . " 是否推荐进行设置");
            } elseif ($type == "check") {
                
                $this->addAdminLog("对关键字 " . $row['name'] . " 是否审核进行设置");
            }
 
            return $nid;
        }
    }
}
?>