chengkun
2025-05-26 8f3df543230cd4403368b39b9bbe5726d11a0284
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?php
 
class talent_model extends model{
    /**
     *  @desc   获取缓存数据
     */
    private function getClass($options){
        
        if (!empty($options)){
            
            include_once ('cache.model.php');
            
            $cacheM     =   new cache_model($this->db, $this->def);
            
            $cache      =   $cacheM -> GetCache($options);
            
            return $cache;
        }
    }
 
    /**
     * 获取lt_talent    列表
     * $whereData       查询条件
     * $data            自定义处理数组 scene 场景值,定制不同场景返回的数据
     */
    public function getList($whereData, $data = array()) {
        
        $List                            =    array();
        $data['field']                  =    empty($data['field']) ? '*' : $data['field'];
        $List                           =   $this -> select_all('lt_talent', $whereData, $data['field']);
        $cache                            =    $this -> getClass(array('user','industry','job','city'));
        if(!empty($List)){
            $uids   =   $ids    =   array();
            foreach($List as $v){
                $ids[]      =    $v['id'];
                if($v['uid'] && !in_array($v['uid'],$uids)){
                    $uids[] =    $v['uid'];
                }
            }
            include_once('userinfo.model.php');
            $memberM            =    new userinfo_model($this->db, $this->def);
            $mWhere['uid']        =    array('in', pylode(',', $uids));
            $mData['field']        =    '`username`, `uid`';
            $memberList            =     $memberM -> getList($mWhere,$mData);
            
            //获取推荐的eid
//            $eidSql                        =    'eid IN ('.pylode(',', $ids).')';
//            $eidSql                        .=    ' AND `status` NOT';
 
            $whereData                    =    array();
            $whereData['eid']            =    array('in', pylode(',', $ids));
            $whereData['status']        =    array('notin', '18, 19, 20, 21, 23, 26, 27, 28, 29');
            $rewardList                 =    $this -> select_all('company_job_rewardlist', $whereData,'`eid`');
            foreach($rewardList as $reV){
                $eids[]                 =    $reV['eid'];
            }
            
            foreach($List as $k => $v){
                foreach($memberList as $val){
                    if($v['uid']==$val['uid']){
                        $List[$k]['user']        =    $val['username'];
                    }
                }
                if(in_array($v['id'], $eids)){
                    $List[$k]['rewardstatus']    =    1;
                }
                if($v['linktel']){
                    $List[$k]['linktel']    =    $v['linktel'];
                }
                if($v['edu']){
                    $List[$k]['edu_n']        =  $cache['userclass_name'][$v['edu']];
                }
                if($v['exp']){
                    $List[$k]['exp_n']        =  $cache['userclass_name'][$v['exp']];
                }
                if($v['provinceid']){
                    $List[$k]['city_one']    =    $cache['city_name'][$v['provinceid']];
                }
                if($v['cityid']){
                    $List[$k]['city_two']    =    $cache['city_name'][$v['cityid']];
                }
                if($v['three_cityid']){
                    $List[$k]['city_three']    =    $cache['city_name'][$v['three_cityid']];
                }
                if ($v['minsalary'] || $v['maxsalary']) {
                     
                    if($v['minsalary'] && $v['maxsalary']){
                        
                        $List[$k]['salary']             =  $v['minsalary'].'-'.$v['maxsalary'];
                    }elseif ($v['minsalary']){
                        
                        $List[$k]['salary']             =  $v['minsalary'];
                    }elseif ($v['maxsalary']){
                        
                        $List[$k]['salary']             =  $v['maxsalary'];
                    }
                }else{
                    
                    $List[$k]['salary']             =  '面议';
                }
            }
        }
        return $List;    
    }
 
    /**
     * @desc 获取lt_talent    详情
     * $whereData       查询条件
     * $data            自定义处理数组 scene 场景值,定制不同场景返回的数据
     */
    public function getInfo($whereData, $data = array()) {
        $Info            =    array();
        $data['field']  =    empty($data['field']) ? '*' : $data['field'];
        $Info             =   $this -> select_once('lt_talent', $whereData, $data['field']);
        if(!empty($Info)){
            $cache                        =    $this -> getClass(array('user','hy','job','city'));
            if($Info['sex']){
                $Info['sex_n']            = $cache['user_sex'][$Info['sex']];
            }
            if($Info['hy']){
                $Info['hy_n']            = $cache['industry_name'][$Info['hy']];
            }
            if($Info['edu']){
                $Info['edu_n']        = $cache['userclass_name'][$Info['edu']];
            }
            if($Info['exp']){
                $Info['exp_n']         = $cache['userclass_name'][$Info['exp']];
            }
            if($Info['provinceid']){
                $Info['city_one_n']     = $cache['city_name'][$Info['provinceid']];
            }
            if($Info['provinceid']){
                $Info['city_one_n']     = $cache['city_name'][$Info['provinceid']];
            }
            if($Info['three_cityid']){
                $Info['city_three_n']     = $cache['city_name'][$Info['three_cityid']];
            }
            if($Info['jobstatus']){
                $Info['jobstatus_n']     = $cache['userclass_name'][$Info['jobstatus']];
            }
            if($Info['minsalary'] && $Info['maxsalary']){
            
                $Info['salary']      =   $Info['minsalary'].'-'.$Info['maxsalary'];
                
            }elseif($Info['minsalary']){
                
                $Info['salary']      =    $Info['minsalary'];
                
            }elseif($Info['maxsalary']){
                
                $Info['salary']      =    $Info['maxsalary'];
                
            }
            $Info['report']             =    '随时到岗';
            $Info['type']                 =    '全职';
        
            return $Info;
        }   
    }
    /**
     * 删除lt_talent    详情
     * $whereData       查询条件
     */
    public function delTalent($whereData) {
     
 
        $this -> delete_all('lt_talent', $whereData, '');
        //删除关联数据
        if(empty($whereData['id'])){
            $this -> delete_all("company_job_rewardlist", array('eid' => $whereData['id']), '');
            $this -> delete_all("company_job_rewardlog", array('eid' => $whereData['id']), '');
        }
        return true;    
    }
 
    
 
    function telStatus($id,$uid,$tel,$code){
        if($id && $tel){
            if(!CheckMobile($tel)){
                $error['msg'] = '手机号格式错误';
            }else{
                //查询当前号码是否被使用(仅考虑已被验证的情况)
                $telNum = $this->select_num('lt_talent',array('linktel'=>$tel,'telstatus'=>1));
                if($telNum>0){
                    $error['msg'] = '手机号已被授权!';
                }else{
                    $row=$this->select_once("company_cert",array('uid'=>$uid,'check'=>$tel,'type'=>2,'orderby'=>array('id,desc')),'check2');
                    if(!empty($row)){
                        if($row['check2']!=$code){
                            $error['msg'] = '手机验证码不正确';
                        }else{
                            //已被他人填写但是未验证的手机号清空 以最新验证的为准
                            $this->update_once("lt_talent",array('linktel'=>''),array('linktel'=>$tel));
                            //更新当前验证的手机号
                            $this->update_once("lt_talent",array('linktel'=>$tel,'telstatus'=>1),array('uid'=>$uid,'id'=>intval($id)));
                            $error['error'] = '1';
                            $error['msg'] = '验证成功';
                        }
                    }else{
                        $error['msg'] = '验证码错误';
                    }
                }
            }
        }else{
            $error['msg'] = '数据错误';
        }
        return $error;
    }
    function addTalent($data){
        if($data['id']){
            $info = $this->getInfo(array('id'=>intval($data['id']),'uid'=>$data['uid']),array('field'=>'`id`,`telstatus`'));
        }
        include_once ('cache.model.php');
        
        $cacheM     =   new cache_model($this->db, $this->def);
        
        $cache      =   $cacheM -> GetCache('city');
        $citymsg     =     false;
        if(!empty($cache['city_type'])){
            if(empty($data['cityid'])){
                $citymsg = true;
            }
        }else{
            if(empty($data['provinceid'])){
                $citymsg = true;
            }
        }
        $error['error'] = '0';
        //判断参数是否齐全
        if($data['id'] && empty($info)){
            $error['msg'] = '参数错误';
        }elseif(empty($data['name'])){
            $error['msg'] = '请填写姓名';
        }elseif(empty($data['sex'])){
            $error['msg'] = '请选择性别';
        }elseif(empty($data['age'])){
            $error['msg'] = '请填写年龄';
        }elseif(empty($data['edu'])){
            $error['msg'] = '请选择最高学历';
        }elseif(empty($data['exp'])){
            $error['msg'] = '请选择工作经验';
        }elseif(empty($data['minsalary'])){
            $error['msg'] = '请填写最低薪资需求';
        }elseif(!empty($data['maxsalary']) && $data['maxsalary']<=$data['minsalary']){
            $error['msg'] = '最高薪资必须大于最低薪资';
        }elseif($citymsg){
            $error['msg'] = '请选择期望城市';
        }
        elseif(empty($data['living'])){
            $error['msg'] = '请填写现居住地';
        }elseif(empty($data['jobname'])){
            $error['msg'] = '请填写意向岗位';
        }elseif(empty($data['hy'])){
            $error['msg'] = '请选择所属行业';
        }elseif(empty($data['jobstatus'])){
            $error['msg'] = '请选择当前求职状态';
        }elseif(empty($data['expinfo'])){
            $error['msg'] = '请填写相关工作经历';
        }elseif(empty($data['eduinfo'])){
            $error['msg'] = '请填写相关教育经历';
        }elseif(empty($data['jobstatus'])){
            $error['msg'] = '请选择当前求职状态';
        }else{
            if($info['telstatus']!='1'){
                if(empty($data['telphone'])){
                    $error['msg'] = '请输入求职者手机号';
                }elseif(!CheckMobile($data['telphone'])){
                    $error['msg'] = '手机号格式错误';
                }else{
                    //检查手机号是否重复
                    if($data['id']){
                        $where['id']    =    array('<>',intval($data['id']));
                    }
                    $where['linktel']    =    $data['telphone'];
                    $num                 =    $this->select_num('lt_talent',$where);
                    if($num>0){
                        $error['msg']     =    '相同简历已存在,手机号已被使用';
                    }
                }
            }
        }
        if(empty($error['msg'])){
            $fieldData['name']            = trim($data['name']);
            $fieldData['sex']            = intval($data['sex']);
            $fieldData['age']            = intval($data['age']);
            $fieldData['exp']             = intval($data['exp']);
            $fieldData['edu']             = intval($data['edu']);
            $fieldData['living']         = $data['living'];
            $fieldData['jobname']        = $data['jobname'];
            $fieldData['hy']             = intval($data['hy']);
            $fieldData['minsalary']     = intval($data['minsalary']);
            $fieldData['maxsalary']     = intval($data['maxsalary']);
            //多选城市
            $fieldData['provinceid']    = intval($data['provinceid']);
            $fieldData['cityid']         = intval($data['cityid']);
            $fieldData['three_cityid']    = intval($data['three_cityid']);
 
            $fieldData['jobstatus']        = $data['jobstatus'];
            if($info['telstatus']!='1'){
                $fieldData['linktel']    = $data['telphone'];
            }
            $fieldData['expinfo']         = $data['expinfo'];
            $fieldData['eduinfo']         = $data['eduinfo'];
            $fieldData['projectinfo']     = $data['projectinfo'];
            $fieldData['skillinfo']     = $data['skillinfo'];
            
            if($data['id']){
                $nid = $this->update_once('lt_talent',$fieldData,array('id'=>intval($data['id']),'uid'=>$data['uid']));
                $error['msg'] = $nid?'更新简历成功':'更新简历失败';
            }else{
                
                $fieldData['did']    =    $data['did'];
                $fieldData['uid']    =    $data['uid'];
                
                $nid = $this->insert_into('lt_talent',$fieldData);
                $error['msg'] = $nid?'添加简历成功':'添加简历失败';
            }
            if($nid){
                $error['error']='1';
            }
        }
        return $error;
    }
    
    function getTalentNum($whereData = array()){
        return $this -> select_num('lt_talent', $whereData);
    }
}
?>