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
<?php
 
class entrust_model extends model{
    /**
     * @desc   引用log类,添加用户日志   
     */
    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); 
    }
    
    //获取简历信息列表resume_expect
    private function getResumeExpectList($whereData, $data = array()){
        
        require_once ('resume.model.php');
        
        $resumeM    =   new resume_model($this->db, $this->def);
        
        return  $resumeM   ->  getList($whereData , $data);
    }
    //获取简历信息列表resume
    private function getResumeList($whereData, $data = array()){
        
        require_once ('resume.model.php');
        
        $resumeM    =   new resume_model($this->db, $this->def);
        
        return  $resumeM   ->  getResumeList($whereData , $data);
    }
    
    /**
     * 获取委托来的人才列表
     * $whereData     查询条件
     * $data         自定义处理数组
     */
     
    public function getList($whereData,$data=array()){
        $field = $data['field'] ? $data['field'] : '*';
        
        $List  =   $this   ->  select_all('entrust',$whereData,$field);
        
        if(!empty( $List )){
            foreach ($List as $v){
                $uids[]     =   $v['uid'];
            }
            //  查询个人简历名称
            $reWhere['uid']               =  array('in', pylode(',', $uids));
            $reWhere['height_status']  =  2;
            $reData['field']           =  '`id`,`uid`,`name`,`job_classid`,`minsalary`,`maxsalary`,`height_status`,`edu`,`exp`,`hy`,`lastupdate`,`city_classid`,`sex`';
            
            $resumeexpectList          =  $this -> getResumeExpectList($reWhere, $reData);
            
            $expectuids  =  array();
            foreach ($resumeexpectList['list'] as $v){
                if ($v['uid'] && !in_array($v['uid'],$expectuids)) {
                    $expectuids[]  =  $v['uid'];
                }
            }
            
            //  查询个人姓名
            $rWhere['uid']              =   array('in', pylode(',', $uids));
            $rData['field']             =   '`uid`,`name`,`nametype`,`sex`,`def_job`';
            
            $resumeList                 =   $this -> getResumeList($rWhere, $rData);
            
            //简历不存在的情况,去掉委托来的记录
            foreach ($List  as  $k  =>  $v){
                if(!in_array($v['uid'], $expectuids)){
                    unset($List[$k]);
                }
            }
            
            foreach ($List  as  $k  =>  $v){
                foreach ($resumeList as $val){
                    
                    if ($v['uid']   ==  $val['uid']) {
                        $List[$k]['name'] = $val['name_n'];
                    }
                }
                foreach ($resumeexpectList['list'] as $rv){
                    
                    if ($v['uid']   ==  $rv['uid']) {
                        $List[$k]['eid']            =    $rv['id'];
                        $List[$k]['sex']            =    $rv['sex_n'];
                        $List[$k]['exp']            =    $rv['exp_n'];
                        $List[$k]['edu']            =    $rv['edu_n'];
                        $List[$k]['height_status']    =    $rv['height_status'];
                        $List[$k]['jobname']        =    $rv['job_classname'];
                        $List[$k]['hy']                =    $rv['hy_n'];
                        $List[$k]['cityname']        =    $rv['city_classname'];
                        $List[$k]['lastupdate']        =    $rv['lastupdate'];
                    }
                }
            }
        }
        return    $List;
    }
     /**
     * @desc    修改委托简历状态
     * @param   array $Where
     * @param   array $data
     * @return  $return
     */
    function upInfo($data = array(),$Where = array()){
        return $this->update_once('entrust', $data, $Where);
    }
    /**
     * 删除委托简历
     * $whereData     查询条件
     * $data         自定义处理数组
     */
    public function delInfo($id,$data){
        if (!empty($id)){
            if(is_array($id)){
                
                $ids                    =    $id;
                $return['layertype']    =    1;
            }else{
                
                $ids                    =   @explode(',', $id);
                $return['layertype']    =     0;
            }
            
            $id             =   pylode(',', $ids);
            
            
            if($data['utype'] == 'admin'){
                $delWhere    =    array('id'=>array('in',$id));
            }else{
                $delWhere    =    array('uid'=>$data['uid'],'id'=>array('in',$id));
            }
             
            $nid      =  $this->delete_all('entrust',$delWhere,'');
            
            if ($nid){
                
                $this -> addMemberLog($data['uid'],$data['usertype'],"删除委托的简历",6,3);
                
                $return['msg']      =  '删除成功';
                $return['errcode']  =  '9';
            }else{
                $return['msg']      =  '删除失败';
                $return['errcode']  =  '8';
            }
        }
        return $return;
    }    
    /**
     * @desc    获取委托详细信息
     */
    function getEntrustInfo($whereData,$data=array()){
        
        $field    =    empty($data['field']) ? '*' : $data['field'];
        
        $EntrustInfo     =    $this -> select_once('entrust', $whereData, $field);
        
        return $EntrustInfo;
        
    }
    /**
     * @desc    获取委托数目
     */
    function getEntrustNum($WhereData = array()){
        
        $Entrustnum    =    $this->select_num('entrust', $WhereData);
        
        return $Entrustnum;
    }
    function addEntrust($data=array()){
        
        if($data['usertype']!="1"){
            $return['msg']        =    '您不是个人用户,不能委托简历!';
            $return['errcode']    =    1;
        }else{
            
            $row    =    $this -> select_once("entrust",array('uid'=>$data['uid'],'lt_uid'=>$data['puid']));
            if(is_array($row)){
                $return['msg']        =    '您已经委托过简历给该猎头!';
                $return['errcode']    =    2;
            }else{
                $resume    =    $this -> select_once("resume_expect",array('uid'=>$data['uid'],'height_status'=>2));
                if(is_array($resume)){
                    
                    
                    $this -> insert_into("entrust",array('uid'=>$data['uid'],'lt_uid'=>$data['puid'],'datetime'=>time()));
                    
                    $this -> addMemberLog($data['uid'],$data['usertype'],"把优质简历 《".$resume['name']." 》委托给:".$_POST['name'],6,3);
                    $return['msg']        =    '委托简历成功!';
                    $return['errcode']    =    3;
                }else{
                    $return['msg']        =    '先完善简历,成为优质简历以后才可以申请猎头帮您招聘!';
                    $return['errcode']    =    4;
                }
            }
        }
        return $return;
    }
}
?>