$workers['data'][$k]['category_name'] = cache('categorys')[$v['category_id']]['name'];
}
return $workers;
}
/**
* 获取员工详情
*/
function get_details($id){
$result = $this->get($id);
$worker = $result->toArray();
$next = $this->where('id','<',$id)->where('category_id',$worker['category_id'])->order('id desc')->find();
$prev = $this->where('id','>',$id)->where('category_id',$worker['category_id'])->order('id asc')->find();
$prev = $prev?$prev->toArray():array('title'=>'返回列表','url'=>url('index/worker/lists',['category_id'=>$worker['category_id']]));
$next = $next?$next->toArray():array('title'=>'返回列表','url'=>url('index/worker/lists',['category_id'=>$worker['category_id']]));
$worker['prev'] = array('title'=>$prev['title'],'url'=>$prev['url']);
$worker['next'] = array('title'=>$next['title'],'url'=>$next['url']);
return $worker;
}
}