chengkun
2025-05-23 a6f7b382623096b6a00924f418447cf5204e825e
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
<?php
 
 
class black_model extends model
{
    /**
     * @desc 引用log类,添加用户日志
     *
     * @param int $uid
     * @param int $usertype
     * @param string $content
     * @param string $opera
     * @param string $type
     * @return void
     */
    private function addMemberLog($uid, $usertype, $content, $opera = '', $type = '')
    {
 
        require_once('log.model.php');
        $LogM   =   new log_model($this->db, $this->def);
 
        return $LogM->addMemberLog($uid, $usertype, $content, $opera, $type);
    }
 
    /**
     * @desc 获取黑名单详细信息
     *
     * @param $where
     * @param array $data
     * @return array|bool|false|string|void
     */
    function getBlackInfo($where, $data = array())
    {
 
        $field  =   $data['field'] ? $data['field'] : '*';
        return $this->select_once('blacklist', $where, $field);
    }
 
    /**
     * @desc 获取屏蔽企业列表
     *
     * @param array $Where
     * @param array $data
     * @return array|bool|false|string|void
     */
    function getBlackList($Where = array(), $data = array())
    {
 
        $select =   $data['field'] ? $data['field'] : '*';
        $result = $this->select_all('blacklist', $Where, $select);
        if($result){
            foreach ($result as $k=>$v){
                $result[$k]['wapcom_url'] = Url('wap',array('c'=>'company','a'=>'show','id'=>$v['p_uid']));
            }
        }
        return $result;
    }
 
    /**
     * @desc 屏蔽企业数量
     *
     * @param array $Where
     * @return array|bool|false|string|void
     */
    function getBlackNum($Where = array())
    {
        return $this->select_num('blacklist', $Where);
    }
 
    /**
     * @desc 个人面试通知里的屏蔽企业
     *
     * @param array $data
     * @return array
     */
    public function addBlacklist($data = array())
    {
 
        if ($data['type'] == 'yqms') {  //个人面试通知里的屏蔽企业
 
            $id         =   $data['id'];
            $uid        =   intval($data['uid']);
            $usertype   =   intval($data['usertype']);
 
            include_once('job.model.php');
            $jobM       =   new job_model($this->db, $this->def);
            $info       =   $jobM->getYqmsInfo(array('id' => $id), array('field' => 'fid,fname'));
 
            $arr        =   array(
                'p_uid'     =>  $info['fid'],
                'inputtime' =>  time(),
                'c_uid'     =>  $uid,
                'usertype'  =>  1,
                'com_name'  =>  $info['fname']
            );
            $haves      =   $this->getBlackInfo(array('c_uid' => $uid, 'p_uid' => $info['fid'], 'usertype' => 1));
            if (is_array($haves)) {
 
                return array('msg' => '该用户已在您黑名单中!', 'errcode' => 8);
            } else {
 
                $nid    =   $this->insert_into('blacklist', $arr);
                $jobM->delYqms('', array('where' => array('uid' => $uid,'usertype'=>$usertype,'fid' => $info['fid'])));
 
                if ($nid) {
 
                    $this->addMemberLog($data['uid'], $data['usertype'], "屏蔽公司 <" . $info['fname'] . "> ,并删除邀请信息", 26, 3);
                    return array('msg' => '操作成功!', 'errcode' => 9);
                } else {
 
                    return array('msg' => '操作失败!', 'errcode' => 8);
                }
            }
        } elseif ($data['cuid']) {      //个人隐私里屏蔽企业
 
            $cuid   =   $data['cuid'];  //获取企业uid
            if (!empty($cuid)) {
                if (is_array($cuid)) {
 
                    $ids    =   $cuid;
                } else {
 
                    $ids    =   @explode(',', $cuid);
                }
 
                $id         =   pylode(',', $ids);
 
                require_once('company.model.php');
                $companyM   =   new company_model($this->db, $this->def);
                $company    =   $companyM->getList(array('uid' => array('in', $id)), array('field' => '`uid`,`name`'));
 
                foreach ($company['list'] as $v) {
                    $cdata  =   array(
 
                        'p_uid'     =>  $v['uid'],
                        'c_uid'     =>  $data['uid'],
                        'inputtime' =>  time(),
                        'usertype'  =>  1,
                        'com_name'  =>  $v['name']
                    );
                    $this->insert_into('blacklist', $cdata);
                }
 
                return array('msg' => '操作成功!', 'errcode' => 9, 'layertype' => 1);
            } else {
 
                return array('msg' => '请选择要屏蔽的公司!', 'errcode' => 8, 'layertype' => 1);
            }
        }
    }
 
    /**
     * @DESC 删除黑名单
     *
     * @param string $id 格式:单个,如1 ; 批量,如1,2,3
     * @param array $data
     * @return bool
     */
    function delBlackList($id = null, $data = array())
    {
 
        if (!empty($id) || !empty($data['where'])) {
 
            $where  =   array();
 
            if (!empty($id)) {
                if (is_array($id)) {
 
                    $ids    =   $id;
                    $return['layertype']    =   1;
                } else {
 
                    $ids    =   @explode(',', $id);
                    $return['layertype']    =   0;
                }
 
                $id             =   pylode(',', $ids);
                $where['id']    =   array('in', $id);
            }
 
            if ($data['where']) {
 
                $where      =   array_merge($where, $data['where']);
            }
            $return['id']   =   $this->delete_all('blacklist', $where, '');
 
            if ($data['uid']) {
                if ($data['type'] == 'all') {
 
                    $this->addMemberLog($data['uid'], $data['usertype'], '清空公司黑名单信息', 26, 3);
                } else {
 
                    $this->addMemberLog($data['uid'], $data['usertype'], '删除公司黑名单信息', 26, 3);
                }
            }
            $return['errcode']  =   $return['id'] ? '9' : '8';
            $return['msg']      =   $return['id'] ? '删除成功!' : '删除失败!';
        } elseif ($data['where']) {
 
            $where  =   $data['where'];
 
            $nid    =   $this->delete_all('blacklist', $where, '');
 
            return $nid;
        } else {
            $return['msg']          =   '请选择您要删除的数据!';
            $return['errcode']      =   8;
            $return['layertype']    =   0;
        }
 
        return $return;
    }
 
    /**
     * @desc
     * @param array $data
     * @return bool
     */
    public function addBlackone($data = array())
    {
 
        if (!empty($data)) {
 
            $nid = $this->insert_into("blacklist", $data);
        }
        return $nid;
    }
}
 
?>