...
|
...
|
@@ -201,8 +201,8 @@ class AdminOrderController extends AdminBaseController |
|
|
->find();
|
|
|
$list['create_time'] = date('Y-m-d H:i:s',$list['cre']);
|
|
|
$list['update_time'] = date('Y-m-d H:i:s',$list['up']);
|
|
|
$list['start_time'] = date('Y-m-d',$list['start_time']);
|
|
|
$list['end_time'] = date('Y-m-d',$list['end_time']);
|
|
|
$list['start_time'] = $list['start_time'];
|
|
|
$list['end_time'] = $list['end_time'];
|
|
|
$this->assign('list',$list);
|
|
|
// 雇佣事项
|
|
|
$where_select['type'] = 1;
|
...
|
...
|
@@ -249,6 +249,243 @@ class AdminOrderController extends AdminBaseController |
|
|
$this->error('失败');
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 分配聘用信息
|
|
|
* @adminMenu(
|
|
|
* 'name' => '分配聘用信息',
|
|
|
* 'parent' => 'index',
|
|
|
* 'display'=> false,
|
|
|
* 'hasView'=> true,
|
|
|
* 'order' => 10000,
|
|
|
* 'icon' => '',
|
|
|
* 'remark' => '分配聘用信息',
|
|
|
* 'param' => ''
|
|
|
* )
|
|
|
*/
|
|
|
public function to()
|
|
|
{
|
|
|
$data = $this->request->param();
|
|
|
$where_coo['o.status'] = array('neq',9);
|
|
|
$where_coo['o.id'] = $data['id'];
|
|
|
$coo_list = Db::name('Order')->alias('o')
|
|
|
->where($where_coo)
|
|
|
->join("Member m",'m.id = o.user_id')
|
|
|
->field('m.id as user_id,m.name,m.tel,o.order_sn,o.hire_id,o.id')
|
|
|
->find();
|
|
|
if($this->request->isPost()){
|
|
|
$where_resume['user_id'] = $data['type'];
|
|
|
$where_resume['status'] = 3;
|
|
|
$resume = Db::name('Resume')->where($where_resume)->value('id');
|
|
|
if(!$resume){
|
|
|
$this->error('分配失败');
|
|
|
}else{
|
|
|
$addLog['order_id'] = $data['id'];
|
|
|
$addLog['hire_id'] = $coo_list['hire_id'];
|
|
|
$addLog['resume_int'] = $resume;
|
|
|
$addLog['resume_user_id'] = $data['type'];
|
|
|
$addLog['status'] = 6;
|
|
|
$addLog['create_time'] = time();
|
|
|
$addLog['update_time'] = time();
|
|
|
$res = Db::name('CompareLog')->insertGetId($addLog);
|
|
|
if($res){
|
|
|
$this->success('分配成功',url('index'));
|
|
|
}else{
|
|
|
$this->error('分配失败');
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
$where_coo['o.status'] = array('neq',9);
|
|
|
$where_coo['o.id'] = $data['id'];
|
|
|
$coo_list = Db::name('Order')->alias('o')
|
|
|
->where($where_coo)
|
|
|
->join("Member m",'m.id = o.user_id')
|
|
|
->field('m.id as user_id,m.name,m.tel,o.order_sn,o.hire_id,o.id')
|
|
|
->find();
|
|
|
$final['parent'] = $coo_list;
|
|
|
// 查询所有兼职人姓名
|
|
|
$where_member['m.id'] = array('neq',$coo_list['user_id']);
|
|
|
$where_member['m.status'] = 2;
|
|
|
$where_member['r.status'] = 3;
|
|
|
$member = Db::name('Member')->alias('m')
|
|
|
->where($where_member)
|
|
|
->join('Resume r','r.user_id = m.id')
|
|
|
->field('m.id,m.name')->select()->toArray();
|
|
|
// 查询是否分配
|
|
|
$where_log['hire_id'] = $coo_list['hire_id'];
|
|
|
$where_log['status'] = array('neq',9);
|
|
|
$log = Db::name('CompareLog')->where($where_log)->column('resume_user_id');
|
|
|
$res_log = array_unique(array_filter($log));
|
|
|
$res = array();
|
|
|
if($member && $log){
|
|
|
$mem_arr =array();
|
|
|
foreach ($member as $k=>$v){
|
|
|
$mem_arr[] = $v['id'];
|
|
|
$mem_id[]['id'] = $v['id'];
|
|
|
}
|
|
|
$dif = array_diff($mem_arr,$res_log);
|
|
|
foreach ($member as $mk=>$mv){
|
|
|
if(in_array($mv['id'],$dif)){
|
|
|
$res[] = $mv;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$final['member'] = $res;
|
|
|
$this->assign('list',$final);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* 查看分配列表
|
|
|
* @adminMenu(
|
|
|
* 'name' => '查看分配列表',
|
|
|
* 'parent' => 'index',
|
|
|
* 'display'=> false,
|
|
|
* 'hasView'=> true,
|
|
|
* 'order' => 10000,
|
|
|
* 'icon' => '',
|
|
|
* 'remark' => '查看分配列表',
|
|
|
* 'param' => ''
|
|
|
* )
|
|
|
*/
|
|
|
public function toList()
|
|
|
{
|
|
|
$data = $this->request->param();
|
|
|
$final = $this->adminIndex($data);
|
|
|
$arr = array();
|
|
|
if(!empty($final['where_arr']['create_time'])){
|
|
|
$where_hire['l.create_time'] = $final['where_arr']['create_time'];
|
|
|
$arr['create_time'] = $final['where_arr']['create_time'];
|
|
|
}
|
|
|
if(!empty($data['name'])){
|
|
|
$arr['name'] = $data['name'];
|
|
|
$where_hire['m.name'] = array('like',"%".$data['name']."%");
|
|
|
$this->assign('name',$data['name']);
|
|
|
}
|
|
|
if(!empty($data['tel'])){
|
|
|
$arr['tel'] = $data['tel'];
|
|
|
$where_hire['m.tel'] = array('like',"%".$data['tel']."%");
|
|
|
$this->assign('tel',$data['tel']);
|
|
|
}
|
|
|
$where_coo['o.status'] = array('neq',9);
|
|
|
$where_coo['o.id'] = $data['id'];
|
|
|
$coo_list = Db::name('Order')->alias('o')
|
|
|
->where($where_coo)
|
|
|
->join("Member m",'m.id = o.user_id')
|
|
|
->field('m.name,m.tel,o.order_sn,o.hire_id,o.id')
|
|
|
->find();
|
|
|
$final['parent'] = $coo_list;
|
|
|
// 查询关联表,获取分配人信息
|
|
|
$where_hire['l.hire_id'] = $coo_list['hire_id'];
|
|
|
$where_hire['l.status'] = array('neq',9);
|
|
|
$log = Db::name('CompareLog')->alias('l')
|
|
|
->where($where_hire)
|
|
|
->join('Resume r','r.id = l.resume_int')
|
|
|
->join("Member m",'m.id = r.user_id')
|
|
|
->field("m.name,m.tel,m.id as user_id , l.id ,l.status,l.create_time,l.update_time,l.start,l.common_time")
|
|
|
->paginate(1,false,['query'=>$arr]);
|
|
|
// ->select()->toArray();
|
|
|
$final['log'] = $log;
|
|
|
$this->assign('list',$final);
|
|
|
$this->assign('page',$log->render());
|
|
|
return $this->fetch('tolist');
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查看分配信息
|
|
|
* @adminMenu(
|
|
|
* 'name' => '查看分配信息',
|
|
|
* 'parent' => 'index',
|
|
|
* 'display'=> false,
|
|
|
* 'hasView'=> true,
|
|
|
* 'order' => 10000,
|
|
|
* 'icon' => '',
|
|
|
* 'remark' => '查看分配信息',
|
|
|
* 'param' => ''
|
|
|
* )
|
|
|
*/
|
|
|
public function viewSon()
|
|
|
{
|
|
|
$where_coo['l.id'] = $this->request->param('id');
|
|
|
$where_coo['l.status'] = array('neq',9);
|
|
|
$list = Db::name('CompareLog')->alias('l')
|
|
|
->where($where_coo)
|
|
|
->join("Order o",'o.id = l.order_id')
|
|
|
->join("Hire h",'h.id = l.hire_id')
|
|
|
->join("Member m",'m.id = h.user_id')
|
|
|
->field('l.* ,m.name as hire_name,m.tel as hire_tel,o.order_sn,o.id as orderId')
|
|
|
->find();
|
|
|
$list['create_time'] = date('Y-m-d H:i:s',$list['create_time']);
|
|
|
$list['update_time'] = date('Y-m-d H:i:s',$list['update_time']);
|
|
|
$list['common_time'] = $list['common_time']?date('Y-m-d H:i:s',$list['common_time']):'暂无';
|
|
|
$where_mem['id'] = $list['resume_user_id'];
|
|
|
$resume = Db::name("Member")->where($where_mem)->find();
|
|
|
// $list['resume_id'] = $resume['id'];
|
|
|
$list['resume_name'] = $resume['name'];
|
|
|
$list['resume_tel'] = $resume['tel'];
|
|
|
$this->assign('list',$list);
|
|
|
return $this->fetch('editson');
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 编辑分配信息
|
|
|
* @adminMenu(
|
|
|
* 'name' => '编辑分配信息',
|
|
|
* 'parent' => 'index',
|
|
|
* 'display'=> false,
|
|
|
* 'hasView'=> true,
|
|
|
* 'order' => 10000,
|
|
|
* 'icon' => '',
|
|
|
* 'remark' => '编辑分配信息',
|
|
|
* 'param' => ''
|
|
|
* )
|
|
|
*/
|
|
|
public function editSon()
|
|
|
{
|
|
|
// 添加数据
|
|
|
$data = $this->request->post();
|
|
|
$where_log['id'] = $data['id'];
|
|
|
$where_log['status'] = array('neq',9);
|
|
|
$up['start'] = empty($data['start'])?0:$data['start'];
|
|
|
$up['status'] = $data['status'];
|
|
|
$up['update_time'] = time();
|
|
|
$up['common_time'] = $data['common_time'] == '暂无'?0:strtotime($data['common_time']);
|
|
|
$final = Db::name('CompareLog')->where($where_log)->update($up);
|
|
|
if($final){
|
|
|
$this->success('成功',url('toList',array('id'=>$data['orderId'])));
|
|
|
}else{
|
|
|
$this->error('失败');
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 取消分配
|
|
|
* @adminMenu(
|
|
|
* 'name' => '取消分配',
|
|
|
* 'parent' => 'index',
|
|
|
* 'display'=> false,
|
|
|
* 'hasView'=> true,
|
|
|
* 'order' => 10000,
|
|
|
* 'icon' => '',
|
|
|
* 'remark' => '取消分配',
|
|
|
* 'param' => ''
|
|
|
* )
|
|
|
*/
|
|
|
public function cancel(){
|
|
|
$data = $this->request->param();
|
|
|
$where_log['id'] = $data['id'];
|
|
|
$where_log['status'] = array('neq',9);
|
|
|
$up['status'] = 9;
|
|
|
$up['update_time'] = time();
|
|
|
$log = Db::name('CompareLog')->where($where_log)->update($up);
|
|
|
if($log){
|
|
|
$this->success('取消成功');
|
|
|
}else{
|
|
|
$this->error('取消失败');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|