155 lines
5.2 KiB
PHP
155 lines
5.2 KiB
PHP
<?php
|
|
|
|
namespace app\admin\logic;
|
|
use think\Db;
|
|
use think\Exception;
|
|
|
|
class RecruitLogic
|
|
{
|
|
|
|
//招聘的岗位
|
|
public static function type($get){
|
|
$user_count = Db::name('recruitype')
|
|
->count();
|
|
$user_list = Db::name('recruitype')
|
|
->page($get['page'],$get['limit'])
|
|
->select();
|
|
foreach ($user_list as &$item){
|
|
$item['createtime']=date("Y-m-d H:i:s",$item['createtime']);
|
|
}
|
|
return ['count'=>$user_count , 'lists'=>$user_list];
|
|
|
|
}
|
|
|
|
public static function type_list(){
|
|
return Db::name('recruitype')->select();
|
|
}
|
|
|
|
public static function typeadd($get){
|
|
$now = time();
|
|
$get['createtime'] = $now;
|
|
return Db::name('recruitype')->insertGetId($get);
|
|
}
|
|
public static function typeedit($post){
|
|
return Db::name('recruitype')->where('id',$post['id'])->update(['zpname'=>$post['zpname'],'number'=>$post['number']]);
|
|
}
|
|
public static function typedel($id){
|
|
return Db::name('recruitype')->where('id',$id)->delete();
|
|
|
|
}
|
|
|
|
//员工薪资显示列表
|
|
public static function salary($get){
|
|
$count=Db::name('recrui_salary')->count();
|
|
$lists=Db::name('recrui_salary')
|
|
->page($get['page'],$get['limit'])
|
|
->select();
|
|
foreach ($lists as &$item){
|
|
$item['createtime']=date("Y-m-d H:i:s",$item['createtime']);
|
|
}
|
|
return ['count'=>$count , 'lists'=>$lists];
|
|
}
|
|
|
|
public static function salary_list(){
|
|
return Db::name('recrui_salary')->select();
|
|
}
|
|
|
|
public static function add($post){
|
|
$post['createtime']=time();
|
|
return Db::name('recrui')->data($post)->insert();
|
|
}
|
|
|
|
public static function lists($get){
|
|
$where = [];
|
|
if(isset($get['sex']) && $get['sex'] != ''){
|
|
$where[] = ['sex','=',$get['sex']];
|
|
}
|
|
if(isset($get['onwork']) && $get['onwork'] != ''){
|
|
$where[] = ['onwork','=',$get['onwork']];
|
|
}
|
|
if(isset($get['group_id']) && $get['group_id']){
|
|
$where[] = ['group_id','=',$get['group_id']];
|
|
}
|
|
|
|
//创建时间查询
|
|
if(isset($get['start_time']) && $get['start_time']!=''){
|
|
$where[] = ['createtime','>=',strtotime($get['start_time'])];
|
|
}
|
|
if(isset($get['end_time']) && $get['end_time']!=''){
|
|
$where[] = ['createtime','<=',strtotime($get['end_time'])];
|
|
}
|
|
|
|
$count = Db::name('recrui')
|
|
->where($where)
|
|
->count();
|
|
$lists = Db::name('recrui')
|
|
->where($where)
|
|
->page($get['page'],$get['limit'])
|
|
->order('id desc')
|
|
->select();
|
|
foreach ($lists as &$item){
|
|
$branch=Db::name('staff_group')->where('id',$item['branch_id'])->find();
|
|
if($branch){
|
|
$item['branch_name']=$branch['name'];
|
|
}else{
|
|
$item['branch_name']='-';
|
|
}
|
|
|
|
$type=Db::name('recruitype')->where('id',$item['type_id'])->find();
|
|
$item['type_name']=$type['zpname'];
|
|
$item['createtime']=date("Y-m-d H:i:s",$item['createtime']);
|
|
}
|
|
return ['count'=>$count , 'lists'=>$lists];
|
|
}
|
|
|
|
public static function recruiinfo($id){
|
|
|
|
return Db::name('recrui')->where('id',$id)->find();
|
|
|
|
}
|
|
|
|
public static function edits($post){
|
|
$post['createtime']=time();
|
|
return Db::name('recrui')->where('id',$post['id'])->data($post)->update();
|
|
}
|
|
|
|
public static function filed_lists($get){
|
|
$where = [];
|
|
if(isset($get['sex']) && $get['sex'] != ''){
|
|
$where[] = ['sex','=',$get['sex']];
|
|
}
|
|
if(isset($get['onwork']) && $get['onwork'] != ''){
|
|
$where[] = ['onwork','=',$get['onwork']];
|
|
}
|
|
if(isset($get['group_id']) && $get['group_id']){
|
|
$where[] = ['group_id','=',$get['group_id']];
|
|
}
|
|
|
|
//创建时间查询
|
|
if(isset($get['start_time']) && $get['start_time']!=''){
|
|
$where[] = ['createtime','>=',strtotime($get['start_time'])];
|
|
}
|
|
if(isset($get['end_time']) && $get['end_time']!=''){
|
|
$where[] = ['createtime','<=',strtotime($get['end_time'])];
|
|
}
|
|
$count = Db::name('user_recruit')
|
|
->where($where)
|
|
->count();
|
|
$lists = Db::name('user_recruit')
|
|
->where($where)
|
|
->page($get['page'],$get['limit'])
|
|
->order('id desc')
|
|
->select();
|
|
foreach ($lists as &$item){
|
|
$branch=Db::name('recrui')->where('id',$item['position'])->find();
|
|
$item['branch_name']=$branch['name'];
|
|
//$type=Db::name('recruitype')->where('id',$item['type_id'])->find();
|
|
///$item['type_name']=$type['zpname'];
|
|
$item['crem_time']=date("Y-m-d H:i:s",$item['crem_time']);
|
|
}
|
|
|
|
|
|
return ['count'=>$count , 'lists'=>$lists];
|
|
}
|
|
|
|
} |