chengkun
2025-05-23 0d8e263c22903234efea68fd13a27d8b7b59aac1
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
<?php
 
class tiny_model extends model{
    
    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;
        }
    }
      /**
      * 查询全部信息
      * @param 表:resume_tiny
      * @param 功能说明:获取resume_tiny表里面所有普工信息
      * @param 引用字段:$whereData:条件  2:$data:查询字段
      *
     */
     public function getResumeTinyList($whereData,$data=array()){
       
        $time        =   time();
        $ListNew    =   array();  
       
        $field        =   $data['field'] ? $data['field'] : '*';
        $List        =   $this -> select_all('resume_tiny',$whereData,$field);
        
        if(!empty($List) && $List){
          
            $cache   =   $this -> getClass(array('user','city'));
            
            foreach($List as $k=>$v){
                if($v['exp']){
                    $List[$k]['exp_n']    =    $cache['userclass_name'][$v['exp']];
                }
                if($v['sex']){
                    $List[$k]['sex_n']    =      $cache['user_sex'][$v['sex']];
                }
                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['lastupdate']){
                    $ltime                =  $v['lastupdate'];
                    //今天开始时间戳
                    $beginToday            =  strtotime('today');
                    //昨天开始时间戳
                    $beginYesterday        =  strtotime('yesterday');
                    //一周内时间戳
                    if($ltime>$beginYesterday && $ltime<$beginToday){
 
                        $List[$k]['lastupdate_n']    =    "昨天";
 
                    }elseif($ltime>$beginToday){
 
                        $List[$k]['lastupdate_n']    =    lastupdateStyle($ltime);
 
                    }else{
 
                        $List[$k]['lastupdate_n']    =    date("Y-m-d",$ltime);
                    }
                }
            }
            $ListNew['list']  =   $List;
        }
       
        return $ListNew;
    }
    
     /**
      * 查询单条信息
      * @param 查询表:resume_tiny
      * @param 功能说明:根据条$id 获取once_job表里面 单条信息
      * @param 引用字段:$id :条件 2:$data:查询字段
      *
     */
    public function getResumeTinyInfo($where,$data=array()){
       
        $cache    =   $this -> getClass(array('user','city'));
        
        
        $select    =    $data['field'] ? $data['field'] : '*';
        $Info    =   $this -> select_once('resume_tiny', $where, $select);
        if($Info && is_array($Info)){
        
            $Info['exp_n']    =  $cache['userclass_name'][$Info['exp']];
            $Info['sex_n']    =  $cache['user_sex'][$Info['sex']];
            $Info['time_n']    =  date("Y-m-d",$Info['time']);
            $Info['lastupdate_n']    =  date("Y-m-d",$Info['lastupdate']);
 
            if($Info['provinceid']){
                $Info['city_n']    =      $cache['city_name'][$Info['provinceid']];
            }
            if($Info['cityid']){
                $Info['city_n'].=      '-'.$cache['city_name'][$Info['cityid']];
            }
            if($Info['three_cityid']){
                $Info['city_n'].=      '-'.$cache['city_name'][$Info['three_cityid']];
            }
        }
        
        return $Info;
    }
   /**
      * 审核信息
      * @param  表:resume_tiny
      * @param 功能说明:根据条件$id 审核resume_tiny表里面信息
      * @param 引用字段:$id :条件 2:$data['status']:审核状态
      *
     */
    public function setResumeTinyStatus($id,$data = array()){
        
        $where  = array();
 
        if(!empty($id)){
 
            $where['id']    =   array('in',pylode(',',$id));
            $updata          = array(
                'status' =>  $data['status'],
            );
            $nid               =   $this -> update_once('resume_tiny',$updata,$where);
            
            if($nid){
                include_once('log.model.php');
                $logM        =    new log_model($this->db, $this->def);
                $logM->addAdminLog("普工(ID:".pylode(',',$id).")审核成功");
            }
            return $nid;
        }
    }
  
    /**
      * 删除信息
      * @param  表:resume_tiny
      * @param 功能说明:根据条件$id 删除resume_tiny表里面信息
      * @param 引用字段:$id :条件 2:$data:字段
      *
     */
    
    public function delResumeTiny($id,$data=array()){
      
        if(!empty($id)){
            if(is_array($id)){
 
                $ids                    =    $id;    
                $return['layertype']    =    1;   
            }else{
 
                $ids                    =   @explode(',', $id);
                $return['layertype']    =    0;
            }
            $id               =   pylode(',', $ids);
 
            $return['id']    =    $this -> delete_all('resume_tiny',array('id' => array('in',$id)),'');
            
            if($return['id']){
 
                $return['msg']      =  '普工简历(ID:'.pylode(',',$id).')删除成功';
                $return['errcode']  =  '9';
            }else{
                
                $return['msg']      =  '普工简历(ID:'.pylode(',',$id).')删除失败';
                $return['errcode']  =  '8';
            }
        }else{
            
            $return['msg']          =  '系统繁忙';
            $return['errcode']      =  '8';
            $return['layertype']    =    0;
        }
 
        return $return;  
     
    }
    /**
      * 更新信息
      * @param  表:resume_tiny
      *
     */
    public function upResumeTiny($upData = array(),$whereData = array()){
    
        return $this -> update_once('resume_tiny',$upData,$whereData);
    }
     /**
      * 添加、更新信息
      * @param  表:resume_tiny
      * @param 功能说明:根据条件$id 修改resume_tiny表里面信息
      * @param 引用字段:$id :条件 2:$data:引用字段名称
      * @param  $data['password'] :密码是否修改
      *
     */
  
    public function addResumeTinyInfo($data = array(),$type =''){
        $post    =    $data['post'];
        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($post['cityid']==''){
                $citymsg = true;
            }
        }else{
            if($post['provinceid']==''){
                $citymsg = true;
            }
        }
        if($post['username']==''){
            return array('msg'=>'请填写姓名!','errcode'=>8);
        }
        if($post['sex']==''){
            return array('msg'=>'请填写性别!','errcode'=>8);
        }
        if($post['exp']==''){
            return array('msg'=>'请填写工作年限!','errcode'=>8);
        }
        if($citymsg){
            return array('msg'=>'请选择工作地区!','errcode'=>8);
        }
        if($post['job']==''){
            return array('msg'=>'请填写意向职位!','errcode'=>8);
        }
        if($post['mobile']==''){
            return array('msg'=>'请填写手机!','errcode'=>8);
        }
        if($post['production']==''){
            return array('msg'=>'请填写自我介绍!','errcode'=>8);
        }
 
        include_once ('notice.model.php');
        $noticeM        =        new notice_model($this->db, $this->def);
        //短信验证
        if ($this->config['sy_msg_isopen']==1) {
 
            if (isset($data['moblie_code']) && !empty($data['moblie_code'])) {
                $companywhere['check'] = $post['mobile'];
                $companywhere['type'] = 2;
                $companywhere['orderby'] = array('ctime,desc');
                include_once('company.model.php');
                $CompanyM = new company_model($this->db, $this->def);
                $cert_arr = $CompanyM->getCertInfo($companywhere);
                if (is_array($cert_arr)) {
                    $checkTime = $noticeM->checkTime($cert_arr['ctime']);
                    if ($checkTime) {
                        $res = $data['moblie_code'] == $cert_arr['check2'] ? true : false;
                        if ($res == false) {
                            return array('msg' => '短信验证码错误!', 'errcode' => '8');
                        }
                    } else {
                        return array('msg' => '验证码验证超时,请重新点击发送验证码!', 'errcode' => '8');
                    }
                } else {
                    return array('msg' => '验证码发送不成功,请重新点击发送短信验证码!', 'errcode' => '8');
                }
            }
        }else{
            if($type!='admin' && $type!='wxapp'){
                if ($this->config['code_kind'] ==1) {
                    $result = $noticeM->jycheck($_POST['authcode'], '店铺招聘');
 
                    if (!empty($result)) {
                        return array('msg' => $result['msg'], 'errcode' => 8);
                    }
                }
            }
        }
        if($post['password']){
            $post['password']    =    md5($post['password']);
        }else{
            unset($post['password']);
        }
        
        $id                        =    intval($data['id']);
        if(!empty($id)){
            
            if($type!='admin'){
                
                $arr            =    $this->getResumeTinyInfo(array('id'=>$id,'password'=>$post['password']));
                
                if(empty($arr)){
                    return array('msg'=>'密码不正确','errcode'=>8);
                }
            }
        
            $nid                =   $this ->  update_once('resume_tiny',$post,array('id'=>$id));
            
            if($nid){
                if($this->config['user_wjl']=="0" && $type != 'admin'){
                    $msg="修改成功,等待审核!";
                    require_once('admin.model.php');
                    $adminM = new admin_model($this->db,$this->def);
                    $adminM->sendAdminMsg(array('first'=>'有新的普工简历《'.$post['username'].'》需要审核','type'=>20));
                }else{
                    $msg="修改成功!";
                }
                if($data['utype']=='wap'){
                    $return['url']=Url('wap',array('c'=>'tiny'));
                }else{
                    $return['url']=Url('tiny');
                }
                $return['msg']        =    $msg;
                $return['errcode']    =    9;
            }else{
 
                $return['msg']        =    '修改失败!';
                $return['errcode']    =    8;
            }
        }else{
            
            $s_time        =    strtotime(date('Y-m-d 00:00:00')); //今天开始时间
            $m_tiny        =    $this->getResumeTinyNum(array('login_ip'=>fun_ip_get(),'time'=>array('>',$s_time)));
            $m_tiny_total=    $this->getResumeTinyNum(array('time'=>array('>',$s_time)));
            if($this->config['sy_tiny_totalnum'] == 0 || ($this->config['sy_tiny_totalnum'] > $m_tiny_total)) {
                if ($this->config['sy_tiny'] > $m_tiny || $this->config['sy_tiny'] < 1) {
 
                    $nid = $this->insert_into('resume_tiny', $post);
 
                    if ($this->config['user_wjl'] == "0" && $type != 'admin') {
                        require_once('admin.model.php');
                        $adminM = new admin_model($this->db, $this->def);
                        $adminM->sendAdminMsg(array('first' => '有新的普工简历《'.$post['username'].'》需要审核', 'type' => 20));
                        $msg = "发布成功,等待审核!";
                    } else {
                        $msg = "发布成功!";
                    }
                    if ($nid) {
                        if ($data['utype'] == 'wap') {
                            $return['url'] = Url('wap', array('c' => 'tiny'));
                        } else {
                            $return['url'] = Url('tiny');
                        }
                        $return['msg']        =    $msg;
                        $return['errcode']    =    9;
                    } else {
                        $return['msg'] = '发布失败!';
                        $return['errcode'] = 8;
                    }
                } else {
                    $return['msg'] = '一天内只能发布' . $this->config['sy_tiny'] . '次!';
                    $return['errcode'] = 8;
                    if ($data['utype'] == 'wap') {
                        $return['url'] = Url('wap', array('c' => 'tiny'));
                    }
                }
            }else{
                $return['msg'] = '网站发布普工简历本日已到上限,如有急需,请联系网站客服!';
                $return['errcode'] = 8;
            }
        }
        return $return;
    }
    
    public function getResumeTinyNum($Where = array()){
        return $this->select_num('resume_tiny', $Where);
    }
    //管理信息:刷新、修改、删除
    public function setResumeTinyPassword($data = array()){
        
        session_start();
         
        if(!empty($data['code'])){
            if(md5(strtolower($data['code'])) != $_SESSION['authcode'] || empty($_SESSION['authcode'])){//验证码错误
                unset($_SESSION['authcode']);
                return array('msg'=>'验证码错误!','errcode'=>8,'type'=>1);
            }
        }
        
        $jobinfo    =    $this->getResumeTinyInfo(array('id'=>(int)$data['id'],'password'=>md5($data['password'])));
        if(!is_array($jobinfo) || empty($jobinfo)){
            return array('msg'=>'密码错误!','errcode'=>8,'type'=>2);
        }else{
            $_SESSION['tinypass'] = md5($data['password']);
        }
    
        if($data['type']==1){//刷新
            
            $this -> upResumeTiny(array('lastupdate'=>time()),array('id'=>(int)$jobinfo['id']));
            return array('msg'=>'刷新成功!','errcode'=>9,'type'=>3);
            
        }elseif($data['type']==3){//删除
            
            $this -> delResumeTiny((int)$jobinfo['id']);
            return array('msg'=>'删除成功!','errcode'=>9,'type'=>4);
            
        }else{//修改
            if($data['utype']=='pc'){
                $url    =    Url('tiny',array('c'=>'add','id'=>(int)$jobinfo['id']));
                return array('url'=>$url);
            }elseif($data['utype']=='wap'){
                $url    =    Url('wap',array('c'=>'tiny','a'=>'add','id'=>(int)$jobinfo['id']));
                return array('url'=>$url);
            }else{
                return array('msg'=>'密码正确!','errcode'=>9,'type'=>2);
            }
            
        }
    }
}
?>